From 213bc0704317e03b4853166e9293422b4dc76154 Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Fri, 6 Nov 2020 02:18:34 -0800 Subject: [PATCH 01/10] Adding istanbul for code coverage --- .gitignore | 2 + package-lock.json | 1661 +++++++++++++++++++++++++++++++++------- package.json | 33 +- spec/package-lock.json | 897 +++++++++++++++++++++- spec/package.json | 8 +- tsconfig-base.json | 7 + 6 files changed, 2320 insertions(+), 288 deletions(-) diff --git a/.gitignore b/.gitignore index 1125861f1..e2230a5e9 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ spec/**/*.js spec/**/*.d.ts spec/**/*.js.map spec/**/secrets.ts + +.nyc_output/* \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 74ef87ee5..6e1405c2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -228,6 +228,12 @@ "@babel/types": "^7.4.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/helper-wrap-function": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz", @@ -776,6 +782,76 @@ "to-fast-properties": "^2.0.0" } }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/nyc-config-typescript": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@istanbuljs/nyc-config-typescript/-/nyc-config-typescript-1.0.1.tgz", + "integrity": "sha512-/gz6LgVpky205LuoOfwEZmnUtaSmdk0QIMcNFj9OvxhiMhPpKftMgZmGN7jNj7jR+lr8IB1Yks3QSSSNSxfoaQ==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2" + } + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, "@samverschueren/stream-to-observable": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", @@ -785,6 +861,12 @@ "any-observable": "^0.3.0" } }, + "@types/chai": { + "version": "4.2.14", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", + "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", + "dev": true + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -792,9 +874,9 @@ "dev": true }, "@types/mocha": { - "version": "5.2.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", - "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", "dev": true }, "@types/node": { @@ -824,6 +906,24 @@ "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "dependencies": { + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + } + } + }, "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -891,12 +991,27 @@ "buffer-equal": "^1.0.0" } }, + "append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "requires": { + "default-require-extensions": "^3.0.0" + } + }, "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", "dev": true }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -1263,6 +1378,28 @@ "unset-value": "^1.0.0" } }, + "caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "requires": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + } + }, + "call-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", + "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.0" + } + }, "caller-callsite": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", @@ -1387,6 +1524,12 @@ } } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", @@ -1407,20 +1550,20 @@ } }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "is-fullwidth-code-point": { @@ -1430,69 +1573,34 @@ "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { + "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" } } } @@ -1580,6 +1688,12 @@ "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -1753,6 +1867,23 @@ } } }, + "default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "requires": { + "strip-bom": "^4.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + } + } + }, "default-resolution": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/default-resolution/-/default-resolution-2.0.0.tgz", @@ -1903,23 +2034,48 @@ } }, "es-abstract": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", - "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", + "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-keys": "^1.0.12" + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -1938,6 +2094,12 @@ "next-tick": "^1.0.0" } }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, "es6-iterator": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", @@ -2206,6 +2368,17 @@ } } }, + "find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, "find-parent-dir": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", @@ -2253,18 +2426,18 @@ "dev": true }, "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", + "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", "dev": true, "requires": { "is-buffer": "~2.0.3" }, "dependencies": { "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "dev": true } } @@ -2300,6 +2473,59 @@ "for-in": "^1.0.1" } }, + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -2309,6 +2535,12 @@ "map-cache": "^0.2.2" } }, + "fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", + "dev": true + }, "fs-mkdirp-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", @@ -2890,6 +3122,12 @@ "simple-git": "^1.85.0" } }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -2902,12 +3140,37 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-intrinsic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", + "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } + } + }, "get-own-enumerable-property-symbols": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz", "integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg==", "dev": true }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, "get-stdin": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", @@ -3293,6 +3556,30 @@ } } }, + "hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "requires": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "dependencies": { + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -3314,6 +3601,12 @@ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, "husky": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/husky/-/husky-2.3.0.tgz", @@ -3351,6 +3644,12 @@ "resolve-from": "^3.0.0" } }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "indent-string": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", @@ -3394,12 +3693,6 @@ "loose-envify": "^1.0.0" } }, - "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", - "dev": true - }, "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", @@ -3452,9 +3745,9 @@ "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "dev": true }, "is-ci": { @@ -3487,9 +3780,9 @@ } }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, "is-descriptor": { @@ -3559,6 +3852,12 @@ "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", "dev": true }, + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -3643,12 +3942,20 @@ } }, "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "dev": true, "requires": { - "has": "^1.0.1" + "has-symbols": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } } }, "is-regexp": { @@ -3673,14 +3980,28 @@ "dev": true }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } } }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", @@ -3736,16 +4057,421 @@ "whatwg-fetch": ">=0.10.0" } }, - "jest-worker": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", - "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", "dev": true, "requires": { - "merge-stream": "^1.0.1", - "supports-color": "^6.1.0" - }, - "dependencies": { + "append-transform": "^2.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.5.tgz", + "integrity": "sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==", + "dev": true, + "requires": { + "@babel/types": "^7.12.5", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", + "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.10.4", + "@babel/template": "^7.10.4", + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", + "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", + "dev": true, + "requires": { + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz", + "integrity": "sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==", + "dev": true, + "requires": { + "@babel/types": "^7.12.1" + } + }, + "@babel/helper-module-imports": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz", + "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==", + "dev": true, + "requires": { + "@babel/types": "^7.12.5" + } + }, + "@babel/helper-module-transforms": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz", + "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.12.1", + "@babel/helper-replace-supers": "^7.12.1", + "@babel/helper-simple-access": "^7.12.1", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/helper-validator-identifier": "^7.10.4", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "lodash": "^4.17.19" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", + "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", + "dev": true, + "requires": { + "@babel/types": "^7.10.4" + } + }, + "@babel/helper-replace-supers": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz", + "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.12.1", + "@babel/helper-optimise-call-expression": "^7.10.4", + "@babel/traverse": "^7.12.5", + "@babel/types": "^7.12.5" + } + }, + "@babel/helper-simple-access": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz", + "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==", + "dev": true, + "requires": { + "@babel/types": "^7.12.1" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", + "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", + "dev": true, + "requires": { + "@babel/types": "^7.11.0" + } + }, + "@babel/helpers": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz", + "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==", + "dev": true, + "requires": { + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.5", + "@babel/types": "^7.12.5" + } + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.5.tgz", + "integrity": "sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ==", + "dev": true + }, + "@babel/template": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", + "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/parser": "^7.10.4", + "@babel/types": "^7.10.4" + } + }, + "@babel/traverse": { + "version": "7.12.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.5.tgz", + "integrity": "sha512-xa15FbQnias7z9a62LwYAA5SZZPkHIXpd42C6uW68o8uTuua96FHZy1y61Va5P/i83FAAcMpW8+A/QayntzuqA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.5", + "@babel/helper-function-name": "^7.10.4", + "@babel/helper-split-export-declaration": "^7.11.0", + "@babel/parser": "^7.12.5", + "@babel/types": "^7.12.5", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.19" + } + }, + "@babel/types": { + "version": "7.12.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.6.tgz", + "integrity": "sha512-hwyjw6GvjBLiyy3W0YQf0Z5Zf4NpYejUnKFcfcUhZCSffoBBp30w6wP2Wn6pk31jMYZvcOrB/1b7cGXvEoKogA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest-worker": { + "version": "24.6.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", + "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "dev": true, + "requires": { + "merge-stream": "^1.0.1", + "supports-color": "^6.1.0" + }, + "dependencies": { "supports-color": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", @@ -3837,15 +4563,6 @@ "readable-stream": "^2.0.5" } }, - "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", - "dev": true, - "requires": { - "invert-kv": "^2.0.0" - } - }, "lead": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lead/-/lead-1.0.0.tgz", @@ -4067,6 +4784,12 @@ "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -4105,6 +4828,29 @@ "sourcemap-codec": "^1.4.4" } }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -4114,15 +4860,6 @@ "kind-of": "^6.0.2" } }, - "map-age-cleaner": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", - "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } - }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -4182,25 +4919,6 @@ "escape-string-regexp": "^1.0.4" } }, - "mem": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", - "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", - "dev": true, - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - }, - "dependencies": { - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - } - } - }, "merge-stream": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", @@ -4291,9 +5009,9 @@ } }, "mocha": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.4.tgz", - "integrity": "sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", + "integrity": "sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -4308,7 +5026,7 @@ "js-yaml": "3.13.1", "log-symbols": "2.2.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", + "mkdirp": "0.5.4", "ms": "2.1.1", "node-environment-flags": "1.0.5", "object.assign": "4.1.0", @@ -4316,9 +5034,9 @@ "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" }, "dependencies": { "debug": { @@ -4344,6 +5062,21 @@ "path-is-absolute": "^1.0.0" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "supports-color": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", @@ -4435,6 +5168,15 @@ "is-stream": "^1.0.1" } }, + "node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "requires": { + "process-on-spawn": "^1.0.0" + } + }, "node-releases": { "version": "1.1.19", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.19.tgz", @@ -4503,12 +5245,243 @@ "which": "^1.2.10" } }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "requires": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -4546,6 +5519,12 @@ } } }, + "object-inspect": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -4586,13 +5565,13 @@ } }, "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "object.map": { @@ -4651,35 +5630,12 @@ "readable-stream": "^2.0.1" } }, - "os-locale": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", - "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", - "dev": true, - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - } - }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", - "dev": true - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, - "p-is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", - "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", - "dev": true - }, "p-limit": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", @@ -4710,6 +5666,18 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -4894,6 +5862,15 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, + "process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "requires": { + "fromentries": "^1.2.0" + } + }, "property-expr": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-1.5.1.tgz", @@ -5104,6 +6081,15 @@ } } }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, "remove-bom-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", @@ -5633,9 +6619,9 @@ } }, "source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -5668,6 +6654,40 @@ "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", "dev": true }, + "spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "dev": true, + "requires": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "spdx-correct": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", @@ -5777,6 +6797,106 @@ "strip-ansi": "^3.0.0" } }, + "string.prototype.trimend": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", + "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } + } + }, + "string.prototype.trimstart": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", + "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -5877,6 +6997,17 @@ } } }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -5982,6 +7113,27 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, + "ts-node": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", @@ -6049,6 +7201,15 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, "typescript": { "version": "3.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz", @@ -6245,6 +7406,12 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, "v8flags": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.3.tgz", @@ -6403,6 +7570,18 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -6416,22 +7595,21 @@ "dev": true }, "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "requires": { - "cliui": "^4.0.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.2" }, "dependencies": { "ansi-regex": { @@ -6469,9 +7647,9 @@ } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -6479,91 +7657,22 @@ } }, "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", - "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" - } - }, - "yargs-parser": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", - "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } + "lodash": "^4.17.15", + "yargs": "^13.3.0" } }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, "yup": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/yup/-/yup-0.27.0.tgz", diff --git a/package.json b/package.json index 752a6da6f..a79c14625 100644 --- a/package.json +++ b/package.json @@ -19,21 +19,26 @@ "@babel/core": "^7.4.4", "@babel/plugin-transform-runtime": "^7.4.4", "@babel/preset-env": "^7.4.4", - "@types/mocha": "^5.2.6", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@types/chai": "^4.2.14", + "@types/mocha": "^5.2.7", "@types/node": "^12.0.10", "chai": "^4.2.0", "gulp": "^4.0.2", "husky": "^2.2.0", "isomorphic-fetch": "^2.2.1", "lint-staged": "^8.1.5", - "mocha": "^6.1.4", + "mocha": "^6.2.3", "msal": "^1.0.0", + "nyc": "^15.1.0", "prettier": "^1.17.0", "rollup": "^1.10.1", "rollup-plugin-babel": "^4.3.2", "rollup-plugin-commonjs": "^10.0.1", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-terser": "^5.0.0", + "source-map-support": "^0.5.19", + "ts-node": "^9.0.0", "tslint": "^5.16.0", "tslint-config-prettier": "^1.18.0", "typescript": "^3.4.5", @@ -61,10 +66,32 @@ "format:rc": "prettier --write --parser json \"**/.*rc\"", "format:ts": "prettier --write \"**/*.ts\"", "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", - "prepack": "npm install && npm run build && npm run test" + "prepack": "npm install && npm run build && npm run test", + "test:nyc": "mocha -r ts-node/register --project tsconfig-base.json spec/content/*.ts && mocha -r ts-node/register spec/core/*.ts && mocha -r ts-node/register spec/middleware/*.ts && mocha -r ts-node/register spec/tasks/*.ts", + "test:mocha": "mocha -r ts-node/register spec/core/*.ts" }, "repository": { "type": "git", "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" + }, + "nyc": { + "require": [ + "ts-node/register", + "source-map-support/register" + ], + "extends": "@istanbuljs/nyc-config-typescript", + "include": [ + "src/*" + ], + "exclude": [ + "spec/", + "node_modules/**", + "**/*.d.ts", + "**/*.test.ts", + "*.js" + ], + "all": true, + "instrument": true, + "cache": false } } diff --git a/spec/package-lock.json b/spec/package-lock.json index ac99494c4..f754c863b 100644 --- a/spec/package-lock.json +++ b/spec/package-lock.json @@ -8,9 +8,9 @@ "dev": true }, "@types/chai": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.7.tgz", - "integrity": "sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==", + "version": "4.2.14", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", + "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", "dev": true }, "@types/form-data": { @@ -43,9 +43,9 @@ "dev": true }, "@types/mocha": { - "version": "5.2.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", - "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", "dev": true }, "@types/node": { @@ -54,6 +54,58 @@ "integrity": "sha512-Jrb/x3HT4PTJp6a4avhmJCDEVrPdqLfl3e8GGMbpkGGdwAV5UGlIs4vVEfsHHfylZVOKZWpOqmqFH8CbfOZ6kg==", "dev": true }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -72,6 +124,55 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "chai": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", @@ -86,12 +187,92 @@ "type-detect": "^4.0.5" } }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "chokidar": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "combined-stream": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", @@ -101,6 +282,27 @@ "delayed-stream": "~1.0.0" } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -116,6 +318,18 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, "encoding": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", @@ -131,6 +345,43 @@ "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==", "dev": true }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", @@ -142,12 +393,72 @@ "mime-types": "^2.1.12" } }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -157,12 +468,76 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isomorphic-fetch": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", @@ -185,6 +560,40 @@ } } }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "mime-db": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", @@ -200,6 +609,54 @@ "mime-db": "1.40.0" } }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mocha": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.2.1.tgz", + "integrity": "sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.4.3", + "debug": "4.2.0", + "diff": "4.0.2", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.14.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.2", + "nanoid": "3.1.12", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "7.2.0", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.0.2", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "2.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "msal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/msal/-/msal-1.0.0.tgz", @@ -210,24 +667,216 @@ "tslib": "^1.9.3" } }, + "nanoid": { + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz", + "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A==", + "dev": true + }, "node-fetch": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", + "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-node": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", @@ -245,6 +894,242 @@ "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==", "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "workerpool": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.2.tgz", + "integrity": "sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/spec/package.json b/spec/package.json index 97111cb74..42132b6f8 100644 --- a/spec/package.json +++ b/spec/package.json @@ -1,17 +1,19 @@ { "devDependencies": { "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta", - "@types/chai": "^4.1.7", + "@types/chai": "^4.2.14", "@types/form-data": "^2.2.1", "@types/isomorphic-fetch": "0.0.35", "@types/microsoft-graph": "^1.9.0", - "@types/mocha": "^5.2.6", + "@types/mocha": "^5.2.7", "@types/node": "^12.0.0", "chai": "^4.2.0", "es6-promise": "^4.2.6", "form-data": "^2.3.3", "isomorphic-fetch": "^2.2.1", + "mocha": "^8.2.1", "msal": "^1.0.0", - "node-fetch": "^2.6.1" + "node-fetch": "^2.6.1", + "ts-node": "^9.0.0" } } diff --git a/tsconfig-base.json b/tsconfig-base.json index bcd34dddb..bd470bb72 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -7,5 +7,12 @@ "removeComments": false, "sourceMap": true, "declaration": true + }, + "ts-node": { + "ignore": ["*.d.ts"], + "compilerOptions": { + "target": "es6", + "module": "ES6" + } } } From b6cee0b5c77a740d74bbca9e1c7c496b0f6e02b3 Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Sun, 6 Dec 2020 16:34:00 -0800 Subject: [PATCH 02/10] Karma test --- karma.conf.js | 13 + package-lock.json | 2400 ++++++++++++++++- package.json | 30 +- spec/middleware/MiddlewareUtil.ts | 610 ++--- .../HardCodedAuthenticationProvider.ts | 0 {spec => spec2}/development/secrets.sample.ts | 0 spec2/development/secrets.ts | 7 + {spec => spec2}/development/test-helper.ts | 0 .../development/workload/OneNote.ts | 0 .../development/workload/PageIterator.ts | 0 .../development/workload/delta-query.ts | 0 {spec => spec2}/development/workload/excel.ts | 0 .../development/workload/groups.ts | 0 .../development/workload/insights.ts | 0 .../development/workload/open-extensions.ts | 0 {spec => spec2}/development/workload/users.ts | 0 src/TestInclusion.ts | 17 + src/browser/TestAll.ts | 1 + tsconfig-es.json | 2 +- tsconfig.json | 11 + 20 files changed, 2624 insertions(+), 467 deletions(-) create mode 100644 karma.conf.js rename {spec => spec2}/development/HardCodedAuthenticationProvider.ts (100%) rename {spec => spec2}/development/secrets.sample.ts (100%) create mode 100644 spec2/development/secrets.ts rename {spec => spec2}/development/test-helper.ts (100%) rename {spec => spec2}/development/workload/OneNote.ts (100%) rename {spec => spec2}/development/workload/PageIterator.ts (100%) rename {spec => spec2}/development/workload/delta-query.ts (100%) rename {spec => spec2}/development/workload/excel.ts (100%) rename {spec => spec2}/development/workload/groups.ts (100%) rename {spec => spec2}/development/workload/insights.ts (100%) rename {spec => spec2}/development/workload/open-extensions.ts (100%) rename {spec => spec2}/development/workload/users.ts (100%) create mode 100644 src/TestInclusion.ts create mode 100644 src/browser/TestAll.ts create mode 100644 tsconfig.json diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 000000000..88fc7dcd1 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,13 @@ +require("isomorphic-fetch"); +module.exports = function(config) { + config.set({ + frameworks: ["mocha", "chai", "karma-typescript"], + files: ["spec/**/*.ts", "src/**/*.ts"], + preprocessors: { + "**/*.ts": ["karma-typescript"], // *.tsx for React Jsx + }, + karmaTypescriptConfig: { + tsconfig: "tsconfig.json", + }, + }); +}; diff --git a/package-lock.json b/package-lock.json index 6e1405c2d..ca4c378f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -900,12 +900,32 @@ "@types/node": "*" } }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, "acorn": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true }, + "acorn-walk": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.0.0.tgz", + "integrity": "sha512-oZRad/3SMOI/pxbbmqyurIx7jHw1wZDcR9G44L8pUVFEomX/0dH89SrM1KaDXuv1NpzAXz6Op/Xu/Qd5XXzdEA==", + "dev": true + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1063,6 +1083,12 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, + "array-filter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", + "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", + "dev": true + }, "array-initial": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", @@ -1144,12 +1170,49 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "requires": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1162,6 +1225,12 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", + "dev": true + }, "async-done": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.1.tgz", @@ -1188,6 +1257,11 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, "async-settle": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", @@ -1203,6 +1277,15 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "available-typed-arrays": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", + "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", + "dev": true, + "requires": { + "array-filter": "^1.0.0" + } + }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -1220,11 +1303,15 @@ "now-and-later": "^2.0.0" } }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base": { "version": "0.11.2", @@ -1281,17 +1368,83 @@ } } }, + "base64-arraybuffer": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", + "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, "binary-extensions": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + }, + "bn.js": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", + "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", + "dev": true + }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1326,12 +1479,137 @@ } } }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-resolve": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", + "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", + "dev": true, + "requires": { + "resolve": "^1.17.0" + }, + "dependencies": { + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + } + } + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "dev": true, + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, "browserslist": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.0.tgz", @@ -1343,6 +1621,16 @@ "node-releases": "^1.1.19" } }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -1355,12 +1643,29 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, "builtin-modules": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", "dev": true }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -1418,6 +1723,11 @@ "caller-callsite": "^2.0.0" } }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, "callsites": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", @@ -1427,8 +1737,7 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "caniuse-lite": { "version": "1.0.30000969", @@ -1501,6 +1810,16 @@ "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -1682,6 +2001,31 @@ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", "dev": true }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + }, + "combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "dev": true, + "requires": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + }, + "dependencies": { + "convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", + "dev": true + } + } + }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", @@ -1694,17 +2038,25 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, "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==", - "dev": true + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "1.6.2", @@ -1718,6 +2070,49 @@ "typedarray": "^0.0.6" } }, + "connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, "convert-source-map": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", @@ -1727,6 +2122,11 @@ "safe-buffer": "~5.1.1" } }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1786,6 +2186,51 @@ "parse-json": "^4.0.0" } }, + "create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -1799,6 +2244,30 @@ "which": "^1.2.9" } }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=" + }, "d": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", @@ -1814,11 +2283,15 @@ "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", "dev": true }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==" + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -1826,8 +2299,7 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decode-uri-component": { "version": "0.2.0", @@ -1890,6 +2362,23 @@ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "dev": true }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + } + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1954,18 +2443,74 @@ "rimraf": "^2.2.8" } }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, "detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", "dev": true }, + "di": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=" + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "dom-serialize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", + "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "requires": { + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" + } + }, + "domain-browser": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.19.0.tgz", + "integrity": "sha512-fRA+BaAWOR/yr/t7T9E9GJztHPeFjj8U35ajyAjCDtAAnTn1Rc1f6W6VGPJrO1tkQv9zWu+JRof7z6oQtiYVFQ==", + "dev": true + }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -1988,6 +2533,11 @@ "object.defaults": "^1.1.0" } }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, "electron-to-chromium": { "version": "1.3.135", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.135.tgz", @@ -2000,12 +2550,40 @@ "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", "dev": true }, + "elliptic": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, "encoding": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", @@ -2024,6 +2602,87 @@ "once": "^1.4.0" } }, + "engine.io": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.2.tgz", + "integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==", + "requires": { + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" + } + }, + "engine.io-client": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.4.tgz", + "integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==", + "requires": { + "component-emitter": "~1.3.0", + "component-inherit": "0.0.3", + "debug": "~3.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.6", + "parseuri": "0.0.6", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "parseqs": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" + }, + "parseuri": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" + }, + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", + "integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.4", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=" + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -2111,6 +2770,12 @@ "es6-symbol": "^3.1.1" } }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", + "dev": true + }, "es6-symbol": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", @@ -2133,12 +2798,22 @@ "es6-symbol": "^3.1.1" } }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -2157,6 +2832,27 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "events": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, "execa": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", @@ -2234,8 +2930,7 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "extend-shallow": { "version": "3.0.2", @@ -2368,6 +3063,35 @@ } } }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "find-cache-dir": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", @@ -2442,6 +3166,11 @@ } } }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + }, "flush-write-stream": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", @@ -2458,6 +3187,11 @@ "integrity": "sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc=", "dev": true }, + "follow-redirects": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==" + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -2473,6 +3207,12 @@ "for-in": "^1.0.1" } }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, "foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -2541,6 +3281,23 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + } + } + }, "fs-mkdirp-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz", @@ -2554,8 +3311,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.2.9", @@ -3131,8 +3887,7 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "get-func-name": { "version": "2.0.0", @@ -3196,7 +3951,6 @@ "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3322,8 +4076,7 @@ "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", - "dev": true + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" }, "growl": { "version": "1.10.5", @@ -3512,6 +4265,26 @@ "ansi-regex": "^2.0.0" } }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -3556,6 +4329,52 @@ } } }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "hasha": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", @@ -3586,6 +4405,17 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -3607,6 +4437,34 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, "husky": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/husky/-/husky-2.3.0.tgz", @@ -3629,11 +4487,16 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "import-fresh": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", @@ -3656,11 +4519,15 @@ "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", "dev": true }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3669,8 +4536,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -3678,6 +4544,15 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "dev": true, + "requires": { + "source-map": "~0.5.3" + } + }, "interpret": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", @@ -3723,6 +4598,12 @@ } } }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -3759,6 +4640,15 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", + "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -3810,6 +4700,12 @@ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", "dev": true }, + "is-docker": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", + "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==", + "dev": true + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -3819,8 +4715,7 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-fullwidth-code-point": { "version": "1.0.0", @@ -3831,11 +4726,16 @@ "number-is-nan": "^1.0.0" } }, + "is-generator-function": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", + "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==", + "dev": true + }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -3846,6 +4746,15 @@ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, + "is-nan": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz", + "integrity": "sha512-z7bbREymOqt2CCaZVly8aC4ML3Xhfi0ekuOnjO2L8vKdl+CttdVoGZQhd4adMFAsxQ5VeRVwORs4tU8RH+HFtQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3" + } + }, "is-negated-glob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", @@ -3996,6 +4905,26 @@ } } }, + "is-typed-array": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.3.tgz", + "integrity": "sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.0", + "es-abstract": "^1.17.4", + "foreach": "^2.0.5", + "has-symbols": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -4029,12 +4958,26 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isbinaryfile": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.6.tgz", + "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==" + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -4428,116 +5371,583 @@ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { - "has-flag": "^4.0.0" + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", + "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest-worker": { + "version": "24.6.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", + "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", + "dev": true, + "requires": { + "merge-stream": "^1.0.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", + "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "just-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", + "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", + "dev": true + }, + "karma": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/karma/-/karma-5.2.3.tgz", + "integrity": "sha512-tHdyFADhVVPBorIKCX8A37iLHxc6RBRphkSoQ+MLKdAtFn1k97tD8WUGi1KlEtDZKL3hui0qhsY9HXUfSNDYPQ==", + "requires": { + "body-parser": "^1.19.0", + "braces": "^3.0.2", + "chokidar": "^3.4.2", + "colors": "^1.4.0", + "connect": "^3.7.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.1", + "glob": "^7.1.6", + "graceful-fs": "^4.2.4", + "http-proxy": "^1.18.1", + "isbinaryfile": "^4.0.6", + "lodash": "^4.17.19", + "log4js": "^6.2.1", + "mime": "^2.4.5", + "minimatch": "^3.0.4", + "qjobs": "^1.2.0", + "range-parser": "^1.2.1", + "rimraf": "^3.0.2", + "socket.io": "^2.3.0", + "source-map": "^0.6.1", + "tmp": "0.2.1", + "ua-parser-js": "0.7.22", + "yargs": "^15.3.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "optional": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "requires": { + "picomatch": "^2.2.1" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "karma-chai": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/karma-chai/-/karma-chai-0.1.0.tgz", + "integrity": "sha1-vuWtQEAFF4Ea40u5RfdikJEIt5o=", + "dev": true + }, + "karma-firefox-launcher": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.0.tgz", + "integrity": "sha512-dkiyqN2R6fCWt78rciOXJLFDWcQ7QEQi++HgebPJlw1y0ycDjGNDHuSrhdh48QG02fzZKK20WHFWVyBZ6CPngg==", + "dev": true, + "requires": { + "is-wsl": "^2.2.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" } } } }, - "istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "karma-mocha": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz", + "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==", "dev": true, "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" + "minimist": "^1.2.3" }, "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true } } }, - "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest-worker": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.6.0.tgz", - "integrity": "sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ==", - "dev": true, - "requires": { - "merge-stream": "^1.0.1", - "supports-color": "^6.1.0" + "karma-typescript": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/karma-typescript/-/karma-typescript-5.2.0.tgz", + "integrity": "sha512-idMJ0SKPLYudNiPaRw+GyOu0RQPJFpyUfrSN6/uFTzPLnJ7sLDd6xPMcxB+pNBHpL6s4fQfC5W9OlNblRvt2Dg==", + "dev": true, + "requires": { + "acorn": "^8.0.1", + "acorn-walk": "^8.0.0", + "assert": "^2.0.0", + "async": "^3.0.1", + "browser-resolve": "^2.0.0", + "browserify-zlib": "^0.2.0", + "buffer": "^5.4.3", + "combine-source-map": "^0.8.0", + "console-browserify": "^1.2.0", + "constants-browserify": "^1.0.0", + "convert-source-map": "^1.7.0", + "crypto-browserify": "^3.12.0", + "diff": "^4.0.1", + "domain-browser": "^4.16.0", + "events": "^3.2.0", + "glob": "^7.1.6", + "https-browserify": "^1.0.0", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.17.19", + "log4js": "^6.3.0", + "minimatch": "^3.0.4", + "os-browserify": "^0.3.0", + "pad": "^3.2.0", + "path-browserify": "^1.0.0", + "process": "^0.11.10", + "punycode": "^2.1.1", + "querystring-es3": "^0.2.1", + "readable-stream": "^3.1.1", + "source-map": "^0.7.3", + "stream-browserify": "^3.0.0", + "stream-http": "^3.1.0", + "string_decoder": "^1.3.0", + "timers-browserify": "^2.0.11", + "tmp": "^0.2.1", + "tty-browserify": "^0.0.1", + "url": "^0.11.0", + "util": "^0.12.1", + "vm-browserify": "^1.1.2" }, "dependencies": { - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "acorn": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.4.tgz", + "integrity": "sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ==", + "dev": true + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "safe-buffer": "~5.1.1" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } } } } }, - "js-levenshtein": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", - "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "just-debounce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", - "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", - "dev": true - }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -4781,8 +6191,7 @@ "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", - "dev": true + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash.flattendeep": { "version": "4.4.0", @@ -4790,6 +6199,12 @@ "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "dev": true }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -4810,6 +6225,18 @@ "wrap-ansi": "^3.0.1" } }, + "log4js": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz", + "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==", + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.4" + } + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -4919,6 +6346,22 @@ "escape-string-regexp": "^1.0.4" } }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, "merge-stream": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", @@ -4949,17 +6392,64 @@ "to-regex": "^3.0.2" } }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "mime": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "requires": { + "mime-db": "1.44.0" + } + }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5091,8 +6581,7 @@ "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" }, "msal": { "version": "1.0.0", @@ -5136,6 +6625,11 @@ "to-regex": "^3.0.1" } }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, "next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", @@ -5488,6 +6982,11 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -5525,6 +7024,56 @@ "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", "dev": true }, + "object-is": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.3.tgz", + "integrity": "sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } + } + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -5603,11 +7152,18 @@ "make-iterator": "^1.0.0" } }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } @@ -5630,6 +7186,12 @@ "readable-stream": "^2.0.1" } }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -5640,7 +7202,6 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, "requires": { "p-try": "^2.0.0" } @@ -5663,8 +7224,7 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "package-hash": { "version": "4.0.0", @@ -5678,6 +7238,34 @@ "release-zalgo": "^1.0.0" } }, + "pad": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/pad/-/pad-3.2.0.tgz", + "integrity": "sha512-2u0TrjcGbOjBTJpyewEl4hBO3OeX5wWue7eIFPzQTg6wFSvoaHcBTTUY5m+n0hd04gmTCPuY0kCpVIVuw5etwg==", + "dev": true, + "requires": { + "wcwidth": "^1.0.1" + } + }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, + "parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "dev": true, + "requires": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, "parse-filepath": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", @@ -5711,12 +7299,39 @@ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", "dev": true }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true + }, "path-dirname": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", @@ -5732,8 +7347,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-is-inside": { "version": "1.0.2", @@ -5793,6 +7407,24 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "pbkdf2": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", + "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -5856,6 +7488,12 @@ "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", @@ -5877,6 +7515,28 @@ "integrity": "sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g==", "dev": true }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -5910,6 +7570,69 @@ } } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qjobs": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==" + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, "read-pkg": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.1.1.tgz", @@ -6149,14 +7872,17 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" }, "resolve": { "version": "1.11.0", @@ -6214,6 +7940,11 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "rfdc": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -6223,6 +7954,16 @@ "glob": "^7.1.3" } }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, "rollup": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.12.3.tgz", @@ -6376,8 +8117,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "semver": { "version": "5.7.0", @@ -6409,8 +8149,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { "version": "2.0.0", @@ -6435,6 +8174,27 @@ } } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -6599,6 +8359,114 @@ } } }, + "socket.io": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", + "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "requires": { + "debug": "~4.1.0", + "engine.io": "~3.4.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.3.0", + "socket.io-parser": "~3.4.0" + } + }, + "socket.io-adapter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", + "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==" + }, + "socket.io-client": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "socket.io-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.1.tgz", + "integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==", + "requires": { + "component-emitter": "~1.3.0", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "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==" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + } + } + }, + "socket.io-parser": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", + "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + } + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -6768,18 +8636,106 @@ } } }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "stream-browserify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "dev": true, + "requires": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "stream-exhaust": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", "dev": true }, + "stream-http": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz", + "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + } + } + }, "stream-shift": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", "dev": true }, + "streamroller": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", + "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==" + } + } + }, "string-argv": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", @@ -7034,6 +8990,33 @@ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, + "timers-browserify": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", + "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "requires": { + "rimraf": "^3.0.0" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + } + } + }, "to-absolute-glob": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", @@ -7044,6 +9027,11 @@ "is-negated-glob": "^1.0.0" } }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -7101,6 +9089,11 @@ "through2": "^2.0.3" } }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + }, "toposort": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", @@ -7183,6 +9176,12 @@ "tslib": "^1.8.1" } }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -7195,6 +9194,15 @@ "integrity": "sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw==", "dev": true }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -7216,6 +9224,11 @@ "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==", "dev": true }, + "ua-parser-js": { + "version": "0.7.22", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.22.tgz", + "integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==" + }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", @@ -7342,6 +9355,16 @@ "through2-filter": "^3.0.0" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -7394,18 +9417,55 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "util": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", + "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", @@ -7491,6 +9551,26 @@ "vinyl": "^2.0.0" } }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true + }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, "whatwg-fetch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", @@ -7509,8 +9589,29 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "which-typed-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.2.tgz", + "integrity": "sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.2", + "es-abstract": "^1.17.5", + "foreach": "^2.0.5", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.1", + "is-typed-array": "^1.1.3" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } + } }, "wide-align": { "version": "1.1.3", @@ -7567,8 +9668,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "3.0.3", @@ -7582,6 +9682,16 @@ "typedarray-to-buffer": "^3.1.5" } }, + "ws": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz", + "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==" + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -7591,8 +9701,7 @@ "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yargs": { "version": "13.3.2", @@ -7667,6 +9776,11 @@ "yargs": "^13.3.0" } }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index a79c14625..590f2c048 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "types": "./lib/src/index.d.ts", "dependencies": { "@babel/runtime": "^7.4.4", + "esm": "^3.2.25", + "karma": "^5.2.3", "tslib": "^1.9.3" }, "devDependencies": { @@ -27,6 +29,10 @@ "gulp": "^4.0.2", "husky": "^2.2.0", "isomorphic-fetch": "^2.2.1", + "karma-chai": "^0.1.0", + "karma-firefox-launcher": "^2.1.0", + "karma-mocha": "^2.0.1", + "karma-typescript": "^5.2.0", "lint-staged": "^8.1.5", "mocha": "^6.2.3", "msal": "^1.0.0", @@ -67,31 +73,19 @@ "format:ts": "prettier --write \"**/*.ts\"", "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", "prepack": "npm install && npm run build && npm run test", - "test:nyc": "mocha -r ts-node/register --project tsconfig-base.json spec/content/*.ts && mocha -r ts-node/register spec/core/*.ts && mocha -r ts-node/register spec/middleware/*.ts && mocha -r ts-node/register spec/tasks/*.ts", - "test:mocha": "mocha -r ts-node/register spec/core/*.ts" + "test:cjs": "mocha -r ts-node/register --project tsconfig-base.json spec/content/*.ts && mocha -r ts-node/register spec/core/*.ts && mocha -r ts-node/register spec/middleware/*.ts && mocha -r ts-node/register spec/tasks/*.ts", + "test:esm": "mocha -r ts-node/register --require esm spec/content/*.ts && mocha -r ts-node/register --require esm spec/core/*.ts && mocha -r ts-node/register --require esm spec/middleware/*.ts && mocha -r ts-node/register --require esm spec/tasks/*.ts", + "test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts", + "cover": "nyc npm run test:esm", + "coverage": "nyc npm run test:cjs", + "karma": "karma start karma.conf.js" }, "repository": { "type": "git", "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" }, "nyc": { - "require": [ - "ts-node/register", - "source-map-support/register" - ], - "extends": "@istanbuljs/nyc-config-typescript", - "include": [ - "src/*" - ], - "exclude": [ - "spec/", - "node_modules/**", - "**/*.d.ts", - "**/*.test.ts", - "*.js" - ], "all": true, - "instrument": true, "cache": false } } diff --git a/spec/middleware/MiddlewareUtil.ts b/spec/middleware/MiddlewareUtil.ts index 9669c59f7..2a6efcf7e 100644 --- a/spec/middleware/MiddlewareUtil.ts +++ b/spec/middleware/MiddlewareUtil.ts @@ -1,334 +1,334 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ +// /** +// * ------------------------------------------------------------------------------------------- +// * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. +// * See License in the project root for license information. +// * ------------------------------------------------------------------------------------------- +// */ -import { assert } from "chai"; -import { NFHeaders } from "node-fetch"; +// import { assert } from "chai"; +// import { NFHeaders } from "node-fetch"; -import { FetchOptions } from "../../src/IFetchOptions"; -import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../src/middleware/MiddlewareUtil"; +// import { FetchOptions } from "../../src/IFetchOptions"; +// import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../src/middleware/MiddlewareUtil"; -describe("MiddlewareUtil.ts", async () => { - describe("getRequestHeader", () => { - const key: string = "Content-Type"; - const value: string = "application/json"; - const url = "dummy_url"; - it("Should get header from request object", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }); - const headerValue: string = getRequestHeader(request, undefined, key); - assert.equal(headerValue, value); - }); +// describe("MiddlewareUtil.ts", async () => { +// describe("getRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const url = "dummy_url"; +// it("Should get header from request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// const headerValue: string = getRequestHeader(request, undefined, key); +// assert.equal(headerValue, value); +// }); - it("Should get header from headers object", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }; - const headerValue: string = getRequestHeader(url, options, key); - assert.equal(headerValue, value); - }); +// it("Should get header from headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); - it("Should get header from Headers instance", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ - version: "version", - [key]: value, - }), - }; - const headerValue: string = getRequestHeader(url, options, key); - assert.equal(headerValue, value); - }); +// it("Should get header from Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ +// version: "version", +// [key]: value, +// }), +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); - it("Should get header from array of headers", () => { - const options: FetchOptions = { - method: "test", - headers: [["version", "version"], [key, value]], - }; - const headerValue: string = getRequestHeader(url, options, key); - assert.equal(headerValue, value); - }); - }); +// it("Should get header from array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"], [key, value]], +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); +// }); - describe("setRequestHeader", () => { - const key: string = "Content-Type"; - const value: string = "application/json"; - const url = "dummy_url"; - it("Should set header in request object", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - }, - }); - setRequestHeader(request, undefined, key, value); - assert.equal(request.headers.get(key), value); - }); +// describe("setRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const url = "dummy_url"; +// it("Should set header in request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// }, +// }); +// setRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); - it("Should replace header in request object if the header is already present", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }); - setRequestHeader(request, undefined, key, value); - assert.equal(request.headers.get(key), value); - }); +// it("Should replace header in request object if the header is already present", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// setRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); - it("Should set header for empty headers", () => { - const options: FetchOptions = { - method: "test", - }; - setRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as Headers).get(key), value); - }); +// it("Should set header for empty headers", () => { +// const options: FetchOptions = { +// method: "test", +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); - it("Should set header in headers object", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - }, - }; - setRequestHeader(url, options, key, value); - assert.equal(options.headers[key], value); - }); +// it("Should set header in headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// }, +// }; +// setRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); - it("Should replace header in headers object if header is already present", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }; - setRequestHeader(url, options, key, value); - assert.equal(options.headers[key], value); - }); +// it("Should replace header in headers object if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// setRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); - it("Should set header in Headers instance", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ version: "version" }), - }; - setRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as Headers).get(key), value); - }); +// it("Should set header in Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version" }), +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); - it("Should replace header in Headers instance if header is already present", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ version: "version", [key]: value }), - }; - setRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as Headers).get(key), value); - }); +// it("Should replace header in Headers instance if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: value }), +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); - it("Should set header in array of headers", () => { - const options: FetchOptions = { - method: "test", - headers: [["version", "version"]], - }; - setRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal(options.headers[1][1], value); - }); +// it("Should set header in array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"]], +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal(options.headers[1][1], value); +// }); - it("Should replace header in array of headers if header is already present", () => { - const options: FetchOptions = { - method: "test", - headers: [[key, "dummy/type"]], - }; - setRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as string[][]).length, 1); - assert.equal(options.headers[0][0], key); - assert.equal(options.headers[0][1], value); - }); - }); +// it("Should replace header in array of headers if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, "dummy/type"]], +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 1); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], value); +// }); +// }); - describe("appendRequestHeader", () => { - const key: string = "Content-Type"; - const value: string = "application/json"; - const firstValue: string = "text/html"; - const url = "dummy_url"; - it("Should set header in request object if the header is not present", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - }, - }); - appendRequestHeader(request, undefined, key, value); - assert.equal(request.headers.get(key), value); - }); +// describe("appendRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const firstValue: string = "text/html"; +// const url = "dummy_url"; +// it("Should set header in request object if the header is not present", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); - it("Should append header in request object", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - [key]: firstValue, - }, - }); - appendRequestHeader(request, undefined, key, value); - const values = (request.headers as NFHeaders).getAll(key); - assert.equal(values[0], firstValue); - assert.equal(values[1], value); - }); +// it("Should append header in request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: firstValue, +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// const values = (request.headers as NFHeaders).getAll(key); +// assert.equal(values[0], firstValue); +// assert.equal(values[1], value); +// }); - it("Should append header in request object even if the value is duplicate", () => { - const request: Request = new Request(url, { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }); - appendRequestHeader(request, undefined, key, value); - const values = (request.headers as NFHeaders).getAll(key); - assert.equal(values[0], value); - assert.equal(values[1], value); - }); +// it("Should append header in request object even if the value is duplicate", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// const values = (request.headers as NFHeaders).getAll(key); +// assert.equal(values[0], value); +// assert.equal(values[1], value); +// }); - it("Should set header for empty headers", () => { - const options: FetchOptions = { - method: "test", - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as NFHeaders).get(key), value); - }); +// it("Should set header for empty headers", () => { +// const options: FetchOptions = { +// method: "test", +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as NFHeaders).get(key), value); +// }); - it("Should set header in headers object if header is not present", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - }, - }; - appendRequestHeader(url, options, key, value); - assert.equal(options.headers[key], value); - }); +// it("Should set header in headers object if header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); - it("Should append header in headers object", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - [key]: firstValue, - }, - }; - appendRequestHeader(url, options, key, value); - assert.equal(options.headers[key], `${firstValue}, ${value}`); - }); +// it("Should append header in headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: firstValue, +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], `${firstValue}, ${value}`); +// }); - it("Should append header in headers object even if the value is duplicate", () => { - const options: FetchOptions = { - method: "test", - headers: { - version: "version", - [key]: value, - }, - }; - appendRequestHeader(url, options, key, value); - assert.equal(options.headers[key], `${value}, ${value}`); - }); +// it("Should append header in headers object even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], `${value}, ${value}`); +// }); - it("Should set header in Headers instance if header is not present", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ version: "version" }), - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as Headers).get(key), value); - }); +// it("Should set header in Headers instance if header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version" }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); - it("Should append header in Headers instance", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ version: "version", [key]: firstValue }), - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - const values = (options.headers as NFHeaders).getAll(key); - assert.equal(values[0], firstValue); - assert.equal(values[1], value); - }); +// it("Should append header in Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: firstValue }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// const values = (options.headers as NFHeaders).getAll(key); +// assert.equal(values[0], firstValue); +// assert.equal(values[1], value); +// }); - it("Should append header in Headers instance even if the value is duplicate", () => { - const options: FetchOptions = { - method: "test", - headers: new Headers({ version: "version", [key]: value }), - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - const values = (options.headers as NFHeaders).getAll(key); - assert.equal(values[0], value); - assert.equal(values[1], value); - }); +// it("Should append header in Headers instance even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: value }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// const values = (options.headers as NFHeaders).getAll(key); +// assert.equal(values[0], value); +// assert.equal(values[1], value); +// }); - it("Should set header in array of headers if the header is not present", () => { - const options: FetchOptions = { - method: "test", - headers: [["version", "version"]], - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal(options.headers[1][1], value); - }); +// it("Should set header in array of headers if the header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal(options.headers[1][1], value); +// }); - it("Should append header in array of headers", () => { - const options: FetchOptions = { - method: "test", - headers: [[key, firstValue]], - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as string[][]).length, 2); - assert.equal(options.headers[0][0], key); - assert.equal(options.headers[0][1], firstValue); - assert.equal(options.headers[1][0], key); - assert.equal(options.headers[1][1], value); - }); +// it("Should append header in array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, firstValue]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 2); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], firstValue); +// assert.equal(options.headers[1][0], key); +// assert.equal(options.headers[1][1], value); +// }); - it("Should append header in array of headers even if the value is duplicate", () => { - const options: FetchOptions = { - method: "test", - headers: [[key, value]], - }; - appendRequestHeader(url, options, key, value); - assert.isDefined(options.headers); - assert.equal((options.headers as string[][]).length, 2); - assert.equal(options.headers[0][0], key); - assert.equal(options.headers[0][1], value); - assert.equal(options.headers[1][0], key); - assert.equal(options.headers[1][1], value); - }); - }); +// it("Should append header in array of headers even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, value]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 2); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], value); +// assert.equal(options.headers[1][0], key); +// assert.equal(options.headers[1][1], value); +// }); +// }); - describe("generateUUID", () => { - it("Should return the unique uuid", () => { - const uuid = generateUUID(); - assert.equal(uuid.length, 36); - }); - }); -}); +// describe("generateUUID", () => { +// it("Should return the unique uuid", () => { +// const uuid = generateUUID(); +// assert.equal(uuid.length, 36); +// }); +// }); +// }); diff --git a/spec/development/HardCodedAuthenticationProvider.ts b/spec2/development/HardCodedAuthenticationProvider.ts similarity index 100% rename from spec/development/HardCodedAuthenticationProvider.ts rename to spec2/development/HardCodedAuthenticationProvider.ts diff --git a/spec/development/secrets.sample.ts b/spec2/development/secrets.sample.ts similarity index 100% rename from spec/development/secrets.sample.ts rename to spec2/development/secrets.sample.ts diff --git a/spec2/development/secrets.ts b/spec2/development/secrets.ts new file mode 100644 index 000000000..304c647cd --- /dev/null +++ b/spec2/development/secrets.ts @@ -0,0 +1,7 @@ +/** + * @file + * Defines access token exporting structure + * + * To use authentication based(making real requests to the graph service) testing populate this access token's value and rename this file as secrets.ts + */ +export const AccessToken = ""; diff --git a/spec/development/test-helper.ts b/spec2/development/test-helper.ts similarity index 100% rename from spec/development/test-helper.ts rename to spec2/development/test-helper.ts diff --git a/spec/development/workload/OneNote.ts b/spec2/development/workload/OneNote.ts similarity index 100% rename from spec/development/workload/OneNote.ts rename to spec2/development/workload/OneNote.ts diff --git a/spec/development/workload/PageIterator.ts b/spec2/development/workload/PageIterator.ts similarity index 100% rename from spec/development/workload/PageIterator.ts rename to spec2/development/workload/PageIterator.ts diff --git a/spec/development/workload/delta-query.ts b/spec2/development/workload/delta-query.ts similarity index 100% rename from spec/development/workload/delta-query.ts rename to spec2/development/workload/delta-query.ts diff --git a/spec/development/workload/excel.ts b/spec2/development/workload/excel.ts similarity index 100% rename from spec/development/workload/excel.ts rename to spec2/development/workload/excel.ts diff --git a/spec/development/workload/groups.ts b/spec2/development/workload/groups.ts similarity index 100% rename from spec/development/workload/groups.ts rename to spec2/development/workload/groups.ts diff --git a/spec/development/workload/insights.ts b/spec2/development/workload/insights.ts similarity index 100% rename from spec/development/workload/insights.ts rename to spec2/development/workload/insights.ts diff --git a/spec/development/workload/open-extensions.ts b/spec2/development/workload/open-extensions.ts similarity index 100% rename from spec/development/workload/open-extensions.ts rename to spec2/development/workload/open-extensions.ts diff --git a/spec/development/workload/users.ts b/spec2/development/workload/users.ts similarity index 100% rename from spec/development/workload/users.ts rename to spec2/development/workload/users.ts diff --git a/src/TestInclusion.ts b/src/TestInclusion.ts new file mode 100644 index 000000000..ef3b82997 --- /dev/null +++ b/src/TestInclusion.ts @@ -0,0 +1,17 @@ +import { FetchOptions } from "./IFetchOptions"; +import { MiddlewareControl } from "./middleware/MiddlewareControl"; + +/** + * @interface + * @property {RequestInfo} request - The request url string or the Request instance + * @property {FetchOptions} [options] - The options for the request + * @property {Response} [response] - The response content + * @property {MiddlewareControl} [middlewareControl] - The options for the middleware chain + */ + +export interface TestInclusion { + request: RequestInfo; + options?: FetchOptions; + response?: Response; + middlewareControl?: MiddlewareControl; +} diff --git a/src/browser/TestAll.ts b/src/browser/TestAll.ts new file mode 100644 index 000000000..8fd93e6ca --- /dev/null +++ b/src/browser/TestAll.ts @@ -0,0 +1 @@ +class TestAll {} diff --git a/tsconfig-es.json b/tsconfig-es.json index 1a763aefb..9cdbc0114 100644 --- a/tsconfig-es.json +++ b/tsconfig-es.json @@ -6,6 +6,6 @@ "lib": ["dom", "esnext"], "outDir": "lib/es" }, - "exclude": ["node_modules", "lib", "samples", "spec/**"], + "exclude": ["node_modules", "lib", "samples", "spec/development"], "include": ["./src/**/*.ts"] } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..8933d0153 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig-base.json", + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["dom", "esnext"], + "outDir": "lib/es" + }, + "exclude": ["node_modules", "lib", "samples", "spec/development"], + "include": ["./src/**/*.ts", "./spec/**/*.ts"] +} From 6330bfbfb6fba0cf2c8c67e821becaf28ce0333c Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Fri, 25 Dec 2020 16:29:24 -0800 Subject: [PATCH 03/10] adding headless browser --- .huskyrc | 2 +- karma.conf.js | 8 +- package-lock.json | 289 +++++++ package.json | 20 +- spec/tsconfig.json | 16 - {spec => test}/DummyAuthenticationProvider.ts | 0 .../browser}/core/GraphResponseHandler.ts | 4 +- test/common/DummyAuthenticationProvider.ts | 30 + .../common}/DummyHTTPMessageHandler.ts | 4 +- {spec => test/common}/DummyHandlerOptions.ts | 2 +- .../common}/content/BatchRequestContent.ts | 2 +- .../common}/content/BatchResponseContent.ts | 2 +- {spec => test/common}/core/Client.ts | 18 +- .../common}/core/GraphErrorHandler.ts | 2 +- .../common}/core/GraphRequestUtil.ts | 2 +- test/common/core/GraphResponseHandler.ts | 162 ++++ {spec => test/common}/core/HTTPClient.ts | 6 +- .../common}/core/HTTPClientFactory.ts | 4 +- {spec => test/common}/core/Range.ts | 2 +- {spec => test/common}/core/urlGeneration.ts | 0 {spec => test/common}/core/urlParsing.ts | 0 .../middleware/AuthenticationHandler.ts | 2 +- .../AuthenticationHandlerOptions.ts | 4 +- .../common}/middleware/ChaosHandler.ts | 12 +- .../MSALAuthenticationProviderOptions.ts | 2 +- .../common}/middleware/MiddlewareControl.ts | 2 +- .../common}/middleware/MiddlewareFactory.ts | 6 +- .../common}/middleware/MiddlewareUtil.ts | 0 .../common}/middleware/RedirectHandler.ts | 8 +- .../middleware/RedirectHandlerOptions.ts | 2 +- .../common}/middleware/RetryHandler.ts | 10 +- .../common}/middleware/RetryHandlerOptions.ts | 2 +- .../common}/middleware/TelemetryHandler.ts | 10 +- .../middleware/TelemetryHandlerOptions.ts | 6 +- {spec => test/common}/package-lock.json | 0 {spec => test/common}/package.json | 0 .../common}/tasks/LargeFileUploadTask.ts | 2 +- .../tasks/OneDriveLargeFileUploadTask.ts | 2 +- .../tasks/OneDriveLargeFileUploadTaskUtil.ts | 2 +- {spec => test/common}/tasks/PageIterator.ts | 4 +- test/common/test-helper.ts | 24 + .../HardCodedAuthenticationProvider.ts | 0 {spec2 => test}/development/secrets.sample.ts | 0 {spec2 => test}/development/secrets.ts | 0 {spec2 => test}/development/test-helper.ts | 0 .../development/workload/OneNote.ts | 0 .../development/workload/PageIterator.ts | 0 .../development/workload/delta-query.ts | 0 {spec2 => test}/development/workload/excel.ts | 0 .../development/workload/groups.ts | 0 .../development/workload/insights.ts | 0 .../development/workload/open-extensions.ts | 0 {spec2 => test}/development/workload/users.ts | 0 test/dist/es/src/Client.d.ts | 51 ++ test/dist/es/src/Client.js | 101 +++ test/dist/es/src/Client.js.map | 1 + test/dist/es/src/Constants.d.ts | 19 + test/dist/es/src/Constants.js | 20 + test/dist/es/src/Constants.js.map | 1 + .../es/src/CustomAuthenticationProvider.d.ts | 38 + .../es/src/CustomAuthenticationProvider.js | 44 ++ .../src/CustomAuthenticationProvider.js.map | 1 + test/dist/es/src/GraphError.d.ts | 51 ++ test/dist/es/src/GraphError.js | 35 + test/dist/es/src/GraphError.js.map | 1 + test/dist/es/src/GraphErrorHandler.d.ts | 59 ++ test/dist/es/src/GraphErrorHandler.js | 98 +++ test/dist/es/src/GraphErrorHandler.js.map | 1 + test/dist/es/src/GraphRequest.d.ts | 378 +++++++++ test/dist/es/src/GraphRequest.js | 716 ++++++++++++++++++ test/dist/es/src/GraphRequest.js.map | 1 + test/dist/es/src/GraphRequestUtil.d.ts | 32 + test/dist/es/src/GraphRequestUtil.js | 56 ++ test/dist/es/src/GraphRequestUtil.js.map | 1 + test/dist/es/src/GraphResponseHandler.d.ts | 61 ++ test/dist/es/src/GraphResponseHandler.js | 188 +++++ test/dist/es/src/GraphResponseHandler.js.map | 1 + test/dist/es/src/HTTPClient.d.ts | 54 ++ test/dist/es/src/HTTPClient.js | 82 ++ test/dist/es/src/HTTPClient.js.map | 1 + test/dist/es/src/HTTPClientFactory.d.ts | 40 + test/dist/es/src/HTTPClientFactory.js | 72 ++ test/dist/es/src/HTTPClientFactory.js.map | 1 + test/dist/es/src/IAuthProvider.d.ts | 13 + test/dist/es/src/IAuthProvider.js | 7 + test/dist/es/src/IAuthProvider.js.map | 1 + test/dist/es/src/IAuthProviderCallback.d.ts | 12 + test/dist/es/src/IAuthProviderCallback.js | 7 + test/dist/es/src/IAuthProviderCallback.js.map | 1 + test/dist/es/src/IAuthenticationProvider.d.ts | 20 + test/dist/es/src/IAuthenticationProvider.js | 7 + .../es/src/IAuthenticationProvider.js.map | 1 + .../src/IAuthenticationProviderOptions.d.ts | 14 + .../es/src/IAuthenticationProviderOptions.js | 7 + .../src/IAuthenticationProviderOptions.js.map | 1 + test/dist/es/src/IClientOptions.d.ts | 27 + test/dist/es/src/IClientOptions.js | 7 + test/dist/es/src/IClientOptions.js.map | 1 + test/dist/es/src/IContext.d.ts | 21 + test/dist/es/src/IContext.js | 7 + test/dist/es/src/IContext.js.map | 1 + test/dist/es/src/IFetchOptions.d.ts | 29 + test/dist/es/src/IFetchOptions.js | 7 + test/dist/es/src/IFetchOptions.js.map | 1 + test/dist/es/src/IGraphRequestCallback.d.ts | 13 + test/dist/es/src/IGraphRequestCallback.js | 7 + test/dist/es/src/IGraphRequestCallback.js.map | 1 + test/dist/es/src/IOptions.d.ts | 24 + test/dist/es/src/IOptions.js | 7 + test/dist/es/src/IOptions.js.map | 1 + .../ImplicitMSALAuthenticationProvider.d.ts | 47 ++ .../src/ImplicitMSALAuthenticationProvider.js | 87 +++ .../ImplicitMSALAuthenticationProvider.js.map | 1 + .../MSALAuthenticationProviderOptions.d.ts | 30 + .../src/MSALAuthenticationProviderOptions.js | 24 + .../MSALAuthenticationProviderOptions.js.map | 1 + test/dist/es/src/Range.d.ts | 34 + test/dist/es/src/Range.js | 28 + test/dist/es/src/Range.js.map | 1 + test/dist/es/src/RequestMethod.d.ts | 22 + test/dist/es/src/RequestMethod.js | 24 + test/dist/es/src/RequestMethod.js.map | 1 + test/dist/es/src/ResponseType.d.ts | 25 + test/dist/es/src/ResponseType.js | 27 + test/dist/es/src/ResponseType.js.map | 1 + test/dist/es/src/ValidatePolyFilling.d.ts | 13 + test/dist/es/src/ValidatePolyFilling.js | 29 + test/dist/es/src/ValidatePolyFilling.js.map | 1 + test/dist/es/src/Version.d.ts | 10 + test/dist/es/src/Version.js | 13 + test/dist/es/src/Version.js.map | 1 + .../es/src/content/BatchRequestContent.d.ts | 144 ++++ .../es/src/content/BatchRequestContent.js | 410 ++++++++++ .../es/src/content/BatchRequestContent.js.map | 1 + .../es/src/content/BatchResponseContent.d.ts | 82 ++ .../es/src/content/BatchResponseContent.js | 89 +++ .../src/content/BatchResponseContent.js.map | 1 + test/dist/es/src/index.d.ts | 42 + test/dist/es/src/index.js | 32 + test/dist/es/src/index.js.map | 1 + .../src/middleware/AuthenticationHandler.d.ts | 56 ++ .../src/middleware/AuthenticationHandler.js | 75 ++ .../middleware/AuthenticationHandler.js.map | 1 + test/dist/es/src/middleware/ChaosHandler.d.ts | 125 +++ test/dist/es/src/middleware/ChaosHandler.js | 246 ++++++ .../es/src/middleware/ChaosHandler.js.map | 1 + .../es/src/middleware/HTTPMessageHandler.d.ts | 26 + .../es/src/middleware/HTTPMessageHandler.js | 32 + .../src/middleware/HTTPMessageHandler.js.map | 1 + test/dist/es/src/middleware/IMiddleware.d.ts | 16 + test/dist/es/src/middleware/IMiddleware.js | 7 + .../dist/es/src/middleware/IMiddleware.js.map | 1 + .../es/src/middleware/MiddlewareControl.d.ts | 48 ++ .../es/src/middleware/MiddlewareControl.js | 53 ++ .../src/middleware/MiddlewareControl.js.map | 1 + .../es/src/middleware/MiddlewareFactory.d.ts | 25 + .../es/src/middleware/MiddlewareFactory.js | 51 ++ .../src/middleware/MiddlewareFactory.js.map | 1 + .../es/src/middleware/MiddlewareUtil.d.ts | 53 ++ test/dist/es/src/middleware/MiddlewareUtil.js | 136 ++++ .../es/src/middleware/MiddlewareUtil.js.map | 1 + .../es/src/middleware/RedirectHandler.d.ts | 145 ++++ .../dist/es/src/middleware/RedirectHandler.js | 211 ++++++ .../es/src/middleware/RedirectHandler.js.map | 1 + test/dist/es/src/middleware/RetryHandler.d.ts | 121 +++ test/dist/es/src/middleware/RetryHandler.js | 189 +++++ .../es/src/middleware/RetryHandler.js.map | 1 + .../es/src/middleware/TelemetryHandler.d.ts | 62 ++ .../es/src/middleware/TelemetryHandler.js | 83 ++ .../es/src/middleware/TelemetryHandler.js.map | 1 + .../options/AuthenticationHandlerOptions.d.ts | 38 + .../options/AuthenticationHandlerOptions.js | 26 + .../AuthenticationHandlerOptions.js.map | 1 + .../middleware/options/ChaosHandlerData.d.ts | 21 + .../middleware/options/ChaosHandlerData.js | 86 +++ .../options/ChaosHandlerData.js.map | 1 + .../options/ChaosHandlerOptions.d.ts | 62 ++ .../middleware/options/ChaosHandlerOptions.js | 40 + .../options/ChaosHandlerOptions.js.map | 1 + .../src/middleware/options/ChaosStrategy.d.ts | 17 + .../src/middleware/options/ChaosStrategy.js | 19 + .../middleware/options/ChaosStrategy.js.map | 1 + .../options/IMiddlewareOptions.d.ts | 11 + .../middleware/options/IMiddlewareOptions.js | 7 + .../options/IMiddlewareOptions.js.map | 1 + .../options/RedirectHandlerOptions.d.ts | 58 ++ .../options/RedirectHandlerOptions.js | 53 ++ .../options/RedirectHandlerOptions.js.map | 1 + .../options/RetryHandlerOptions.d.ts | 83 ++ .../middleware/options/RetryHandlerOptions.js | 90 +++ .../options/RetryHandlerOptions.js.map | 1 + .../options/TelemetryHandlerOptions.d.ts | 58 ++ .../options/TelemetryHandlerOptions.js | 76 ++ .../options/TelemetryHandlerOptions.js.map | 1 + .../es/src/tasks/LargeFileUploadTask.d.ts | 172 +++++ test/dist/es/src/tasks/LargeFileUploadTask.js | 223 ++++++ .../es/src/tasks/LargeFileUploadTask.js.map | 1 + .../tasks/OneDriveLargeFileUploadTask.d.ts | 86 +++ .../src/tasks/OneDriveLargeFileUploadTask.js | 153 ++++ .../tasks/OneDriveLargeFileUploadTask.js.map | 1 + .../OneDriveLargeFileUploadTaskUtil.d.ts | 15 + .../tasks/OneDriveLargeFileUploadTaskUtil.js | 43 ++ .../OneDriveLargeFileUploadTaskUtil.js.map | 1 + test/dist/es/src/tasks/PageIterator.d.ts | 134 ++++ test/dist/es/src/tasks/PageIterator.js | 138 ++++ test/dist/es/src/tasks/PageIterator.js.map | 1 + .../es/test/DummyAuthenticationProvider.d.ts | 24 + .../es/test/DummyAuthenticationProvider.js | 27 + .../test/DummyAuthenticationProvider.js.map | 1 + .../common/DummyAuthenticationProvider.d.ts | 24 + .../common/DummyAuthenticationProvider.js | 27 + .../common/DummyAuthenticationProvider.js.map | 1 + .../test/common/DummyHTTPMessageHandler.d.ts | 46 ++ .../es/test/common/DummyHTTPMessageHandler.js | 47 ++ .../common/DummyHTTPMessageHandler.js.map | 1 + .../es/test/common/DummyHandlerOptions.d.ts | 30 + .../es/test/common/DummyHandlerOptions.js | 24 + .../es/test/common/DummyHandlerOptions.js.map | 1 + .../common/content/BatchRequestContent.d.ts | 7 + .../common/content/BatchRequestContent.js | 601 +++++++++++++++ .../common/content/BatchRequestContent.js.map | 1 + .../common/content/BatchResponseContent.d.ts | 7 + .../common/content/BatchResponseContent.js | 114 +++ .../content/BatchResponseContent.js.map | 1 + test/dist/es/test/common/core/Client.d.ts | 7 + test/dist/es/test/common/core/Client.js | 105 +++ test/dist/es/test/common/core/Client.js.map | 1 + .../test/common/core/GraphErrorHandler.d.ts | 7 + .../es/test/common/core/GraphErrorHandler.js | 102 +++ .../test/common/core/GraphErrorHandler.js.map | 1 + .../es/test/common/core/GraphRequestUtil.d.ts | 7 + .../es/test/common/core/GraphRequestUtil.js | 69 ++ .../test/common/core/GraphRequestUtil.js.map | 1 + .../common/core/GraphResponseHandler.d.ts | 7 + .../test/common/core/GraphResponseHandler.js | 162 ++++ .../common/core/GraphResponseHandler.js.map | 1 + test/dist/es/test/common/core/HTTPClient.d.ts | 7 + test/dist/es/test/common/core/HTTPClient.js | 95 +++ .../es/test/common/core/HTTPClient.js.map | 1 + .../test/common/core/HTTPClientFactory.d.ts | 7 + .../es/test/common/core/HTTPClientFactory.js | 30 + .../test/common/core/HTTPClientFactory.js.map | 1 + test/dist/es/test/common/core/Range.d.ts | 7 + test/dist/es/test/common/core/Range.js | 32 + test/dist/es/test/common/core/Range.js.map | 1 + .../es/test/common/core/urlGeneration.d.ts | 7 + .../dist/es/test/common/core/urlGeneration.js | 146 ++++ .../es/test/common/core/urlGeneration.js.map | 1 + test/dist/es/test/common/core/urlParsing.d.ts | 7 + test/dist/es/test/common/core/urlParsing.js | 54 ++ .../es/test/common/core/urlParsing.js.map | 1 + .../middleware/AuthenticationHandler.d.ts | 7 + .../middleware/AuthenticationHandler.js | 24 + .../middleware/AuthenticationHandler.js.map | 1 + .../AuthenticationHandlerOptions.d.ts | 7 + .../AuthenticationHandlerOptions.js | 25 + .../AuthenticationHandlerOptions.js.map | 1 + .../test/common/middleware/ChaosHandler.d.ts | 1 + .../es/test/common/middleware/ChaosHandler.js | 225 ++++++ .../common/middleware/ChaosHandler.js.map | 1 + .../MSALAuthenticationProviderOptions.d.ts | 7 + .../MSALAuthenticationProviderOptions.js | 17 + .../MSALAuthenticationProviderOptions.js.map | 1 + .../common/middleware/MiddlewareControl.d.ts | 7 + .../common/middleware/MiddlewareControl.js | 44 ++ .../middleware/MiddlewareControl.js.map | 1 + .../common/middleware/MiddlewareFactory.d.ts | 7 + .../common/middleware/MiddlewareFactory.js | 23 + .../middleware/MiddlewareFactory.js.map | 1 + .../common/middleware/MiddlewareUtil.d.ts | 0 .../test/common/middleware/MiddlewareUtil.js | 306 ++++++++ .../common/middleware/MiddlewareUtil.js.map | 1 + .../common/middleware/RedirectHandler.d.ts | 7 + .../test/common/middleware/RedirectHandler.js | 323 ++++++++ .../common/middleware/RedirectHandler.js.map | 1 + .../middleware/RedirectHandlerOptions.d.ts | 7 + .../middleware/RedirectHandlerOptions.js | 48 ++ .../middleware/RedirectHandlerOptions.js.map | 1 + .../test/common/middleware/RetryHandler.d.ts | 7 + .../es/test/common/middleware/RetryHandler.js | 221 ++++++ .../common/middleware/RetryHandler.js.map | 1 + .../middleware/RetryHandlerOptions.d.ts | 7 + .../common/middleware/RetryHandlerOptions.js | 94 +++ .../middleware/RetryHandlerOptions.js.map | 1 + .../common/middleware/TelemetryHandler.d.ts | 7 + .../common/middleware/TelemetryHandler.js | 104 +++ .../common/middleware/TelemetryHandler.js.map | 1 + .../middleware/TelemetryHandlerOptions.d.ts | 7 + .../middleware/TelemetryHandlerOptions.js | 67 ++ .../middleware/TelemetryHandlerOptions.js.map | 1 + .../common/tasks/LargeFileUploadTask.d.ts | 7 + .../test/common/tasks/LargeFileUploadTask.js | 171 +++++ .../common/tasks/LargeFileUploadTask.js.map | 1 + .../tasks/OneDriveLargeFileUploadTask.d.ts | 7 + .../tasks/OneDriveLargeFileUploadTask.js | 40 + .../tasks/OneDriveLargeFileUploadTask.js.map | 1 + .../OneDriveLargeFileUploadTaskUtil.d.ts | 7 + .../tasks/OneDriveLargeFileUploadTaskUtil.js | 29 + .../OneDriveLargeFileUploadTaskUtil.js.map | 1 + .../es/test/common/tasks/PageIterator.d.ts | 7 + .../dist/es/test/common/tasks/PageIterator.js | 146 ++++ .../es/test/common/tasks/PageIterator.js.map | 1 + test/dist/es/test/common/test-helper.d.ts | 10 + test/dist/es/test/common/test-helper.js | 20 + test/dist/es/test/common/test-helper.js.map | 1 + .../node/content/BatchRequestContent.d.ts | 7 + .../test/node/content/BatchRequestContent.js | 601 +++++++++++++++ .../node/content/BatchRequestContent.js.map | 1 + .../node/content/BatchResponseContent.d.ts | 7 + .../test/node/content/BatchResponseContent.js | 114 +++ .../node/content/BatchResponseContent.js.map | 1 + test/dist/es/test/test-helper.d.ts | 10 + test/dist/es/test/test-helper.js | 20 + test/dist/es/test/test-helper.js.map | 1 + test/node/content/BatchRequestContent.ts | 650 ++++++++++++++++ test/node/content/BatchResponseContent.ts | 127 ++++ .../sample_files/empty-spreadsheet.xlsx | Bin {spec => test}/sample_files/onenotepage.html | 0 .../onenotepage_fileattachment.html | 0 {spec => test}/sample_files/sample_image.jpg | Bin {spec => test}/test-helper.ts | 0 test/tsconfig-test-cjs.json | 11 + test/tsconfig-test-es.json | 10 + tsconfig-cjs.json | 4 +- tsconfig-es.json | 4 +- tsconfig.json | 11 - 326 files changed, 13225 insertions(+), 104 deletions(-) delete mode 100644 spec/tsconfig.json rename {spec => test}/DummyAuthenticationProvider.ts (100%) rename {spec => test/browser}/core/GraphResponseHandler.ts (97%) create mode 100644 test/common/DummyAuthenticationProvider.ts rename {spec => test/common}/DummyHTTPMessageHandler.ts (93%) rename {spec => test/common}/DummyHandlerOptions.ts (91%) rename {spec => test/common}/content/BatchRequestContent.ts (99%) rename {spec => test/common}/content/BatchResponseContent.ts (97%) rename {spec => test/common}/core/Client.ts (88%) rename {spec => test/common}/core/GraphErrorHandler.ts (98%) rename {spec => test/common}/core/GraphRequestUtil.ts (96%) create mode 100644 test/common/core/GraphResponseHandler.ts rename {spec => test/common}/core/HTTPClient.ts (94%) rename {spec => test/common}/core/HTTPClientFactory.ts (91%) rename {spec => test/common}/core/Range.ts (96%) rename {spec => test/common}/core/urlGeneration.ts (100%) rename {spec => test/common}/core/urlParsing.ts (100%) rename {spec => test/common}/middleware/AuthenticationHandler.ts (91%) rename {spec => test/common}/middleware/AuthenticationHandlerOptions.ts (85%) rename {spec => test/common}/middleware/ChaosHandler.ts (95%) rename {spec => test/common}/middleware/MSALAuthenticationProviderOptions.ts (87%) rename {spec => test/common}/middleware/MiddlewareControl.ts (96%) rename {spec => test/common}/middleware/MiddlewareFactory.ts (87%) rename {spec => test/common}/middleware/MiddlewareUtil.ts (100%) rename {spec => test/common}/middleware/RedirectHandler.ts (97%) rename {spec => test/common}/middleware/RedirectHandlerOptions.ts (95%) rename {spec => test/common}/middleware/RetryHandler.ts (95%) rename {spec => test/common}/middleware/RetryHandlerOptions.ts (97%) rename {spec => test/common}/middleware/TelemetryHandler.ts (90%) rename {spec => test/common}/middleware/TelemetryHandlerOptions.ts (95%) rename {spec => test/common}/package-lock.json (100%) rename {spec => test/common}/package.json (100%) rename {spec => test/common}/tasks/LargeFileUploadTask.ts (98%) rename {spec => test/common}/tasks/OneDriveLargeFileUploadTask.ts (95%) rename {spec => test/common}/tasks/OneDriveLargeFileUploadTaskUtil.ts (92%) rename {spec => test/common}/tasks/PageIterator.ts (97%) create mode 100644 test/common/test-helper.ts rename {spec2 => test}/development/HardCodedAuthenticationProvider.ts (100%) rename {spec2 => test}/development/secrets.sample.ts (100%) rename {spec2 => test}/development/secrets.ts (100%) rename {spec2 => test}/development/test-helper.ts (100%) rename {spec2 => test}/development/workload/OneNote.ts (100%) rename {spec2 => test}/development/workload/PageIterator.ts (100%) rename {spec2 => test}/development/workload/delta-query.ts (100%) rename {spec2 => test}/development/workload/excel.ts (100%) rename {spec2 => test}/development/workload/groups.ts (100%) rename {spec2 => test}/development/workload/insights.ts (100%) rename {spec2 => test}/development/workload/open-extensions.ts (100%) rename {spec2 => test}/development/workload/users.ts (100%) create mode 100644 test/dist/es/src/Client.d.ts create mode 100644 test/dist/es/src/Client.js create mode 100644 test/dist/es/src/Client.js.map create mode 100644 test/dist/es/src/Constants.d.ts create mode 100644 test/dist/es/src/Constants.js create mode 100644 test/dist/es/src/Constants.js.map create mode 100644 test/dist/es/src/CustomAuthenticationProvider.d.ts create mode 100644 test/dist/es/src/CustomAuthenticationProvider.js create mode 100644 test/dist/es/src/CustomAuthenticationProvider.js.map create mode 100644 test/dist/es/src/GraphError.d.ts create mode 100644 test/dist/es/src/GraphError.js create mode 100644 test/dist/es/src/GraphError.js.map create mode 100644 test/dist/es/src/GraphErrorHandler.d.ts create mode 100644 test/dist/es/src/GraphErrorHandler.js create mode 100644 test/dist/es/src/GraphErrorHandler.js.map create mode 100644 test/dist/es/src/GraphRequest.d.ts create mode 100644 test/dist/es/src/GraphRequest.js create mode 100644 test/dist/es/src/GraphRequest.js.map create mode 100644 test/dist/es/src/GraphRequestUtil.d.ts create mode 100644 test/dist/es/src/GraphRequestUtil.js create mode 100644 test/dist/es/src/GraphRequestUtil.js.map create mode 100644 test/dist/es/src/GraphResponseHandler.d.ts create mode 100644 test/dist/es/src/GraphResponseHandler.js create mode 100644 test/dist/es/src/GraphResponseHandler.js.map create mode 100644 test/dist/es/src/HTTPClient.d.ts create mode 100644 test/dist/es/src/HTTPClient.js create mode 100644 test/dist/es/src/HTTPClient.js.map create mode 100644 test/dist/es/src/HTTPClientFactory.d.ts create mode 100644 test/dist/es/src/HTTPClientFactory.js create mode 100644 test/dist/es/src/HTTPClientFactory.js.map create mode 100644 test/dist/es/src/IAuthProvider.d.ts create mode 100644 test/dist/es/src/IAuthProvider.js create mode 100644 test/dist/es/src/IAuthProvider.js.map create mode 100644 test/dist/es/src/IAuthProviderCallback.d.ts create mode 100644 test/dist/es/src/IAuthProviderCallback.js create mode 100644 test/dist/es/src/IAuthProviderCallback.js.map create mode 100644 test/dist/es/src/IAuthenticationProvider.d.ts create mode 100644 test/dist/es/src/IAuthenticationProvider.js create mode 100644 test/dist/es/src/IAuthenticationProvider.js.map create mode 100644 test/dist/es/src/IAuthenticationProviderOptions.d.ts create mode 100644 test/dist/es/src/IAuthenticationProviderOptions.js create mode 100644 test/dist/es/src/IAuthenticationProviderOptions.js.map create mode 100644 test/dist/es/src/IClientOptions.d.ts create mode 100644 test/dist/es/src/IClientOptions.js create mode 100644 test/dist/es/src/IClientOptions.js.map create mode 100644 test/dist/es/src/IContext.d.ts create mode 100644 test/dist/es/src/IContext.js create mode 100644 test/dist/es/src/IContext.js.map create mode 100644 test/dist/es/src/IFetchOptions.d.ts create mode 100644 test/dist/es/src/IFetchOptions.js create mode 100644 test/dist/es/src/IFetchOptions.js.map create mode 100644 test/dist/es/src/IGraphRequestCallback.d.ts create mode 100644 test/dist/es/src/IGraphRequestCallback.js create mode 100644 test/dist/es/src/IGraphRequestCallback.js.map create mode 100644 test/dist/es/src/IOptions.d.ts create mode 100644 test/dist/es/src/IOptions.js create mode 100644 test/dist/es/src/IOptions.js.map create mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts create mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.js create mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map create mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.d.ts create mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.js create mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.js.map create mode 100644 test/dist/es/src/Range.d.ts create mode 100644 test/dist/es/src/Range.js create mode 100644 test/dist/es/src/Range.js.map create mode 100644 test/dist/es/src/RequestMethod.d.ts create mode 100644 test/dist/es/src/RequestMethod.js create mode 100644 test/dist/es/src/RequestMethod.js.map create mode 100644 test/dist/es/src/ResponseType.d.ts create mode 100644 test/dist/es/src/ResponseType.js create mode 100644 test/dist/es/src/ResponseType.js.map create mode 100644 test/dist/es/src/ValidatePolyFilling.d.ts create mode 100644 test/dist/es/src/ValidatePolyFilling.js create mode 100644 test/dist/es/src/ValidatePolyFilling.js.map create mode 100644 test/dist/es/src/Version.d.ts create mode 100644 test/dist/es/src/Version.js create mode 100644 test/dist/es/src/Version.js.map create mode 100644 test/dist/es/src/content/BatchRequestContent.d.ts create mode 100644 test/dist/es/src/content/BatchRequestContent.js create mode 100644 test/dist/es/src/content/BatchRequestContent.js.map create mode 100644 test/dist/es/src/content/BatchResponseContent.d.ts create mode 100644 test/dist/es/src/content/BatchResponseContent.js create mode 100644 test/dist/es/src/content/BatchResponseContent.js.map create mode 100644 test/dist/es/src/index.d.ts create mode 100644 test/dist/es/src/index.js create mode 100644 test/dist/es/src/index.js.map create mode 100644 test/dist/es/src/middleware/AuthenticationHandler.d.ts create mode 100644 test/dist/es/src/middleware/AuthenticationHandler.js create mode 100644 test/dist/es/src/middleware/AuthenticationHandler.js.map create mode 100644 test/dist/es/src/middleware/ChaosHandler.d.ts create mode 100644 test/dist/es/src/middleware/ChaosHandler.js create mode 100644 test/dist/es/src/middleware/ChaosHandler.js.map create mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.d.ts create mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.js create mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.js.map create mode 100644 test/dist/es/src/middleware/IMiddleware.d.ts create mode 100644 test/dist/es/src/middleware/IMiddleware.js create mode 100644 test/dist/es/src/middleware/IMiddleware.js.map create mode 100644 test/dist/es/src/middleware/MiddlewareControl.d.ts create mode 100644 test/dist/es/src/middleware/MiddlewareControl.js create mode 100644 test/dist/es/src/middleware/MiddlewareControl.js.map create mode 100644 test/dist/es/src/middleware/MiddlewareFactory.d.ts create mode 100644 test/dist/es/src/middleware/MiddlewareFactory.js create mode 100644 test/dist/es/src/middleware/MiddlewareFactory.js.map create mode 100644 test/dist/es/src/middleware/MiddlewareUtil.d.ts create mode 100644 test/dist/es/src/middleware/MiddlewareUtil.js create mode 100644 test/dist/es/src/middleware/MiddlewareUtil.js.map create mode 100644 test/dist/es/src/middleware/RedirectHandler.d.ts create mode 100644 test/dist/es/src/middleware/RedirectHandler.js create mode 100644 test/dist/es/src/middleware/RedirectHandler.js.map create mode 100644 test/dist/es/src/middleware/RetryHandler.d.ts create mode 100644 test/dist/es/src/middleware/RetryHandler.js create mode 100644 test/dist/es/src/middleware/RetryHandler.js.map create mode 100644 test/dist/es/src/middleware/TelemetryHandler.d.ts create mode 100644 test/dist/es/src/middleware/TelemetryHandler.js create mode 100644 test/dist/es/src/middleware/TelemetryHandler.js.map create mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js create mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.d.ts create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.js create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.js.map create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.js create mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map create mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.d.ts create mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.js create mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.js.map create mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.js create mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.js.map create mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.js create mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map create mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.js create mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.js.map create mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts create mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.js create mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map create mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.d.ts create mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.js create mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.js.map create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js create mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map create mode 100644 test/dist/es/src/tasks/PageIterator.d.ts create mode 100644 test/dist/es/src/tasks/PageIterator.js create mode 100644 test/dist/es/src/tasks/PageIterator.js.map create mode 100644 test/dist/es/test/DummyAuthenticationProvider.d.ts create mode 100644 test/dist/es/test/DummyAuthenticationProvider.js create mode 100644 test/dist/es/test/DummyAuthenticationProvider.js.map create mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.d.ts create mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.js create mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.js.map create mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.d.ts create mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.js create mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.js.map create mode 100644 test/dist/es/test/common/DummyHandlerOptions.d.ts create mode 100644 test/dist/es/test/common/DummyHandlerOptions.js create mode 100644 test/dist/es/test/common/DummyHandlerOptions.js.map create mode 100644 test/dist/es/test/common/content/BatchRequestContent.d.ts create mode 100644 test/dist/es/test/common/content/BatchRequestContent.js create mode 100644 test/dist/es/test/common/content/BatchRequestContent.js.map create mode 100644 test/dist/es/test/common/content/BatchResponseContent.d.ts create mode 100644 test/dist/es/test/common/content/BatchResponseContent.js create mode 100644 test/dist/es/test/common/content/BatchResponseContent.js.map create mode 100644 test/dist/es/test/common/core/Client.d.ts create mode 100644 test/dist/es/test/common/core/Client.js create mode 100644 test/dist/es/test/common/core/Client.js.map create mode 100644 test/dist/es/test/common/core/GraphErrorHandler.d.ts create mode 100644 test/dist/es/test/common/core/GraphErrorHandler.js create mode 100644 test/dist/es/test/common/core/GraphErrorHandler.js.map create mode 100644 test/dist/es/test/common/core/GraphRequestUtil.d.ts create mode 100644 test/dist/es/test/common/core/GraphRequestUtil.js create mode 100644 test/dist/es/test/common/core/GraphRequestUtil.js.map create mode 100644 test/dist/es/test/common/core/GraphResponseHandler.d.ts create mode 100644 test/dist/es/test/common/core/GraphResponseHandler.js create mode 100644 test/dist/es/test/common/core/GraphResponseHandler.js.map create mode 100644 test/dist/es/test/common/core/HTTPClient.d.ts create mode 100644 test/dist/es/test/common/core/HTTPClient.js create mode 100644 test/dist/es/test/common/core/HTTPClient.js.map create mode 100644 test/dist/es/test/common/core/HTTPClientFactory.d.ts create mode 100644 test/dist/es/test/common/core/HTTPClientFactory.js create mode 100644 test/dist/es/test/common/core/HTTPClientFactory.js.map create mode 100644 test/dist/es/test/common/core/Range.d.ts create mode 100644 test/dist/es/test/common/core/Range.js create mode 100644 test/dist/es/test/common/core/Range.js.map create mode 100644 test/dist/es/test/common/core/urlGeneration.d.ts create mode 100644 test/dist/es/test/common/core/urlGeneration.js create mode 100644 test/dist/es/test/common/core/urlGeneration.js.map create mode 100644 test/dist/es/test/common/core/urlParsing.d.ts create mode 100644 test/dist/es/test/common/core/urlParsing.js create mode 100644 test/dist/es/test/common/core/urlParsing.js.map create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.d.ts create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.js create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.js.map create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js create mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map create mode 100644 test/dist/es/test/common/middleware/ChaosHandler.d.ts create mode 100644 test/dist/es/test/common/middleware/ChaosHandler.js create mode 100644 test/dist/es/test/common/middleware/ChaosHandler.js.map create mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts create mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js create mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map create mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.d.ts create mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.js create mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.js.map create mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.d.ts create mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.js create mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.js.map create mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.d.ts create mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.js create mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.js.map create mode 100644 test/dist/es/test/common/middleware/RedirectHandler.d.ts create mode 100644 test/dist/es/test/common/middleware/RedirectHandler.js create mode 100644 test/dist/es/test/common/middleware/RedirectHandler.js.map create mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts create mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.js create mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map create mode 100644 test/dist/es/test/common/middleware/RetryHandler.d.ts create mode 100644 test/dist/es/test/common/middleware/RetryHandler.js create mode 100644 test/dist/es/test/common/middleware/RetryHandler.js.map create mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts create mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.js create mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.js.map create mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.d.ts create mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.js create mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.js.map create mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts create mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.js create mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map create mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts create mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.js create mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.js.map create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js create mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map create mode 100644 test/dist/es/test/common/tasks/PageIterator.d.ts create mode 100644 test/dist/es/test/common/tasks/PageIterator.js create mode 100644 test/dist/es/test/common/tasks/PageIterator.js.map create mode 100644 test/dist/es/test/common/test-helper.d.ts create mode 100644 test/dist/es/test/common/test-helper.js create mode 100644 test/dist/es/test/common/test-helper.js.map create mode 100644 test/dist/es/test/node/content/BatchRequestContent.d.ts create mode 100644 test/dist/es/test/node/content/BatchRequestContent.js create mode 100644 test/dist/es/test/node/content/BatchRequestContent.js.map create mode 100644 test/dist/es/test/node/content/BatchResponseContent.d.ts create mode 100644 test/dist/es/test/node/content/BatchResponseContent.js create mode 100644 test/dist/es/test/node/content/BatchResponseContent.js.map create mode 100644 test/dist/es/test/test-helper.d.ts create mode 100644 test/dist/es/test/test-helper.js create mode 100644 test/dist/es/test/test-helper.js.map create mode 100644 test/node/content/BatchRequestContent.ts create mode 100644 test/node/content/BatchResponseContent.ts rename {spec => test}/sample_files/empty-spreadsheet.xlsx (100%) rename {spec => test}/sample_files/onenotepage.html (100%) rename {spec => test}/sample_files/onenotepage_fileattachment.html (100%) rename {spec => test}/sample_files/sample_image.jpg (100%) rename {spec => test}/test-helper.ts (100%) create mode 100644 test/tsconfig-test-cjs.json create mode 100644 test/tsconfig-test-es.json delete mode 100644 tsconfig.json diff --git a/.huskyrc b/.huskyrc index d8d81fd78..2cccd352d 100644 --- a/.huskyrc +++ b/.huskyrc @@ -1,5 +1,5 @@ { "hooks": { - "pre-commit": "npm run pre-build && git add src/Version.ts && lint-staged && npm run lint && npm run test" + "pre-commit": "npm run buid" } } diff --git a/karma.conf.js b/karma.conf.js index 88fc7dcd1..90bb7f1fa 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,13 +1,13 @@ -require("isomorphic-fetch"); module.exports = function(config) { config.set({ frameworks: ["mocha", "chai", "karma-typescript"], - files: ["spec/**/*.ts", "src/**/*.ts"], + files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts"], preprocessors: { - "**/*.ts": ["karma-typescript"], // *.tsx for React Jsx + "**/*.ts": ["karma-typescript"], }, karmaTypescriptConfig: { - tsconfig: "tsconfig.json", + tsconfig: "./test/tsconfig-es.json", }, + browsers: ["ChromeHeadless"], }); }; diff --git a/package-lock.json b/package-lock.json index ca4c378f3..4c88bd8dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -900,6 +900,16 @@ "@types/node": "*" } }, + "@types/yauzl": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", + "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", + "dev": true, + "optional": true, + "requires": { + "@types/node": "*" + } + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -926,6 +936,12 @@ "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1398,6 +1414,36 @@ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, + "bl": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", + "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "blob": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", @@ -1631,6 +1677,12 @@ "ieee754": "^1.1.13" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -1804,6 +1856,12 @@ } } }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -2464,6 +2522,12 @@ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", "dev": true }, + "devtools-protocol": { + "version": "0.0.818844", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.818844.tgz", + "integrity": "sha512-AD1hi7iVJ8OD0aMLQU5VK0XH9LDlA1+BcPIgrAxPfaibx2DbWucuyOhc4oyQCbnvDDO68nN6/LcKfqTP343Jjg==", + "dev": true + }, "di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", @@ -3018,6 +3082,29 @@ } } }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", @@ -3030,6 +3117,15 @@ "time-stamp": "^1.0.0" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -3281,6 +3377,12 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -4465,6 +4567,16 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, "husky": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/husky/-/husky-2.3.0.tgz", @@ -5788,6 +5900,15 @@ "integrity": "sha1-vuWtQEAFF4Ea40u5RfdikJEIt5o=", "dev": true }, + "karma-chrome-launcher": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz", + "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==", + "dev": true, + "requires": { + "which": "^1.2.1" + } + }, "karma-firefox-launcher": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.0.tgz", @@ -6498,6 +6619,12 @@ } } }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, "mocha": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", @@ -7420,6 +7547,12 @@ "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -7509,12 +7642,24 @@ "fromentries": "^1.2.0" } }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "property-expr": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-1.5.1.tgz", "integrity": "sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g==", "dev": true }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -7576,6 +7721,86 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "puppeteer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.5.0.tgz", + "integrity": "sha512-OM8ZvTXAhfgFA7wBIIGlPQzvyEETzDjeRa4mZRCRHxYL+GNH5WAuYUQdja3rpWZvkX/JKqmuVgbsxDNsDFjMEg==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "devtools-protocol": "0.0.818844", + "extract-zip": "^2.0.0", + "https-proxy-agent": "^4.0.0", + "node-fetch": "^2.6.1", + "pkg-dir": "^4.2.0", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^3.0.2", + "tar-fs": "^2.0.0", + "unbzip2-stream": "^1.3.3", + "ws": "^7.2.3" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "dev": true + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", @@ -8934,6 +9159,44 @@ "integrity": "sha512-xYavZtFC1vKgJu0AOSYdrLeikNCsNwmUeZaV1XF9cMqEhBVVxLq6rEbYzOGrF1MV2MNPkhsJqqiXuQ4a76CEUg==", "dev": true }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "tar-stream": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", + "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "terser": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/terser/-/terser-4.0.2.tgz", @@ -8964,6 +9227,12 @@ "minimatch": "^3.0.4" } }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -9253,6 +9522,16 @@ } } }, + "unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -9776,6 +10055,16 @@ "yargs": "^13.3.0" } }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", diff --git a/package.json b/package.json index 590f2c048..4967c954e 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "husky": "^2.2.0", "isomorphic-fetch": "^2.2.1", "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.0", "karma-mocha": "^2.0.1", "karma-typescript": "^5.2.0", @@ -38,6 +39,7 @@ "msal": "^1.0.0", "nyc": "^15.1.0", "prettier": "^1.17.0", + "puppeteer": "^5.5.0", "rollup": "^1.10.1", "rollup-plugin-babel": "^4.3.2", "rollup-plugin-commonjs": "^10.0.1", @@ -73,12 +75,13 @@ "format:ts": "prettier --write \"**/*.ts\"", "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", "prepack": "npm install && npm run build && npm run test", - "test:cjs": "mocha -r ts-node/register --project tsconfig-base.json spec/content/*.ts && mocha -r ts-node/register spec/core/*.ts && mocha -r ts-node/register spec/middleware/*.ts && mocha -r ts-node/register spec/tasks/*.ts", - "test:esm": "mocha -r ts-node/register --require esm spec/content/*.ts && mocha -r ts-node/register --require esm spec/core/*.ts && mocha -r ts-node/register --require esm spec/middleware/*.ts && mocha -r ts-node/register --require esm spec/tasks/*.ts", + "test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts", + "test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js", + "test:es": "tsc -p ./test/tsconfig-test-es.json && mocha test/dist/**/*.js --require esm", "test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts", - "cover": "nyc npm run test:esm", - "coverage": "nyc npm run test:cjs", - "karma": "karma start karma.conf.js" + "cover": "nyc npm run test", + "coverage": "nyc npm run test:esm", + "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" }, "repository": { "type": "git", @@ -86,6 +89,11 @@ }, "nyc": { "all": true, - "cache": false + "cache": false, + "exclude": [ + "samples/", + "*.js", + "lib/" + ] } } diff --git a/spec/tsconfig.json b/spec/tsconfig.json deleted file mode 100644 index 072db688b..000000000 --- a/spec/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../tsconfig-base.json", - "compilerOptions": { - "module": "commonjs", - "resolveJsonModule": true, - "esModuleInterop": true, - "noEmitOnError": true, - "noImplicitAny": false, - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "target": "es6", - "lib": ["es7", "dom"], - "declaration": true - } -} diff --git a/spec/DummyAuthenticationProvider.ts b/test/DummyAuthenticationProvider.ts similarity index 100% rename from spec/DummyAuthenticationProvider.ts rename to test/DummyAuthenticationProvider.ts diff --git a/spec/core/GraphResponseHandler.ts b/test/browser/core/GraphResponseHandler.ts similarity index 97% rename from spec/core/GraphResponseHandler.ts rename to test/browser/core/GraphResponseHandler.ts index e5c1a1052..d4766eb5d 100644 --- a/spec/core/GraphResponseHandler.ts +++ b/test/browser/core/GraphResponseHandler.ts @@ -7,8 +7,8 @@ import { assert } from "chai"; -import { DocumentType, GraphResponseHandler } from "../../src/GraphResponseHandler"; -import { ResponseType } from "../../src/ResponseType"; +import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; +import { ResponseType } from "../../../src/ResponseType"; describe("GraphResponseHandler.ts", () => { const htmlString = ` diff --git a/test/common/DummyAuthenticationProvider.ts b/test/common/DummyAuthenticationProvider.ts new file mode 100644 index 000000000..818b64047 --- /dev/null +++ b/test/common/DummyAuthenticationProvider.ts @@ -0,0 +1,30 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +/** + * @module DummyAuthenticationProvider + */ + +import { AuthenticationProvider } from "../../src/IAuthenticationProvider"; + +/** + * @class + * @implements AuthenticationProvider + * Class representing DummyAuthenticationProvider + */ +export class DummyAuthenticationProvider implements AuthenticationProvider { + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + public async getAccessToken(): Promise { + const token = "DUMMY_TOKEN"; + return Promise.resolve(token); + } +} diff --git a/spec/DummyHTTPMessageHandler.ts b/test/common/DummyHTTPMessageHandler.ts similarity index 93% rename from spec/DummyHTTPMessageHandler.ts rename to test/common/DummyHTTPMessageHandler.ts index 68a3cded7..eb7aedca0 100644 --- a/spec/DummyHTTPMessageHandler.ts +++ b/test/common/DummyHTTPMessageHandler.ts @@ -9,8 +9,8 @@ * @module DummyHTTPMessageHandler */ -import { Context } from "../src/IContext"; -import { Middleware } from "../src/middleware/IMiddleware"; +import { Context } from "../../src/IContext"; +import { Middleware } from "../../src/middleware/IMiddleware"; /** * @class diff --git a/spec/DummyHandlerOptions.ts b/test/common/DummyHandlerOptions.ts similarity index 91% rename from spec/DummyHandlerOptions.ts rename to test/common/DummyHandlerOptions.ts index 72bab57db..60704c090 100644 --- a/spec/DummyHandlerOptions.ts +++ b/test/common/DummyHandlerOptions.ts @@ -9,7 +9,7 @@ * @module DummyHandlerOptions */ -import { MiddlewareOptions } from "../src/middleware/options/IMiddlewareOptions"; +import { MiddlewareOptions } from "../../src/middleware/options/IMiddlewareOptions"; /** * @class diff --git a/spec/content/BatchRequestContent.ts b/test/common/content/BatchRequestContent.ts similarity index 99% rename from spec/content/BatchRequestContent.ts rename to test/common/content/BatchRequestContent.ts index 44427a00a..f590b5c31 100644 --- a/spec/content/BatchRequestContent.ts +++ b/test/common/content/BatchRequestContent.ts @@ -9,7 +9,7 @@ import { assert } from "chai"; import * as fs from "fs"; import "isomorphic-fetch"; -import { BatchRequestContent, BatchRequestStep } from "../../src/content/BatchRequestContent"; +import { BatchRequestContent, BatchRequestStep } from "../../../src/content/BatchRequestContent"; import { randomString } from "../test-helper"; const folderName = randomString(); diff --git a/spec/content/BatchResponseContent.ts b/test/common/content/BatchResponseContent.ts similarity index 97% rename from spec/content/BatchResponseContent.ts rename to test/common/content/BatchResponseContent.ts index 4bf28c34e..fbb88504e 100644 --- a/spec/content/BatchResponseContent.ts +++ b/test/common/content/BatchResponseContent.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { BatchResponseContent } from "../../src/content/BatchResponseContent"; +import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; const redirect = { id: "1", diff --git a/spec/core/Client.ts b/test/common/core/Client.ts similarity index 88% rename from spec/core/Client.ts rename to test/common/core/Client.ts index 55d98cc9e..61473a9f7 100644 --- a/spec/core/Client.ts +++ b/test/common/core/Client.ts @@ -8,15 +8,15 @@ import { assert } from "chai"; import "isomorphic-fetch"; -import { CustomAuthenticationProvider, TelemetryHandler } from "../../src"; -import { Client } from "../../src/Client"; -import { AuthProvider } from "../../src/IAuthProvider"; -import { ClientOptions } from "../../src/IClientOptions"; -import { Options } from "../../src/IOptions"; -import { AuthenticationHandler } from "../../src/middleware/AuthenticationHandler"; -import { ChaosHandler } from "../../src/middleware/ChaosHandler"; -import { ChaosHandlerOptions } from "../../src/middleware/options/ChaosHandlerOptions"; -import { ChaosStrategy } from "../../src/middleware/options/ChaosStrategy"; +import { CustomAuthenticationProvider, TelemetryHandler } from "../../../src"; +import { Client } from "../../../src/Client"; +import { AuthProvider } from "../../../src/IAuthProvider"; +import { ClientOptions } from "../../../src/IClientOptions"; +import { Options } from "../../../src/IOptions"; +import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; +import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; +import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; +import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; diff --git a/spec/core/GraphErrorHandler.ts b/test/common/core/GraphErrorHandler.ts similarity index 98% rename from spec/core/GraphErrorHandler.ts rename to test/common/core/GraphErrorHandler.ts index e16c05a4a..e6ef957c9 100644 --- a/spec/core/GraphErrorHandler.ts +++ b/test/common/core/GraphErrorHandler.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { GraphErrorHandler } from "../../src/GraphErrorHandler"; +import { GraphErrorHandler } from "../../../src/GraphErrorHandler"; describe("GraphErrorHandler.ts", () => { /* tslint:disable: no-string-literal */ diff --git a/spec/core/GraphRequestUtil.ts b/test/common/core/GraphRequestUtil.ts similarity index 96% rename from spec/core/GraphRequestUtil.ts rename to test/common/core/GraphRequestUtil.ts index 19369d355..96353ffac 100644 --- a/spec/core/GraphRequestUtil.ts +++ b/test/common/core/GraphRequestUtil.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { serializeContent, urlJoin } from "../../src/GraphRequestUtil"; +import { serializeContent, urlJoin } from "../../../src/GraphRequestUtil"; describe("GraphRequestUtil.ts", () => { describe("urlJoin", () => { diff --git a/test/common/core/GraphResponseHandler.ts b/test/common/core/GraphResponseHandler.ts new file mode 100644 index 000000000..d4766eb5d --- /dev/null +++ b/test/common/core/GraphResponseHandler.ts @@ -0,0 +1,162 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert } from "chai"; + +import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; +import { ResponseType } from "../../../src/ResponseType"; + +describe("GraphResponseHandler.ts", () => { + const htmlString = ` + + + + Testing Document + + +

Testing

+ + `; + const status200 = { + status: 200, + statusText: "OK", + }; + const status204 = { + status: 204, + statusText: "OK", + }; + const status500 = { + status: 500, + statusText: "Internal Server Error", + }; + const status202 = { + status: 202, + statusText: "OK", + }; + const status200Text = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "text/plain", + }, + }; + const status200Json = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "application/json", + }, + }; + const status200Image = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "image/jpeg", + }, + }; + const status200Unknown = { + status: 200, + statusText: "OK", + headers: { + "Content-Type": "dummy/unknown", + }, + }; + /* tslint:disable: no-string-literal */ + describe("parseDocumentResponse", () => { + it("Should return the html string", async () => { + const response = new Response(htmlString, status200); + const dom = await GraphResponseHandler["parseDocumentResponse"](response, DocumentType.TEXT_HTML); + assert.isDefined(dom); + assert.equal(typeof dom, "string"); + }); + }); + + describe("convertResponse", () => { + it("Should return empty response for the NO CONTENT (204 response)", async () => { + const response = new Response(undefined, status204); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.isUndefined(responseValue); + }); + + it("Should return empty text value for empty response", async () => { + const response = new Response(undefined, status202); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.isUndefined(responseValue); + }); + + it("Should return text data for text/plain content-type", async () => { + const data = "text data"; + const response = new Response(data, status200Text); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue, data); + }); + + it("Should return json data for application/json content-type", async () => { + const data = { + test: "test", + }; + const response = new Response(JSON.stringify(data), status200Json); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue.test, data.test); + }); + + it("Should return raw response incase of unknown content-type", async () => { + const data = "test data"; + const response = new Response(data, status200Unknown); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue, data); + }); + + it("Should return response value as text", async () => { + const response = new Response(htmlString, status200); + const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.TEXT); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + }); + + it("Should return response value as text for text/html return type", async () => { + const response = new Response(htmlString, status200); + const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.DOCUMENT); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + }); + + it("Should return response value as json", async () => { + const json = { test: "test" }; + const response = new Response(JSON.stringify(json), status200); + const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.JSON); + assert.isDefined(responseValue); + assert.equal(responseValue.test, "test"); + }); + + it("Should return response value as text for default response type", async () => { + const response = new Response(htmlString, status200); + const responseValue = await GraphResponseHandler["convertResponse"](response); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + }); + }); + /* tslint:enable: no-string-literal */ + + describe("getResponse", () => { + it("Should return a raw response", async () => { + const response = new Response(htmlString, status200); + const responseValue = await GraphResponseHandler.getResponse(response, ResponseType.RAW); + assert.isDefined(responseValue); + assert.isTrue(responseValue instanceof Response); + }); + + it("Should return valid 200 OK response", async () => { + const response = new Response(htmlString, status200); + const responseValue = await GraphResponseHandler.getResponse(response, ResponseType.TEXT); + assert.isDefined(responseValue); + }); + }); +}); diff --git a/spec/core/HTTPClient.ts b/test/common/core/HTTPClient.ts similarity index 94% rename from spec/core/HTTPClient.ts rename to test/common/core/HTTPClient.ts index 33d6933f7..359adfffc 100644 --- a/spec/core/HTTPClient.ts +++ b/test/common/core/HTTPClient.ts @@ -7,9 +7,9 @@ import { assert } from "chai"; -import { HTTPClient } from "../../src/HTTPClient"; -import { Context } from "../../src/IContext"; -import { FetchOptions } from "../../src/IFetchOptions"; +import { HTTPClient } from "../../../src/HTTPClient"; +import { Context } from "../../../src/IContext"; +import { FetchOptions } from "../../../src/IFetchOptions"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; describe("HTTPClient.ts", () => { diff --git a/spec/core/HTTPClientFactory.ts b/test/common/core/HTTPClientFactory.ts similarity index 91% rename from spec/core/HTTPClientFactory.ts rename to test/common/core/HTTPClientFactory.ts index 5c07cddf9..83649c2e8 100644 --- a/spec/core/HTTPClientFactory.ts +++ b/test/common/core/HTTPClientFactory.ts @@ -7,8 +7,8 @@ import { assert } from "chai"; -import { HTTPClient } from "../../src/HTTPClient"; -import { HTTPClientFactory } from "../../src/HTTPClientFactory"; +import { HTTPClient } from "../../../src/HTTPClient"; +import { HTTPClientFactory } from "../../../src/HTTPClientFactory"; import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; diff --git a/spec/core/Range.ts b/test/common/core/Range.ts similarity index 96% rename from spec/core/Range.ts rename to test/common/core/Range.ts index e25a6d8ef..e5b5b1bbd 100644 --- a/spec/core/Range.ts +++ b/test/common/core/Range.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { Range } from "../../src/Range"; +import { Range } from "../../../src/Range"; describe("Range.ts", () => { describe("Constructor", () => { diff --git a/spec/core/urlGeneration.ts b/test/common/core/urlGeneration.ts similarity index 100% rename from spec/core/urlGeneration.ts rename to test/common/core/urlGeneration.ts diff --git a/spec/core/urlParsing.ts b/test/common/core/urlParsing.ts similarity index 100% rename from spec/core/urlParsing.ts rename to test/common/core/urlParsing.ts diff --git a/spec/middleware/AuthenticationHandler.ts b/test/common/middleware/AuthenticationHandler.ts similarity index 91% rename from spec/middleware/AuthenticationHandler.ts rename to test/common/middleware/AuthenticationHandler.ts index 8b445f6cc..5af6902f5 100644 --- a/spec/middleware/AuthenticationHandler.ts +++ b/test/common/middleware/AuthenticationHandler.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { AuthenticationHandler } from "../../src/middleware/AuthenticationHandler"; +import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; const dummyAuthProvider = new DummyAuthenticationProvider(); diff --git a/spec/middleware/AuthenticationHandlerOptions.ts b/test/common/middleware/AuthenticationHandlerOptions.ts similarity index 85% rename from spec/middleware/AuthenticationHandlerOptions.ts rename to test/common/middleware/AuthenticationHandlerOptions.ts index 1bf0d6cb6..7403c716e 100644 --- a/spec/middleware/AuthenticationHandlerOptions.ts +++ b/test/common/middleware/AuthenticationHandlerOptions.ts @@ -7,8 +7,8 @@ import { assert } from "chai"; -import { AuthenticationHandlerOptions } from "../../src/middleware/options/AuthenticationHandlerOptions"; -import { MSALAuthenticationProviderOptions } from "../../src/MSALAuthenticationProviderOptions"; +import { AuthenticationHandlerOptions } from "../../../src/middleware/options/AuthenticationHandlerOptions"; +import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; describe("AuthenticationHandlerOptions.ts", () => { diff --git a/spec/middleware/ChaosHandler.ts b/test/common/middleware/ChaosHandler.ts similarity index 95% rename from spec/middleware/ChaosHandler.ts rename to test/common/middleware/ChaosHandler.ts index 782ecf58e..78965c632 100644 --- a/spec/middleware/ChaosHandler.ts +++ b/test/common/middleware/ChaosHandler.ts @@ -1,11 +1,11 @@ import { assert } from "chai"; -import { Context } from "../../src/IContext"; -import { ChaosHandler } from "../../src/middleware/ChaosHandler"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; -import { ChaosHandlerOptions } from "../../src/middleware/options/ChaosHandlerOptions"; -import { ChaosStrategy } from "../../src/middleware/options/ChaosStrategy"; -import { RequestMethod } from "../../src/RequestMethod"; +import { Context } from "../../../src/IContext"; +import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; +import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; +import { RequestMethod } from "../../../src/RequestMethod"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; const chaosHandlerOptions = new ChaosHandlerOptions(); diff --git a/spec/middleware/MSALAuthenticationProviderOptions.ts b/test/common/middleware/MSALAuthenticationProviderOptions.ts similarity index 87% rename from spec/middleware/MSALAuthenticationProviderOptions.ts rename to test/common/middleware/MSALAuthenticationProviderOptions.ts index 43c025c9a..36d38efdf 100644 --- a/spec/middleware/MSALAuthenticationProviderOptions.ts +++ b/test/common/middleware/MSALAuthenticationProviderOptions.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { MSALAuthenticationProviderOptions } from "../../src/MSALAuthenticationProviderOptions"; +import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; describe("MSALAuthenticationProviderOptions.ts", () => { it("Should create an instance with all the given options", () => { diff --git a/spec/middleware/MiddlewareControl.ts b/test/common/middleware/MiddlewareControl.ts similarity index 96% rename from spec/middleware/MiddlewareControl.ts rename to test/common/middleware/MiddlewareControl.ts index ff9cb64bd..512f272c7 100644 --- a/spec/middleware/MiddlewareControl.ts +++ b/test/common/middleware/MiddlewareControl.ts @@ -12,7 +12,7 @@ import { assert } from "chai"; import "isomorphic-fetch"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; import { DummyHandlerOptions } from "../DummyHandlerOptions"; describe("MiddlewareControl.ts", () => { diff --git a/spec/middleware/MiddlewareFactory.ts b/test/common/middleware/MiddlewareFactory.ts similarity index 87% rename from spec/middleware/MiddlewareFactory.ts rename to test/common/middleware/MiddlewareFactory.ts index 33d71dcda..fed9cbddf 100644 --- a/spec/middleware/MiddlewareFactory.ts +++ b/test/common/middleware/MiddlewareFactory.ts @@ -7,9 +7,9 @@ import { assert } from "chai"; -import { AuthenticationHandler, CustomAuthenticationProvider, HTTPMessageHandler, RedirectHandler, RetryHandler, TelemetryHandler } from "../../src"; -import { AuthProvider } from "../../src/IAuthProvider"; -import { MiddlewareFactory } from "../../src/middleware/MiddlewareFactory"; +import { AuthenticationHandler, CustomAuthenticationProvider, HTTPMessageHandler, RedirectHandler, RetryHandler, TelemetryHandler } from "../../../src"; +import { AuthProvider } from "../../../src/IAuthProvider"; +import { MiddlewareFactory } from "../../../src/middleware/MiddlewareFactory"; describe("MiddlewareFactory", () => { it("Should return the default pipeline", () => { diff --git a/spec/middleware/MiddlewareUtil.ts b/test/common/middleware/MiddlewareUtil.ts similarity index 100% rename from spec/middleware/MiddlewareUtil.ts rename to test/common/middleware/MiddlewareUtil.ts diff --git a/spec/middleware/RedirectHandler.ts b/test/common/middleware/RedirectHandler.ts similarity index 97% rename from spec/middleware/RedirectHandler.ts rename to test/common/middleware/RedirectHandler.ts index 4099e16fa..d07187389 100644 --- a/spec/middleware/RedirectHandler.ts +++ b/test/common/middleware/RedirectHandler.ts @@ -7,10 +7,10 @@ import { assert } from "chai"; -import { Context } from "../../src/IContext"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; -import { RedirectHandlerOptions } from "../../src/middleware/options/RedirectHandlerOptions"; -import { RedirectHandler } from "../../src/middleware/RedirectHandler"; +import { Context } from "../../../src/IContext"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; +import { RedirectHandler } from "../../../src/middleware/RedirectHandler"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; const redirectHandlerOptions = new RedirectHandlerOptions(); diff --git a/spec/middleware/RedirectHandlerOptions.ts b/test/common/middleware/RedirectHandlerOptions.ts similarity index 95% rename from spec/middleware/RedirectHandlerOptions.ts rename to test/common/middleware/RedirectHandlerOptions.ts index 05cad5b1e..1db8c263d 100644 --- a/spec/middleware/RedirectHandlerOptions.ts +++ b/test/common/middleware/RedirectHandlerOptions.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { RedirectHandlerOptions } from "../../src/middleware/options/RedirectHandlerOptions"; +import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; describe("RedirectHandlerOptions.ts", () => { describe("constructor", () => { diff --git a/spec/middleware/RetryHandler.ts b/test/common/middleware/RetryHandler.ts similarity index 95% rename from spec/middleware/RetryHandler.ts rename to test/common/middleware/RetryHandler.ts index bd3396ad3..430ce3ceb 100644 --- a/spec/middleware/RetryHandler.ts +++ b/test/common/middleware/RetryHandler.ts @@ -8,11 +8,11 @@ import { assert } from "chai"; import "isomorphic-fetch"; -import { Context } from "../../src/IContext"; -import { FetchOptions } from "../../src/IFetchOptions"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; -import { RetryHandlerOptions, ShouldRetry } from "../../src/middleware/options/RetryHandlerOptions"; -import { RetryHandler } from "../../src/middleware/RetryHandler"; +import { Context } from "../../../src/IContext"; +import { FetchOptions } from "../../../src/IFetchOptions"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { RetryHandlerOptions, ShouldRetry } from "../../../src/middleware/options/RetryHandlerOptions"; +import { RetryHandler } from "../../../src/middleware/RetryHandler"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; describe("RetryHandler.ts", function() { diff --git a/spec/middleware/RetryHandlerOptions.ts b/test/common/middleware/RetryHandlerOptions.ts similarity index 97% rename from spec/middleware/RetryHandlerOptions.ts rename to test/common/middleware/RetryHandlerOptions.ts index 4b9cdb99e..9449cf372 100644 --- a/spec/middleware/RetryHandlerOptions.ts +++ b/test/common/middleware/RetryHandlerOptions.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { RetryHandlerOptions, ShouldRetry } from "../../src/middleware/options/RetryHandlerOptions"; +import { RetryHandlerOptions, ShouldRetry } from "../../../src/middleware/options/RetryHandlerOptions"; describe("RetryHandlerOptions.ts", () => { /* tslint:disable: no-string-literal */ diff --git a/spec/middleware/TelemetryHandler.ts b/test/common/middleware/TelemetryHandler.ts similarity index 90% rename from spec/middleware/TelemetryHandler.ts rename to test/common/middleware/TelemetryHandler.ts index 81f5c7809..db7ca8090 100644 --- a/spec/middleware/TelemetryHandler.ts +++ b/test/common/middleware/TelemetryHandler.ts @@ -7,11 +7,11 @@ import { assert } from "chai"; -import { Context } from "../../src/IContext"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../src/middleware/options/TelemetryHandlerOptions"; -import { TelemetryHandler } from "../../src/middleware/TelemetryHandler"; -import { PACKAGE_VERSION } from "../../src/Version"; +import { Context } from "../../../src/IContext"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; +import { TelemetryHandler } from "../../../src/middleware/TelemetryHandler"; +import { PACKAGE_VERSION } from "../../../src/Version"; import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; describe("TelemetryHandler.ts", () => { diff --git a/spec/middleware/TelemetryHandlerOptions.ts b/test/common/middleware/TelemetryHandlerOptions.ts similarity index 95% rename from spec/middleware/TelemetryHandlerOptions.ts rename to test/common/middleware/TelemetryHandlerOptions.ts index 8cdb01516..56ad863d9 100644 --- a/spec/middleware/TelemetryHandlerOptions.ts +++ b/test/common/middleware/TelemetryHandlerOptions.ts @@ -7,9 +7,9 @@ import { assert } from "chai"; -import { Context } from "../../src/IContext"; -import { MiddlewareControl } from "../../src/middleware/MiddlewareControl"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../src/middleware/options/TelemetryHandlerOptions"; +import { Context } from "../../../src/IContext"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; describe("TelemetryHandlerOptions.ts", () => { /* tslint:disable: no-string-literal no-bitwise */ diff --git a/spec/package-lock.json b/test/common/package-lock.json similarity index 100% rename from spec/package-lock.json rename to test/common/package-lock.json diff --git a/spec/package.json b/test/common/package.json similarity index 100% rename from spec/package.json rename to test/common/package.json diff --git a/spec/tasks/LargeFileUploadTask.ts b/test/common/tasks/LargeFileUploadTask.ts similarity index 98% rename from spec/tasks/LargeFileUploadTask.ts rename to test/common/tasks/LargeFileUploadTask.ts index e442fd0a1..4a9b7023e 100644 --- a/spec/tasks/LargeFileUploadTask.ts +++ b/test/common/tasks/LargeFileUploadTask.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { LargeFileUploadTask } from "../../src/tasks/LargeFileUploadTask"; +import { LargeFileUploadTask } from "../../../src/tasks/LargeFileUploadTask"; import { getClient } from "../test-helper"; describe("LargeFileUploadTask.ts", () => { diff --git a/spec/tasks/OneDriveLargeFileUploadTask.ts b/test/common/tasks/OneDriveLargeFileUploadTask.ts similarity index 95% rename from spec/tasks/OneDriveLargeFileUploadTask.ts rename to test/common/tasks/OneDriveLargeFileUploadTask.ts index 10ec90f54..5e226983d 100644 --- a/spec/tasks/OneDriveLargeFileUploadTask.ts +++ b/test/common/tasks/OneDriveLargeFileUploadTask.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { OneDriveLargeFileUploadTask } from "../../src/tasks/OneDriveLargeFileUploadTask"; +import { OneDriveLargeFileUploadTask } from "../../../src/tasks/OneDriveLargeFileUploadTask"; describe("OneDriveLargeFileUploadTask.ts", () => { describe("constructCreateSessionUrl", () => { diff --git a/spec/tasks/OneDriveLargeFileUploadTaskUtil.ts b/test/common/tasks/OneDriveLargeFileUploadTaskUtil.ts similarity index 92% rename from spec/tasks/OneDriveLargeFileUploadTaskUtil.ts rename to test/common/tasks/OneDriveLargeFileUploadTaskUtil.ts index 09f8b92c2..b26f33c38 100644 --- a/spec/tasks/OneDriveLargeFileUploadTaskUtil.ts +++ b/test/common/tasks/OneDriveLargeFileUploadTaskUtil.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import * as OneDriveLargeFileUploadTaskUtil from "../../src/tasks/OneDriveLargeFileUploadTaskUtil"; +import * as OneDriveLargeFileUploadTaskUtil from "../../../src/tasks/OneDriveLargeFileUploadTaskUtil"; describe("OneDriveLargeFileUploadTaskUtil", () => { describe("getValidRangeSize", () => { diff --git a/spec/tasks/PageIterator.ts b/test/common/tasks/PageIterator.ts similarity index 97% rename from spec/tasks/PageIterator.ts rename to test/common/tasks/PageIterator.ts index db454c66e..fe09d4973 100644 --- a/spec/tasks/PageIterator.ts +++ b/test/common/tasks/PageIterator.ts @@ -7,8 +7,8 @@ import { assert } from "chai"; -import { Client } from "../../src/index"; -import { PageIterator, PageIteratorCallback } from "../../src/tasks/PageIterator"; +import { Client } from "../../../src/index"; +import { PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; import { getClient } from "../test-helper"; const client: Client = getClient(); diff --git a/test/common/test-helper.ts b/test/common/test-helper.ts new file mode 100644 index 000000000..2521b7ab8 --- /dev/null +++ b/test/common/test-helper.ts @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import "isomorphic-fetch"; + +import { Client } from "../../src/index"; + +import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; + +export function getClient(): Client { + return Client.initWithMiddleware({ + authProvider: new DummyAuthenticationProvider(), + }); +} + +export function randomString() { + return Math.random() + .toString(36) + .substring(7); +} diff --git a/spec2/development/HardCodedAuthenticationProvider.ts b/test/development/HardCodedAuthenticationProvider.ts similarity index 100% rename from spec2/development/HardCodedAuthenticationProvider.ts rename to test/development/HardCodedAuthenticationProvider.ts diff --git a/spec2/development/secrets.sample.ts b/test/development/secrets.sample.ts similarity index 100% rename from spec2/development/secrets.sample.ts rename to test/development/secrets.sample.ts diff --git a/spec2/development/secrets.ts b/test/development/secrets.ts similarity index 100% rename from spec2/development/secrets.ts rename to test/development/secrets.ts diff --git a/spec2/development/test-helper.ts b/test/development/test-helper.ts similarity index 100% rename from spec2/development/test-helper.ts rename to test/development/test-helper.ts diff --git a/spec2/development/workload/OneNote.ts b/test/development/workload/OneNote.ts similarity index 100% rename from spec2/development/workload/OneNote.ts rename to test/development/workload/OneNote.ts diff --git a/spec2/development/workload/PageIterator.ts b/test/development/workload/PageIterator.ts similarity index 100% rename from spec2/development/workload/PageIterator.ts rename to test/development/workload/PageIterator.ts diff --git a/spec2/development/workload/delta-query.ts b/test/development/workload/delta-query.ts similarity index 100% rename from spec2/development/workload/delta-query.ts rename to test/development/workload/delta-query.ts diff --git a/spec2/development/workload/excel.ts b/test/development/workload/excel.ts similarity index 100% rename from spec2/development/workload/excel.ts rename to test/development/workload/excel.ts diff --git a/spec2/development/workload/groups.ts b/test/development/workload/groups.ts similarity index 100% rename from spec2/development/workload/groups.ts rename to test/development/workload/groups.ts diff --git a/spec2/development/workload/insights.ts b/test/development/workload/insights.ts similarity index 100% rename from spec2/development/workload/insights.ts rename to test/development/workload/insights.ts diff --git a/spec2/development/workload/open-extensions.ts b/test/development/workload/open-extensions.ts similarity index 100% rename from spec2/development/workload/open-extensions.ts rename to test/development/workload/open-extensions.ts diff --git a/spec2/development/workload/users.ts b/test/development/workload/users.ts similarity index 100% rename from spec2/development/workload/users.ts rename to test/development/workload/users.ts diff --git a/test/dist/es/src/Client.d.ts b/test/dist/es/src/Client.d.ts new file mode 100644 index 000000000..a3416cd59 --- /dev/null +++ b/test/dist/es/src/Client.d.ts @@ -0,0 +1,51 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { GraphRequest } from "./GraphRequest"; +import { ClientOptions } from "./IClientOptions"; +import { Options } from "./IOptions"; +export declare class Client { + /** + * @private + * A member which stores the Client instance options + */ + private config; + /** + * @private + * A member which holds the HTTPClient instance + */ + private httpClient; + /** + * @public + * @static + * To create a client instance with options and initializes the default middleware chain + * @param {Options} options - The options for client instance + * @returns The Client instance + */ + static init(options: Options): Client; + /** + * @public + * @static + * To create a client instance with the Client Options + * @param {ClientOptions} clientOptions - The options object for initializing the client + * @returns The Client instance + */ + static initWithMiddleware(clientOptions: ClientOptions): Client; + /** + * @private + * @constructor + * Creates an instance of Client + * @param {ClientOptions} clientOptions - The options to instantiate the client object + */ + private constructor(); + /** + * @public + * Entry point to make requests + * @param {string} path - The path string value + * @returns The graph request instance + */ + api(path: string): GraphRequest; +} diff --git a/test/dist/es/src/Client.js b/test/dist/es/src/Client.js new file mode 100644 index 000000000..d4b0e471e --- /dev/null +++ b/test/dist/es/src/Client.js @@ -0,0 +1,101 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Client + */ +import { GRAPH_API_VERSION, GRAPH_BASE_URL } from "./Constants"; +import { CustomAuthenticationProvider } from "./CustomAuthenticationProvider"; +import { GraphRequest } from "./GraphRequest"; +import { HTTPClient } from "./HTTPClient"; +import { HTTPClientFactory } from "./HTTPClientFactory"; +import { validatePolyFilling } from "./ValidatePolyFilling"; +export class Client { + /** + * @private + * @constructor + * Creates an instance of Client + * @param {ClientOptions} clientOptions - The options to instantiate the client object + */ + constructor(clientOptions) { + /** + * @private + * A member which stores the Client instance options + */ + this.config = { + baseUrl: GRAPH_BASE_URL, + debugLogging: false, + defaultVersion: GRAPH_API_VERSION, + }; + try { + validatePolyFilling(); + } catch (error) { + throw error; + } + for (const key in clientOptions) { + if (clientOptions.hasOwnProperty(key)) { + this.config[key] = clientOptions[key]; + } + } + let httpClient; + if (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) { + const error = new Error(); + error.name = "AmbiguityInInitialization"; + error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both"; + throw error; + } else if (clientOptions.authProvider !== undefined) { + httpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider); + } else if (clientOptions.middleware !== undefined) { + httpClient = new HTTPClient(...[].concat(clientOptions.middleware)); + } else { + const error = new Error(); + error.name = "InvalidMiddlewareChain"; + error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain"; + throw error; + } + this.httpClient = httpClient; + } + /** + * @public + * @static + * To create a client instance with options and initializes the default middleware chain + * @param {Options} options - The options for client instance + * @returns The Client instance + */ + static init(options) { + const clientOptions = {}; + for (const i in options) { + if (options.hasOwnProperty(i)) { + clientOptions[i] = i === "authProvider" ? new CustomAuthenticationProvider(options[i]) : options[i]; + } + } + return Client.initWithMiddleware(clientOptions); + } + /** + * @public + * @static + * To create a client instance with the Client Options + * @param {ClientOptions} clientOptions - The options object for initializing the client + * @returns The Client instance + */ + static initWithMiddleware(clientOptions) { + try { + return new Client(clientOptions); + } catch (error) { + throw error; + } + } + /** + * @public + * Entry point to make requests + * @param {string} path - The path string value + * @returns The graph request instance + */ + api(path) { + return new GraphRequest(this.httpClient, this.config, path); + } +} +//# sourceMappingURL=Client.js.map diff --git a/test/dist/es/src/Client.js.map b/test/dist/es/src/Client.js.map new file mode 100644 index 000000000..7f8a51acc --- /dev/null +++ b/test/dist/es/src/Client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../../src/Client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gBA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G,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,GAAG,wBAAwB,CAAC;YACtC,KAAK,CAAC,OAAO,GAAG,gIAAgI,CAAC;YACjJ,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAlED;;;;;;OAMG;IACI,MAAM,CAAC,IAAI,CAAC,OAAgB;QAClC,MAAM,aAAa,GAAkB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE;YACxB,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;gBAC9B,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aACpG;SACD;QACD,OAAO,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,aAA4B;QAC5D,IAAI;YACH,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;SACjC;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,KAAK,CAAC;SACZ;IACF,CAAC;IAsCD;;;;;OAKG;IACI,GAAG,CAAC,IAAY;QACtB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/Constants.d.ts b/test/dist/es/src/Constants.d.ts new file mode 100644 index 000000000..ebb3031a9 --- /dev/null +++ b/test/dist/es/src/Constants.d.ts @@ -0,0 +1,19 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Constants + */ +/** + * @constant + * A Default API endpoint version for a request + */ +export declare const GRAPH_API_VERSION = "v1.0"; +/** + * @constant + * A Default base url for a request + */ +export declare const GRAPH_BASE_URL = "https://graph.microsoft.com/"; diff --git a/test/dist/es/src/Constants.js b/test/dist/es/src/Constants.js new file mode 100644 index 000000000..709dba82d --- /dev/null +++ b/test/dist/es/src/Constants.js @@ -0,0 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Constants + */ +/** + * @constant + * A Default API endpoint version for a request + */ +export const GRAPH_API_VERSION = "v1.0"; +/** + * @constant + * A Default base url for a request + */ +export const GRAPH_BASE_URL = "https://graph.microsoft.com/"; +//# sourceMappingURL=Constants.js.map diff --git a/test/dist/es/src/Constants.js.map b/test/dist/es/src/Constants.js.map new file mode 100644 index 000000000..5bdd957b9 --- /dev/null +++ b/test/dist/es/src/Constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,8BAA8B,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/CustomAuthenticationProvider.d.ts b/test/dist/es/src/CustomAuthenticationProvider.d.ts new file mode 100644 index 000000000..e0f325025 --- /dev/null +++ b/test/dist/es/src/CustomAuthenticationProvider.d.ts @@ -0,0 +1,38 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module CustomAuthenticationProvider + */ +import { AuthenticationProvider } from "./IAuthenticationProvider"; +import { AuthProvider } from "./IAuthProvider"; +/** + * @class + * Class representing CustomAuthenticationProvider + * @extends AuthenticationProvider + */ +export declare class CustomAuthenticationProvider implements AuthenticationProvider { + /** + * @private + * A member to hold authProvider callback + */ + private provider; + /** + * @public + * @constructor + * Creates an instance of CustomAuthenticationProvider + * @param {AuthProviderCallback} provider - An authProvider function + * @returns An instance of CustomAuthenticationProvider + */ + constructor(provider: AuthProvider); + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken(): Promise; +} diff --git a/test/dist/es/src/CustomAuthenticationProvider.js b/test/dist/es/src/CustomAuthenticationProvider.js new file mode 100644 index 000000000..c43855a7b --- /dev/null +++ b/test/dist/es/src/CustomAuthenticationProvider.js @@ -0,0 +1,44 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * Class representing CustomAuthenticationProvider + * @extends AuthenticationProvider + */ +export class CustomAuthenticationProvider { + /** + * @public + * @constructor + * Creates an instance of CustomAuthenticationProvider + * @param {AuthProviderCallback} provider - An authProvider function + * @returns An instance of CustomAuthenticationProvider + */ + constructor(provider) { + this.provider = provider; + } + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + return new Promise((resolve, reject) => { + this.provider((error, accessToken) => { + if (accessToken) { + resolve(accessToken); + } else { + reject(error); + } + }); + }); + }); + } +} +//# sourceMappingURL=CustomAuthenticationProvider.js.map diff --git a/test/dist/es/src/CustomAuthenticationProvider.js.map b/test/dist/es/src/CustomAuthenticationProvider.js.map new file mode 100644 index 000000000..f263e874f --- /dev/null +++ b/test/dist/es/src/CustomAuthenticationProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CustomAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/CustomAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAOxC;;;;;;OAMG;IACH,YAAmB,QAAsB;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACU,cAAc;;YAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAsC,EAAE,MAA4B,EAAE,EAAE;gBAC3F,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAU,EAAE,WAA0B,EAAE,EAAE;oBACxD,IAAI,WAAW,EAAE;wBAChB,OAAO,CAAC,WAAW,CAAC,CAAC;qBACrB;yBAAM;wBACN,MAAM,CAAC,KAAK,CAAC,CAAC;qBACd;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphError.d.ts b/test/dist/es/src/GraphError.d.ts new file mode 100644 index 000000000..735afeb09 --- /dev/null +++ b/test/dist/es/src/GraphError.d.ts @@ -0,0 +1,51 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphError + */ +/** + * @class + * Class for GraphError + * @NOTE: This is NOT what is returned from the Graph + * GraphError is created from parsing JSON errors returned from the graph + * Some fields are renamed ie, "request-id" => requestId so you can use dot notation + */ +export declare class GraphError extends Error { + /** + * @public + * A member holding status code of the error + */ + statusCode: number; + /** + * @public + * A member holding code i.e name of the error + */ + code: string | null; + /** + * @public + * A member holding request-id i.e identifier of the request + */ + requestId: string | null; + /** + * @public + * A member holding processed date and time of the request + */ + date: Date; + /** + * @public + * A member holding original error response by the graph service + */ + body: any; + /** + * @public + * @constructor + * Creates an instance of GraphError + * @param {number} [statusCode = -1] - The status code of the error + * @returns An instance of GraphError + */ + constructor(statusCode?: number, message?: string, baseError?: Error); +} diff --git a/test/dist/es/src/GraphError.js b/test/dist/es/src/GraphError.js new file mode 100644 index 000000000..787e68808 --- /dev/null +++ b/test/dist/es/src/GraphError.js @@ -0,0 +1,35 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphError + */ +/** + * @class + * Class for GraphError + * @NOTE: This is NOT what is returned from the Graph + * GraphError is created from parsing JSON errors returned from the graph + * Some fields are renamed ie, "request-id" => requestId so you can use dot notation + */ +export class GraphError extends Error { + /** + * @public + * @constructor + * Creates an instance of GraphError + * @param {number} [statusCode = -1] - The status code of the error + * @returns An instance of GraphError + */ + constructor(statusCode = -1, message, baseError) { + super(message || (baseError && baseError.message)); + this.statusCode = statusCode; + this.code = null; + this.requestId = null; + this.date = new Date(); + this.body = null; + this.stack = baseError ? baseError.stack : this.stack; + } +} +//# sourceMappingURL=GraphError.js.map diff --git a/test/dist/es/src/GraphError.js.map b/test/dist/es/src/GraphError.js.map new file mode 100644 index 000000000..22d35f7ec --- /dev/null +++ b/test/dist/es/src/GraphError.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphError.js","sourceRoot":"","sources":["../../../../src/GraphError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH,MAAM,OAAO,UAAW,SAAQ,KAAK;IA+BpC;;;;;;OAMG;IACH,YAAmB,aAAqB,CAAC,CAAC,EAAE,OAAgB,EAAE,SAAiB;QAC9E,KAAK,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphErrorHandler.d.ts b/test/dist/es/src/GraphErrorHandler.d.ts new file mode 100644 index 000000000..2814f6506 --- /dev/null +++ b/test/dist/es/src/GraphErrorHandler.d.ts @@ -0,0 +1,59 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphErrorHandler + */ +import { GraphError } from "./GraphError"; +import { GraphRequestCallback } from "./IGraphRequestCallback"; +/** + * @class + * Class for GraphErrorHandler + */ +export declare class GraphErrorHandler { + /** + * @private + * @static + * Populates the GraphError instance with Error instance values + * @param {Error} error - The error returned by graph service or some native error + * @param {number} [statusCode] - The status code of the response + * @returns The GraphError instance + */ + private static constructError; + /** + * @private + * @static + * @async + * Populates the GraphError instance from the Error returned by graph service + * @param {any} error - The error returned by graph service or some native error + * @param {number} statusCode - The status code of the response + * @returns A promise that resolves to GraphError instance + * + * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo + * { + * "error": { + * "code": "SearchEvents", + * "message": "The parameter $search is not currently supported on the Events resource.", + * "innerError": { + * "request-id": "b31c83fd-944c-4663-aa50-5d9ceb367e19", + * "date": "2016-11-17T18:37:45" + * } + * } + * } + */ + private static constructErrorFromResponse; + /** + * @public + * @static + * @async + * To get the GraphError object + * @param {any} [error = null] - The error returned by graph service or some native error + * @param {number} [statusCode = -1] - The status code of the response + * @param {GraphRequestCallback} [callback] - The graph request callback function + * @returns A promise that resolves to GraphError instance + */ + static getError(error?: any, statusCode?: number, callback?: GraphRequestCallback): Promise; +} diff --git a/test/dist/es/src/GraphErrorHandler.js b/test/dist/es/src/GraphErrorHandler.js new file mode 100644 index 000000000..fc760594c --- /dev/null +++ b/test/dist/es/src/GraphErrorHandler.js @@ -0,0 +1,98 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @module GraphErrorHandler + */ +import { GraphError } from "./GraphError"; +/** + * @class + * Class for GraphErrorHandler + */ +export class GraphErrorHandler { + /** + * @private + * @static + * Populates the GraphError instance with Error instance values + * @param {Error} error - The error returned by graph service or some native error + * @param {number} [statusCode] - The status code of the response + * @returns The GraphError instance + */ + static constructError(error, statusCode) { + const gError = new GraphError(statusCode, "", error); + if (error.name !== undefined) { + gError.code = error.name; + } + gError.body = error.toString(); + gError.date = new Date(); + return gError; + } + /** + * @private + * @static + * @async + * Populates the GraphError instance from the Error returned by graph service + * @param {any} error - The error returned by graph service or some native error + * @param {number} statusCode - The status code of the response + * @returns A promise that resolves to GraphError instance + * + * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo + * { + * "error": { + * "code": "SearchEvents", + * "message": "The parameter $search is not currently supported on the Events resource.", + * "innerError": { + * "request-id": "b31c83fd-944c-4663-aa50-5d9ceb367e19", + * "date": "2016-11-17T18:37:45" + * } + * } + * } + */ + static constructErrorFromResponse(error, statusCode) { + error = error.error; + const gError = new GraphError(statusCode, error.message); + gError.code = error.code; + if (error.innerError !== undefined) { + gError.requestId = error.innerError["request-id"]; + gError.date = new Date(error.innerError.date); + } + try { + gError.body = JSON.stringify(error); + } catch (error) { + // tslint:disable-line: no-empty + } + return gError; + } + /** + * @public + * @static + * @async + * To get the GraphError object + * @param {any} [error = null] - The error returned by graph service or some native error + * @param {number} [statusCode = -1] - The status code of the response + * @param {GraphRequestCallback} [callback] - The graph request callback function + * @returns A promise that resolves to GraphError instance + */ + static getError(error = null, statusCode = -1, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + let gError; + if (error && error.error) { + gError = GraphErrorHandler.constructErrorFromResponse(error, statusCode); + } else if (typeof Error !== "undefined" && error instanceof Error) { + gError = GraphErrorHandler.constructError(error, statusCode); + } else { + gError = new GraphError(statusCode); + } + if (typeof callback === "function") { + callback(gError, null); + } else { + return gError; + } + }); + } +} +//# sourceMappingURL=GraphErrorHandler.js.map diff --git a/test/dist/es/src/GraphErrorHandler.js.map b/test/dist/es/src/GraphErrorHandler.js.map new file mode 100644 index 000000000..1f8bd0fb5 --- /dev/null +++ b/test/dist/es/src/GraphErrorHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphErrorHandler.js","sourceRoot":"","sources":["../../../../src/GraphErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AAEH,MAAM,OAAO,iBAAiB;IAC7B;;;;;;;OAOG;IACK,MAAM,CAAC,cAAc,CAAC,KAAY,EAAE,UAAmB;QAC9D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC7B,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;SACzB;QACD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACK,MAAM,CAAC,0BAA0B,CAAC,KAAU,EAAE,UAAkB;QACvE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACzB,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;YACnC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC9C;QACD,IAAI;YACH,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACpC;QAAC,OAAO,KAAK,EAAE;YACf,gCAAgC;SAChC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAO,QAAQ,CAAC,QAAa,IAAI,EAAE,aAAqB,CAAC,CAAC,EAAE,QAA+B;;YACvG,IAAI,MAAkB,CAAC;YACvB,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE;gBACzB,MAAM,GAAG,iBAAiB,CAAC,0BAA0B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aACzE;iBAAM,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,YAAY,KAAK,EAAE;gBAClE,MAAM,GAAG,iBAAiB,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAC7D;iBAAM;gBACN,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;aACpC;YACD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBACnC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACvB;iBAAM;gBACN,OAAO,MAAM,CAAC;aACd;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphRequest.d.ts b/test/dist/es/src/GraphRequest.d.ts new file mode 100644 index 000000000..464d527ce --- /dev/null +++ b/test/dist/es/src/GraphRequest.d.ts @@ -0,0 +1,378 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { HTTPClient } from "./HTTPClient"; +import { ClientOptions } from "./IClientOptions"; +import { GraphRequestCallback } from "./IGraphRequestCallback"; +import { MiddlewareOptions } from "./middleware/options/IMiddlewareOptions"; +import { ResponseType } from "./ResponseType"; +/** + * @interface + * Signature to representing key value pairs + * @property {[key: string] : string | number} - The Key value pair + */ +interface KeyValuePairObjectStringNumber { + [key: string]: string | number; +} +/** + * @interface + * Signature to define URL components + * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS + * + * @property {string} host - The host to which the request needs to be made + * @property {string} version - Version of the graph endpoint + * @property {string} [path] - The path of the resource request + * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params + * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request + * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif' + */ +export interface URLComponents { + host: string; + version: string; + path?: string; + oDataQueryParams: KeyValuePairObjectStringNumber; + otherURLQueryParams: KeyValuePairObjectStringNumber; + otherURLQueryOptions?: string[]; +} +/** + * @class + * A Class representing GraphRequest + */ +export declare class GraphRequest { + /** + * @private + * A member variable to hold HTTPClient instance + */ + private httpClient; + /** + * @private + * A member variable to hold client options + */ + private config; + /** + * @private + * A member to hold URL Components data + */ + private urlComponents; + /** + * @private + * A member to hold custom header options for a request + */ + private _headers; + /** + * @private + * A member to hold custom options for a request + */ + private _options; + /** + * @private + * A member to hold the array of middleware options for a request + */ + private _middlewareOptions; + /** + * @private + * A member to hold custom response type for a request + */ + private _responseType; + /** + * @public + * @constructor + * Creates an instance of GraphRequest + * @param {HTTPClient} httpClient - The HTTPClient instance + * @param {ClientOptions} config - The options for making request + * @param {string} path - A path string + */ + constructor(httpClient: HTTPClient, config: ClientOptions, path: string); + /** + * @private + * Parses the path string and creates URLComponents out of it + * @param {string} path - The request path string + * @returns Nothing + */ + private parsePath; + /** + * @private + * Adds the query parameter as comma separated values + * @param {string} propertyName - The name of a property + * @param {string|string[]} propertyValue - The vale of a property + * @param {IArguments} additionalProperties - The additional properties + * @returns Nothing + */ + private addCsvQueryParameter; + /** + * @private + * Builds the full url from the URLComponents to make a request + * @returns The URL string that is qualified to make a request to graph endpoint + */ + private buildFullUrl; + /** + * @private + * Builds the query string from the URLComponents + * @returns The Constructed query string + */ + private createQueryString; + /** + * @private + * Parses the query parameters to set the urlComponents property of the GraphRequest object + * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter + * @returns The same GraphRequest instance that is being called with + */ + private parseQueryParameter; + /** + * @private + * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object + * @param {string} queryParameter - the query parameters + * returns nothing + */ + private parseQueryParamenterString; + /** + * @private + * Sets values into the urlComponents property of GraphRequest object. + * @param {string} paramKey - the query parameter key + * @param {string} paramValue - the query paramter value + * @returns nothing + */ + private setURLComponentsQueryParamater; + /** + * @private + * Check if the query parameter string has a valid key-value structure + * @param {string} queryString - the query parameter string. Example -> "name=value" + * #returns true if the query string has a valid key-value structure else false + */ + private isValidQueryKeyValuePair; + /** + * @private + * Updates the custom headers and options for a request + * @param {FetchOptions} options - The request options object + * @returns Nothing + */ + private updateRequestOptions; + /** + * @private + * @async + * Adds the custom headers and options to the request and makes the HTTPClient send request call + * @param {RequestInfo} request - The request url string or the Request object value + * @param {FetchOptions} options - The options to make a request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the response content + */ + private send; + /** + * @private + * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json + * @param none + * @returns nothing + */ + private setHeaderContentType; + /** + * @public + * Sets the custom header for a request + * @param {string} headerKey - A header key + * @param {string} headerValue - A header value + * @returns The same GraphRequest instance that is being called with + */ + header(headerKey: string, headerValue: string): GraphRequest; + /** + * @public + * Sets the custom headers for a request + * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers + * @returns The same GraphRequest instance that is being called with + */ + headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest; + /** + * @public + * Sets the option for making a request + * @param {string} key - The key value + * @param {any} value - The value + * @returns The same GraphRequest instance that is being called with + */ + option(key: string, value: any): GraphRequest; + /** + * @public + * Sets the options for making a request + * @param {{ [key: string]: any }} options - The options key value pair + * @returns The same GraphRequest instance that is being called with + */ + options(options: { [key: string]: any }): GraphRequest; + /** + * @public + * Sets the middleware options for a request + * @param {MiddlewareOptions[]} options - The array of middleware options + * @returns The same GraphRequest instance that is being called with + */ + middlewareOptions(options: MiddlewareOptions[]): GraphRequest; + /** + * @public + * Sets the api endpoint version for a request + * @param {string} version - The version value + * @returns The same GraphRequest instance that is being called with + */ + version(version: string): GraphRequest; + /** + * @public + * Sets the api endpoint version for a request + * @param {ResponseType} responseType - The response type value + * @returns The same GraphRequest instance that is being called with + */ + responseType(responseType: ResponseType): GraphRequest; + /** + * @public + * To add properties for select OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query + */ + select(properties: string | string[]): GraphRequest; + /** + * @public + * To add properties for expand OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query + */ + expand(properties: string | string[]): GraphRequest; + /** + * @public + * To add properties for orderby OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query + */ + orderby(properties: string | string[]): GraphRequest; + /** + * @public + * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string. + * @param {string} filterStr - The filter query string + * @returns The same GraphRequest instance that is being called with, after adding the $filter query + */ + filter(filterStr: string): GraphRequest; + /** + * @public + * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string. + * @param {string} searchStr - The search criterion string + * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria + */ + search(searchStr: string): GraphRequest; + /** + * @public + * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value. + * @param {number} n - The number value + * @returns The same GraphRequest instance that is being called with, after adding the number for $top query + */ + top(n: number): GraphRequest; + /** + * @public + * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value. + * @param {number} n - The number value + * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query + */ + skip(n: number): GraphRequest; + /** + * @public + * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value. + * @param {string} token - The token value + * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option + */ + skipToken(token: string): GraphRequest; + /** + * @public + * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value. + * @param {boolean} isCount - The count boolean + * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option + */ + count(isCount?: boolean): GraphRequest; + /** + * @public + * Appends query string to the urlComponent + * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value + * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component + */ + query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest; + /** + * @public + * @async + * Makes a http request with GET method + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the get response + */ + get(callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes a http request with POST method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the post response + */ + post(content: any, callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Alias for Post request call + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the post response + */ + create(content: any, callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes http request with PUT method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the put response + */ + put(content: any, callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes http request with PATCH method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the patch response + */ + patch(content: any, callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Alias for PATCH request + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the patch response + */ + update(content: any, callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes http request with DELETE method + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the delete response + */ + delete(callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Alias for delete request call + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the delete response + */ + del(callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes a http request with GET method to read response as a stream. + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the getStream response + */ + getStream(callback?: GraphRequestCallback): Promise; + /** + * @public + * @async + * Makes a http request with GET method to read response as a stream. + * @param {any} stream - The stream instance + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the putStream response + */ + putStream(stream: any, callback?: GraphRequestCallback): Promise; +} +export {}; diff --git a/test/dist/es/src/GraphRequest.js b/test/dist/es/src/GraphRequest.js new file mode 100644 index 000000000..22e1c4109 --- /dev/null +++ b/test/dist/es/src/GraphRequest.js @@ -0,0 +1,716 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { GraphErrorHandler } from "./GraphErrorHandler"; +import { oDataQueryNames, serializeContent, urlJoin } from "./GraphRequestUtil"; +import { GraphResponseHandler } from "./GraphResponseHandler"; +import { MiddlewareControl } from "./middleware/MiddlewareControl"; +import { RequestMethod } from "./RequestMethod"; +import { ResponseType } from "./ResponseType"; +/** + * @class + * A Class representing GraphRequest + */ +export class GraphRequest { + /* tslint:enable: variable-name */ + /** + * @public + * @constructor + * Creates an instance of GraphRequest + * @param {HTTPClient} httpClient - The HTTPClient instance + * @param {ClientOptions} config - The options for making request + * @param {string} path - A path string + */ + constructor(httpClient, config, path) { + /** + * @private + * Parses the path string and creates URLComponents out of it + * @param {string} path - The request path string + * @returns Nothing + */ + this.parsePath = (path) => { + // Strips out the base of the url if they passed in + if (path.indexOf("https://") !== -1) { + path = path.replace("https://", ""); + // Find where the host ends + const endOfHostStrPos = path.indexOf("/"); + if (endOfHostStrPos !== -1) { + // Parse out the host + this.urlComponents.host = "https://" + path.substring(0, endOfHostStrPos); + // Strip the host from path + path = path.substring(endOfHostStrPos + 1, path.length); + } + // Remove the following version + const endOfVersionStrPos = path.indexOf("/"); + if (endOfVersionStrPos !== -1) { + // Parse out the version + this.urlComponents.version = path.substring(0, endOfVersionStrPos); + // Strip version from path + path = path.substring(endOfVersionStrPos + 1, path.length); + } + } + // Strip out any leading "/" + if (path.charAt(0) === "/") { + path = path.substr(1); + } + const queryStrPos = path.indexOf("?"); + if (queryStrPos === -1) { + // No query string + this.urlComponents.path = path; + } else { + this.urlComponents.path = path.substr(0, queryStrPos); + // Capture query string into oDataQueryParams and otherURLQueryParams + const queryParams = path.substring(queryStrPos + 1, path.length).split("&"); + for (const queryParam of queryParams) { + this.parseQueryParameter(queryParam); + } + } + }; + this.httpClient = httpClient; + this.config = config; + this.urlComponents = { + host: this.config.baseUrl, + version: this.config.defaultVersion, + oDataQueryParams: {}, + otherURLQueryParams: {}, + otherURLQueryOptions: [], + }; + this._headers = {}; + this._options = {}; + this._middlewareOptions = []; + this.parsePath(path); + } + /** + * @private + * Adds the query parameter as comma separated values + * @param {string} propertyName - The name of a property + * @param {string|string[]} propertyValue - The vale of a property + * @param {IArguments} additionalProperties - The additional properties + * @returns Nothing + */ + addCsvQueryParameter(propertyName, propertyValue, additionalProperties) { + // If there are already $propertyName value there, append a "," + this.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + "," : ""; + let allValues = []; + if (additionalProperties.length > 1 && typeof propertyValue === "string") { + allValues = Array.prototype.slice.call(additionalProperties); + } else if (typeof propertyValue === "string") { + allValues.push(propertyValue); + } else { + allValues = allValues.concat(propertyValue); + } + this.urlComponents.oDataQueryParams[propertyName] += allValues.join(","); + } + /** + * @private + * Builds the full url from the URLComponents to make a request + * @returns The URL string that is qualified to make a request to graph endpoint + */ + buildFullUrl() { + const url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString(); + if (this.config.debugLogging) { + console.log(url); // tslint:disable-line: no-console + } + return url; + } + /** + * @private + * Builds the query string from the URLComponents + * @returns The Constructed query string + */ + createQueryString() { + // Combining query params from oDataQueryParams and otherURLQueryParams + const urlComponents = this.urlComponents; + const query = []; + if (Object.keys(urlComponents.oDataQueryParams).length !== 0) { + for (const property in urlComponents.oDataQueryParams) { + if (urlComponents.oDataQueryParams.hasOwnProperty(property)) { + query.push(property + "=" + urlComponents.oDataQueryParams[property]); + } + } + } + if (Object.keys(urlComponents.otherURLQueryParams).length !== 0) { + for (const property in urlComponents.otherURLQueryParams) { + if (urlComponents.otherURLQueryParams.hasOwnProperty(property)) { + query.push(property + "=" + urlComponents.otherURLQueryParams[property]); + } + } + } + if (urlComponents.otherURLQueryOptions.length !== 0) { + for (const str of urlComponents.otherURLQueryOptions) { + query.push(str); + } + } + return query.length > 0 ? "?" + query.join("&") : ""; + } + /** + * @private + * Parses the query parameters to set the urlComponents property of the GraphRequest object + * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter + * @returns The same GraphRequest instance that is being called with + */ + parseQueryParameter(queryDictionaryOrString) { + if (typeof queryDictionaryOrString === "string") { + if (queryDictionaryOrString.charAt(0) === "?") { + queryDictionaryOrString = queryDictionaryOrString.substring(1); + } + if (queryDictionaryOrString.indexOf("&") !== -1) { + const queryParams = queryDictionaryOrString.split("&"); + for (const str of queryParams) { + this.parseQueryParamenterString(str); + } + } else { + this.parseQueryParamenterString(queryDictionaryOrString); + } + } else if (queryDictionaryOrString.constructor === Object) { + for (const key in queryDictionaryOrString) { + if (queryDictionaryOrString.hasOwnProperty(key)) { + this.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]); + } + } + } + return this; + } + /** + * @private + * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object + * @param {string} queryParameter - the query parameters + * returns nothing + */ + parseQueryParamenterString(queryParameter) { + /* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters. + Example-> "/me?$expand=home($select=city)" */ + if (this.isValidQueryKeyValuePair(queryParameter)) { + const indexOfFirstEquals = queryParameter.indexOf("="); + const paramKey = queryParameter.substring(0, indexOfFirstEquals); + const paramValue = queryParameter.substring(indexOfFirstEquals + 1); + this.setURLComponentsQueryParamater(paramKey, paramValue); + } else { + /* Push values which are not of key-value structure. + Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/ + this.urlComponents.otherURLQueryOptions.push(queryParameter); + } + } + /** + * @private + * Sets values into the urlComponents property of GraphRequest object. + * @param {string} paramKey - the query parameter key + * @param {string} paramValue - the query paramter value + * @returns nothing + */ + setURLComponentsQueryParamater(paramKey, paramValue) { + if (oDataQueryNames.indexOf(paramKey) !== -1) { + const currentValue = this.urlComponents.oDataQueryParams[paramKey]; + const isValueAppendable = currentValue && (paramKey === "$expand" || paramKey === "$select" || paramKey === "$orderby"); + this.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + "," + paramValue : paramValue; + } else { + this.urlComponents.otherURLQueryParams[paramKey] = paramValue; + } + } + /** + * @private + * Check if the query parameter string has a valid key-value structure + * @param {string} queryString - the query parameter string. Example -> "name=value" + * #returns true if the query string has a valid key-value structure else false + */ + isValidQueryKeyValuePair(queryString) { + const indexofFirstEquals = queryString.indexOf("="); + if (indexofFirstEquals === -1) { + return false; + } + const indexofOpeningParanthesis = queryString.indexOf("("); + if (indexofOpeningParanthesis !== -1 && queryString.indexOf("(") < indexofFirstEquals) { + // Example -> .query($select($expand=true)); + return false; + } + return true; + } + /** + * @private + * Updates the custom headers and options for a request + * @param {FetchOptions} options - The request options object + * @returns Nothing + */ + updateRequestOptions(options) { + const optionsHeaders = Object.assign({}, options.headers); + if (this.config.fetchOptions !== undefined) { + const fetchOptions = Object.assign({}, this.config.fetchOptions); + Object.assign(options, fetchOptions); + if (typeof this.config.fetchOptions.headers !== undefined) { + options.headers = Object.assign({}, this.config.fetchOptions.headers); + } + } + Object.assign(options, this._options); + if (options.headers !== undefined) { + Object.assign(optionsHeaders, options.headers); + } + Object.assign(optionsHeaders, this._headers); + options.headers = optionsHeaders; + } + /** + * @private + * @async + * Adds the custom headers and options to the request and makes the HTTPClient send request call + * @param {RequestInfo} request - The request url string or the Request object value + * @param {FetchOptions} options - The options to make a request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the response content + */ + send(request, options, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + let rawResponse; + const middlewareControl = new MiddlewareControl(this._middlewareOptions); + this.updateRequestOptions(options); + try { + const context = yield this.httpClient.sendRequest({ + request, + options, + middlewareControl, + }); + rawResponse = context.response; + const response = yield GraphResponseHandler.getResponse(rawResponse, this._responseType, callback); + return response; + } catch (error) { + let statusCode; + if (typeof rawResponse !== "undefined") { + statusCode = rawResponse.status; + } + const gError = yield GraphErrorHandler.getError(error, statusCode, callback); + throw gError; + } + }); + } + /** + * @private + * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json + * @param none + * @returns nothing + */ + setHeaderContentType() { + if (!this._headers) { + this.header("Content-Type", "application/json"); + return; + } + const headerKeys = Object.keys(this._headers); + for (const headerKey of headerKeys) { + if (headerKey.toLowerCase() === "content-type") { + return; + } + } + // Default the content-type to application/json in case the content-type is not present in the header + this.header("Content-Type", "application/json"); + } + /** + * @public + * Sets the custom header for a request + * @param {string} headerKey - A header key + * @param {string} headerValue - A header value + * @returns The same GraphRequest instance that is being called with + */ + header(headerKey, headerValue) { + this._headers[headerKey] = headerValue; + return this; + } + /** + * @public + * Sets the custom headers for a request + * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers + * @returns The same GraphRequest instance that is being called with + */ + headers(headers) { + for (const key in headers) { + if (headers.hasOwnProperty(key)) { + this._headers[key] = headers[key]; + } + } + return this; + } + /** + * @public + * Sets the option for making a request + * @param {string} key - The key value + * @param {any} value - The value + * @returns The same GraphRequest instance that is being called with + */ + option(key, value) { + this._options[key] = value; + return this; + } + /** + * @public + * Sets the options for making a request + * @param {{ [key: string]: any }} options - The options key value pair + * @returns The same GraphRequest instance that is being called with + */ + options(options) { + for (const key in options) { + if (options.hasOwnProperty(key)) { + this._options[key] = options[key]; + } + } + return this; + } + /** + * @public + * Sets the middleware options for a request + * @param {MiddlewareOptions[]} options - The array of middleware options + * @returns The same GraphRequest instance that is being called with + */ + middlewareOptions(options) { + this._middlewareOptions = options; + return this; + } + /** + * @public + * Sets the api endpoint version for a request + * @param {string} version - The version value + * @returns The same GraphRequest instance that is being called with + */ + version(version) { + this.urlComponents.version = version; + return this; + } + /** + * @public + * Sets the api endpoint version for a request + * @param {ResponseType} responseType - The response type value + * @returns The same GraphRequest instance that is being called with + */ + responseType(responseType) { + this._responseType = responseType; + return this; + } + /** + * @public + * To add properties for select OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query + */ + /* + * Accepts .select("displayName,birthday") + * and .select(["displayName", "birthday"]) + * and .select("displayName", "birthday") + * + */ + select(properties) { + this.addCsvQueryParameter("$select", properties, arguments); + return this; + } + /** + * @public + * To add properties for expand OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query + */ + expand(properties) { + this.addCsvQueryParameter("$expand", properties, arguments); + return this; + } + /** + * @public + * To add properties for orderby OData Query param + * @param {string|string[]} properties - The Properties value + * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query + */ + orderby(properties) { + this.addCsvQueryParameter("$orderby", properties, arguments); + return this; + } + /** + * @public + * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string. + * @param {string} filterStr - The filter query string + * @returns The same GraphRequest instance that is being called with, after adding the $filter query + */ + filter(filterStr) { + this.urlComponents.oDataQueryParams.$filter = filterStr; + return this; + } + /** + * @public + * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string. + * @param {string} searchStr - The search criterion string + * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria + */ + search(searchStr) { + this.urlComponents.oDataQueryParams.$search = searchStr; + return this; + } + /** + * @public + * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value. + * @param {number} n - The number value + * @returns The same GraphRequest instance that is being called with, after adding the number for $top query + */ + top(n) { + this.urlComponents.oDataQueryParams.$top = n; + return this; + } + /** + * @public + * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value. + * @param {number} n - The number value + * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query + */ + skip(n) { + this.urlComponents.oDataQueryParams.$skip = n; + return this; + } + /** + * @public + * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value. + * @param {string} token - The token value + * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option + */ + skipToken(token) { + this.urlComponents.oDataQueryParams.$skipToken = token; + return this; + } + /** + * @public + * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value. + * @param {boolean} isCount - The count boolean + * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option + */ + count(isCount = false) { + this.urlComponents.oDataQueryParams.$count = isCount.toString(); + return this; + } + /** + * @public + * Appends query string to the urlComponent + * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value + * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component + */ + /* + * Accepts .query("displayName=xyz") + * and .select({ name: "value" }) + */ + query(queryDictionaryOrString) { + return this.parseQueryParameter(queryDictionaryOrString); + } + /** + * @public + * @async + * Makes a http request with GET method + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the get response + */ + get(callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + const options = { + method: RequestMethod.GET, + }; + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes a http request with POST method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the post response + */ + post(content, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + const options = { + method: RequestMethod.POST, + body: serializeContent(content), + }; + const className = content && content.constructor && content.constructor.name; + if (className === "FormData") { + // Content-Type headers should not be specified in case the of FormData type content + options.headers = {}; + } else { + this.setHeaderContentType(); + options.headers = this._headers; + } + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Alias for Post request call + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the post response + */ + create(content, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return yield this.post(content, callback); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes http request with PUT method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the put response + */ + put(content, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + this.setHeaderContentType(); + const options = { + method: RequestMethod.PUT, + body: serializeContent(content), + }; + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes http request with PATCH method + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the patch response + */ + patch(content, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + this.setHeaderContentType(); + const options = { + method: RequestMethod.PATCH, + body: serializeContent(content), + }; + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Alias for PATCH request + * @param {any} content - The content that needs to be sent with the request + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the patch response + */ + update(content, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return yield this.patch(content, callback); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes http request with DELETE method + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the delete response + */ + delete(callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + const options = { + method: RequestMethod.DELETE, + }; + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Alias for delete request call + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the delete response + */ + del(callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return yield this.delete(callback); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes a http request with GET method to read response as a stream. + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the getStream response + */ + getStream(callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + const options = { + method: RequestMethod.GET, + }; + this.responseType(ResponseType.STREAM); + try { + const stream = yield this.send(url, options, callback); + return stream; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * Makes a http request with GET method to read response as a stream. + * @param {any} stream - The stream instance + * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call + * @returns A promise that resolves to the putStream response + */ + putStream(stream, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const url = this.buildFullUrl(); + const options = { + method: RequestMethod.PUT, + headers: { + "Content-Type": "application/octet-stream", + }, + body: stream, + }; + try { + const response = yield this.send(url, options, callback); + return response; + } catch (error) { + throw error; + } + }); + } +} +//# sourceMappingURL=GraphRequest.js.map diff --git a/test/dist/es/src/GraphRequest.js.map b/test/dist/es/src/GraphRequest.js.map new file mode 100644 index 000000000..f0a160155 --- /dev/null +++ b/test/dist/es/src/GraphRequest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphRequest.js","sourceRoot":"","sources":["../../../../src/GraphRequest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA+B9C;;;GAGG;AACH,MAAM,OAAO,YAAY;IA2CxB,kCAAkC;IAElC;;;;;;;OAOG;IACH,YAAmB,UAAsB,EAAE,MAAqB,EAAE,IAAY;QAgB9E;;;;;WAKG;QACK,cAAS,GAAG,CAAC,IAAY,EAAQ,EAAE;YAC1C,mDAAmD;YACnD,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE;gBACpC,IAA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G;gBACf,MAAM,EAAE,aAAa,CAAC,GAAG;aACzB,CAAC;YACF,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACvD,OAAO,MAAM,CAAC;aACd;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,SAAS,CAAC,MAAW,EAAE,QAA+B;;YAClE,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG;gBACf,MAAM,EAAE,aAAa,CAAC,GAAG;gBACzB,OAAO,EAAE;oBACR,cAAc,EAAE,0BAA0B;iBAC1C;gBACD,IAAI,EAAE,MAAM;aACZ,CAAC;YACF,IAAI;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACzD,OAAO,QAAQ,CAAC;aAChB;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphRequestUtil.d.ts b/test/dist/es/src/GraphRequestUtil.d.ts new file mode 100644 index 000000000..a1e98b4d8 --- /dev/null +++ b/test/dist/es/src/GraphRequestUtil.d.ts @@ -0,0 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphRequestUtil + */ +/** + * To hold list of OData query params + */ +export declare const oDataQueryNames: string[]; +/** + * To construct the URL by appending the segments with "/" + * @param {string[]} urlSegments - The array of strings + * @returns The constructed URL string + */ +export declare const urlJoin: (urlSegments: string[]) => string; +/** + * Serializes the content + * @param {any} content - The content value that needs to be serialized + * @returns The serialized content + * + * Note: + * This conversion is required due to the following reasons: + * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string. + * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers. + * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`. + * If the data received is in JSON format, `serializeContent` converts the JSON to string. + */ +export declare const serializeContent: (content: any) => any; diff --git a/test/dist/es/src/GraphRequestUtil.js b/test/dist/es/src/GraphRequestUtil.js new file mode 100644 index 000000000..86f1f85fd --- /dev/null +++ b/test/dist/es/src/GraphRequestUtil.js @@ -0,0 +1,56 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphRequestUtil + */ +/** + * To hold list of OData query params + */ +export const oDataQueryNames = ["$select", "$expand", "$orderby", "$filter", "$top", "$skip", "$skipToken", "$count"]; +/** + * To construct the URL by appending the segments with "/" + * @param {string[]} urlSegments - The array of strings + * @returns The constructed URL string + */ +export const urlJoin = (urlSegments) => { + const removePostSlash = (s) => s.replace(/\/+$/, ""); + const removePreSlash = (s) => s.replace(/^\/+/, ""); + const joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join("/"); + const parts = Array.prototype.slice.call(urlSegments); + return parts.reduce(joiner); +}; +/** + * Serializes the content + * @param {any} content - The content value that needs to be serialized + * @returns The serialized content + * + * Note: + * This conversion is required due to the following reasons: + * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string. + * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers. + * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`. + * If the data received is in JSON format, `serializeContent` converts the JSON to string. + */ +export const serializeContent = (content) => { + const className = content && content.constructor && content.constructor.name; + if (className === "Buffer" || className === "Blob" || className === "File" || className === "FormData" || typeof content === "string") { + return content; + } + if (className === "ArrayBuffer") { + content = Buffer.from(content); + } else if (className === "Int8Array" || className === "Int16Array" || className === "Int32Array" || className === "Uint8Array" || className === "Uint16Array" || className === "Uint32Array" || className === "Uint8ClampedArray" || className === "Float32Array" || className === "Float64Array" || className === "DataView") { + content = Buffer.from(content.buffer); + } else { + try { + content = JSON.stringify(content); + } catch (error) { + throw new Error("Unable to stringify the content"); + } + } + return content; +}; +//# sourceMappingURL=GraphRequestUtil.js.map diff --git a/test/dist/es/src/GraphRequestUtil.js.map b/test/dist/es/src/GraphRequestUtil.js.map new file mode 100644 index 000000000..c86f4a042 --- /dev/null +++ b/test/dist/es/src/GraphRequestUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphRequestUtil.js","sourceRoot":"","sources":["../../../../src/GraphRequestUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEtH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,WAAqB,EAAU,EAAE;IACxD,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MA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,MAAM,CAAC,CAAC;KACtC;SAAM;QACN,IAAI;YACH,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACnD;KACD;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/GraphResponseHandler.d.ts b/test/dist/es/src/GraphResponseHandler.d.ts new file mode 100644 index 000000000..404c8aaa0 --- /dev/null +++ b/test/dist/es/src/GraphResponseHandler.d.ts @@ -0,0 +1,61 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module GraphResponseHandler + */ +import { GraphRequestCallback } from "./IGraphRequestCallback"; +import { ResponseType } from "./ResponseType"; +/** + * @enum + * Enum for document types + * @property {string} TEXT_HTML - The text/html content type + * @property {string} TEXT_XML - The text/xml content type + * @property {string} APPLICATION_XML - The application/xml content type + * @property {string} APPLICATION_XHTML - The application/xhml+xml content type + */ +export declare enum DocumentType { + TEXT_HTML = "text/html", + TEXT_XML = "text/xml", + APPLICATION_XML = "application/xml", + APPLICATION_XHTML = "application/xhtml+xml", +} +/** + * @class + * Class for GraphResponseHandler + */ +export declare class GraphResponseHandler { + /** + * @private + * @static + * To parse Document response + * @param {Response} rawResponse - The response object + * @param {DocumentType} type - The type to which the document needs to be parsed + * @returns A promise that resolves to a document content + */ + private static parseDocumentResponse; + /** + * @private + * @static + * @async + * To convert the native Response to response content + * @param {Response} rawResponse - The response object + * @param {ResponseType} [responseType] - The response type value + * @returns A promise that resolves to the converted response content + */ + private static convertResponse; + /** + * @public + * @static + * @async + * To get the parsed response + * @param {Response} rawResponse - The response object + * @param {ResponseType} [responseType] - The response type value + * @param {GraphRequestCallback} [callback] - The graph request callback function + * @returns The parsed response + */ + static getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise; +} diff --git a/test/dist/es/src/GraphResponseHandler.js b/test/dist/es/src/GraphResponseHandler.js new file mode 100644 index 000000000..f9f0dda4b --- /dev/null +++ b/test/dist/es/src/GraphResponseHandler.js @@ -0,0 +1,188 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { ResponseType } from "./ResponseType"; +/** + * @enum + * Enum for document types + * @property {string} TEXT_HTML - The text/html content type + * @property {string} TEXT_XML - The text/xml content type + * @property {string} APPLICATION_XML - The application/xml content type + * @property {string} APPLICATION_XHTML - The application/xhml+xml content type + */ +export var DocumentType; +(function(DocumentType) { + DocumentType["TEXT_HTML"] = "text/html"; + DocumentType["TEXT_XML"] = "text/xml"; + DocumentType["APPLICATION_XML"] = "application/xml"; + DocumentType["APPLICATION_XHTML"] = "application/xhtml+xml"; +})(DocumentType || (DocumentType = {})); +/** + * @enum + * Enum for Content types + * @property {string} TEXT_PLAIN - The text/plain content type + * @property {string} APPLICATION_JSON - The application/json content type + */ +var ContentType; +(function(ContentType) { + ContentType["TEXT_PLAIN"] = "text/plain"; + ContentType["APPLICATION_JSON"] = "application/json"; +})(ContentType || (ContentType = {})); +/** + * @enum + * Enum for Content type regex + * @property {string} DOCUMENT - The regex to match document content types + * @property {string} IMAGE - The regex to match image content types + */ +var ContentTypeRegexStr; +(function(ContentTypeRegexStr) { + ContentTypeRegexStr["DOCUMENT"] = "^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$"; + ContentTypeRegexStr["IMAGE"] = "^image\\/.+"; +})(ContentTypeRegexStr || (ContentTypeRegexStr = {})); +/** + * @class + * Class for GraphResponseHandler + */ +export class GraphResponseHandler { + /** + * @private + * @static + * To parse Document response + * @param {Response} rawResponse - The response object + * @param {DocumentType} type - The type to which the document needs to be parsed + * @returns A promise that resolves to a document content + */ + static parseDocumentResponse(rawResponse, type) { + try { + if (typeof DOMParser !== "undefined") { + return new Promise((resolve, reject) => { + rawResponse.text().then((xmlString) => { + try { + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlString, type); + resolve(xmlDoc); + } catch (error) { + reject(error); + } + }); + }); + } else { + return Promise.resolve(rawResponse.body); + } + } catch (error) { + throw error; + } + } + /** + * @private + * @static + * @async + * To convert the native Response to response content + * @param {Response} rawResponse - The response object + * @param {ResponseType} [responseType] - The response type value + * @returns A promise that resolves to the converted response content + */ + static convertResponse(rawResponse, responseType) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + if (rawResponse.status === 204) { + // NO CONTENT + return Promise.resolve(); + } + let responseValue; + try { + switch (responseType) { + case ResponseType.ARRAYBUFFER: + responseValue = yield rawResponse.arrayBuffer(); + break; + case ResponseType.BLOB: + responseValue = yield rawResponse.blob(); + break; + case ResponseType.DOCUMENT: + responseValue = yield GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML); + break; + case ResponseType.JSON: + responseValue = yield rawResponse.json(); + break; + case ResponseType.STREAM: + responseValue = yield Promise.resolve(rawResponse.body); + break; + case ResponseType.TEXT: + responseValue = yield rawResponse.text(); + break; + default: + const contentType = rawResponse.headers.get("Content-type"); + if (contentType !== null) { + const mimeType = contentType.split(";")[0]; + if (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) { + responseValue = yield GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType); + } else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) { + responseValue = rawResponse.blob(); + } else if (mimeType === ContentType.TEXT_PLAIN) { + responseValue = yield rawResponse.text(); + } else if (mimeType === ContentType.APPLICATION_JSON) { + responseValue = yield rawResponse.json(); + } else { + responseValue = Promise.resolve(rawResponse.body); + } + } else { + /** + * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says: + * A sender that generates a message containing a payload body SHOULD + * generate a Content-Type header field in that message unless the + * intended media type of the enclosed representation is unknown to the + * sender. If a Content-Type header field is not present, the recipient + * MAY either assume a media type of "application/octet-stream" + * ([RFC2046], Section 4.5.1) or examine the data to determine its type. + * + * So assuming it as a stream type so returning the body. + */ + responseValue = Promise.resolve(rawResponse.body); + } + break; + } + } catch (error) { + throw error; + } + return responseValue; + }); + } + /** + * @public + * @static + * @async + * To get the parsed response + * @param {Response} rawResponse - The response object + * @param {ResponseType} [responseType] - The response type value + * @param {GraphRequestCallback} [callback] - The graph request callback function + * @returns The parsed response + */ + static getResponse(rawResponse, responseType, callback) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + if (responseType === ResponseType.RAW) { + return Promise.resolve(rawResponse); + } else { + const response = yield GraphResponseHandler.convertResponse(rawResponse, responseType); + if (rawResponse.ok) { + // Status Code 2XX + if (typeof callback === "function") { + callback(null, response); + } else { + return response; + } + } else { + // NOT OK Response + throw response; + } + } + } catch (error) { + throw error; + } + }); + } +} +//# sourceMappingURL=GraphResponseHandler.js.map diff --git a/test/dist/es/src/GraphResponseHandler.js.map b/test/dist/es/src/GraphResponseHandler.js.map new file mode 100644 index 000000000..6df3f7cf8 --- /dev/null +++ b/test/dist/es/src/GraphResponseHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphResponseHandler.js","sourceRoot":"","sources":["../../../../src/GraphResponseHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACvB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,mDAAmC,CAAA;IACnC,2DAA2C,CAAA;AAC5C,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;;;;GAKG;AAEH,IAAK,WAGJ;AAHD,WAAK,WAAW;IACf,wCAAyB,CAAA;IACzB,oDAAqC,CAA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C,aAAa,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;6BACzC;iCAAM,IAAI,QAAQ,KAAK,WAAW,CAAC,gBAAgB,EAAE;gCACrD,aAAa,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;6BACzC;iCAAM;gCACN,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;6BAClD;yBACD;6BAAM;4BACN;;;;;;;;;;+BAUG;4BACH,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;yBAClD;wBACD,MAAM;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;YACD,OAAO,aAAa,CAAC;QACtB,CAAC;KAAA;IAED;;;;;;;;;OASG;IACI,MAAM,CAAO,WAAW,CAAC,WAAqB,EAAE,YAA2B,EAAE,QAA+B;;YAClH,IAAI;gBACH,IAAI,YAAY,KAAK,YAAY,CAAC,GAAG,EAAE;oBACtC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;iBACpC;qBAAM;oBACN,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;oBACvF,IAAI,WAAW,CAAC,EAAE,EAAE;wBACnB,kBAAkB;wBAClB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;4BACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;yBACzB;6BAAM;4BACN,OAAO,QAAQ,CAAC;yBAChB;qBACD;yBAAM;wBACN,kBAAkB;wBAClB,MAAM,QAAQ,CAAC;qBACf;iBACD;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/HTTPClient.d.ts b/test/dist/es/src/HTTPClient.d.ts new file mode 100644 index 000000000..86e980968 --- /dev/null +++ b/test/dist/es/src/HTTPClient.d.ts @@ -0,0 +1,54 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module HTTPClient + */ +import { Context } from "./IContext"; +import { Middleware } from "./middleware/IMiddleware"; +/** + * @class + * Class representing HTTPClient + */ +export declare class HTTPClient { + /** + * @private + * A member holding first middleware of the middleware chain + */ + private middleware; + /** + * @public + * @constructor + * Creates an instance of a HTTPClient + * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers + */ + constructor(...middleware: Middleware[]); + /** + * @private + * Processes the middleware parameter passed to set this.middleware property + * The calling function should validate if middleware is not undefined or not empty. + * @param {...Middleware} middleware - The middleware passed + * @returns Nothing + */ + private setMiddleware; + /** + * @private + * Processes the middleware array to construct the chain + * and sets this.middleware property to the first middlware handler of the array + * The calling function should validate if middleware is not undefined or not empty + * @param {Middleware[]} middlewareArray - The array of middleware handlers + * @returns Nothing + */ + private parseMiddleWareArray; + /** + * @public + * @async + * To send the request through the middleware chain + * @param {Context} context - The context of a request + * @returns A promise that resolves to the Context + */ + sendRequest(context: Context): Promise; +} diff --git a/test/dist/es/src/HTTPClient.js b/test/dist/es/src/HTTPClient.js new file mode 100644 index 000000000..92f366437 --- /dev/null +++ b/test/dist/es/src/HTTPClient.js @@ -0,0 +1,82 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * Class representing HTTPClient + */ +export class HTTPClient { + /** + * @public + * @constructor + * Creates an instance of a HTTPClient + * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers + */ + constructor(...middleware) { + if (!middleware || !middleware.length) { + const error = new Error(); + error.name = "InvalidMiddlewareChain"; + error.message = "Please provide a default middleware chain or custom middleware chain"; + throw error; + } + this.setMiddleware(...middleware); + } + /** + * @private + * Processes the middleware parameter passed to set this.middleware property + * The calling function should validate if middleware is not undefined or not empty. + * @param {...Middleware} middleware - The middleware passed + * @returns Nothing + */ + setMiddleware(...middleware) { + if (middleware.length > 1) { + this.parseMiddleWareArray(middleware); + } else { + this.middleware = middleware[0]; + } + } + /** + * @private + * Processes the middleware array to construct the chain + * and sets this.middleware property to the first middlware handler of the array + * The calling function should validate if middleware is not undefined or not empty + * @param {Middleware[]} middlewareArray - The array of middleware handlers + * @returns Nothing + */ + parseMiddleWareArray(middlewareArray) { + middlewareArray.forEach((element, index) => { + if (index < middlewareArray.length - 1) { + element.setNext(middlewareArray[index + 1]); + } + }); + this.middleware = middlewareArray[0]; + } + /** + * @public + * @async + * To send the request through the middleware chain + * @param {Context} context - The context of a request + * @returns A promise that resolves to the Context + */ + sendRequest(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + if (typeof context.request === "string" && context.options === undefined) { + const error = new Error(); + error.name = "InvalidRequestOptions"; + error.message = "Unable to execute the middleware, Please provide valid options for a request"; + throw error; + } + yield this.middleware.execute(context); + return context; + } catch (error) { + throw error; + } + }); + } +} +//# sourceMappingURL=HTTPClient.js.map diff --git a/test/dist/es/src/HTTPClient.js.map b/test/dist/es/src/HTTPClient.js.map new file mode 100644 index 000000000..a19db7a35 --- /dev/null +++ b/test/dist/es/src/HTTPClient.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTTPClient.js","sourceRoot":"","sources":["../../../../src/HTTPClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;GAGG;AACH,MAAM,OAAO,UAAU;IAOtB;;;;;OAKG;IACH,YAAmB,GAAG,UAAwB;QAC7C,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACtC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,GA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;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/HTTPClientFactory.d.ts b/test/dist/es/src/HTTPClientFactory.d.ts new file mode 100644 index 000000000..cd4910ccc --- /dev/null +++ b/test/dist/es/src/HTTPClientFactory.d.ts @@ -0,0 +1,40 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module HTTPClientFactory + */ +import { HTTPClient } from "./HTTPClient"; +import { AuthenticationProvider } from "./IAuthenticationProvider"; +import { Middleware } from "./middleware/IMiddleware"; +/** + * @class + * Class representing HTTPClientFactory + */ +export declare class HTTPClientFactory { + /** + * @public + * @static + * Creates HTTPClient with default middleware chain + * @param {AuthenticationProvider} authProvider - The authentication provider instance + * @returns A HTTPClient instance + * + * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline. + * * HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request + * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag. + * * The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for + * them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same. + */ + static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient; + /** + * @public + * @static + * Creates a middleware chain with the given one + * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers + * @returns A HTTPClient instance + */ + static createWithMiddleware(...middleware: Middleware[]): HTTPClient; +} diff --git a/test/dist/es/src/HTTPClientFactory.js b/test/dist/es/src/HTTPClientFactory.js new file mode 100644 index 000000000..c154df062 --- /dev/null +++ b/test/dist/es/src/HTTPClientFactory.js @@ -0,0 +1,72 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module HTTPClientFactory + */ +import { HTTPClient } from "./HTTPClient"; +import { AuthenticationHandler } from "./middleware/AuthenticationHandler"; +import { HTTPMessageHandler } from "./middleware/HTTPMessageHandler"; +import { RedirectHandlerOptions } from "./middleware/options/RedirectHandlerOptions"; +import { RetryHandlerOptions } from "./middleware/options/RetryHandlerOptions"; +import { RedirectHandler } from "./middleware/RedirectHandler"; +import { RetryHandler } from "./middleware/RetryHandler"; +import { TelemetryHandler } from "./middleware/TelemetryHandler"; +/** + * @private + * To check whether the environment is node or not + * @returns A boolean representing the environment is node or not + */ +const isNodeEnvironment = () => { + return typeof process === "object" && typeof require === "function"; +}; +/** + * @class + * Class representing HTTPClientFactory + */ +export class HTTPClientFactory { + /** + * @public + * @static + * Creates HTTPClient with default middleware chain + * @param {AuthenticationProvider} authProvider - The authentication provider instance + * @returns A HTTPClient instance + * + * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline. + * * HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request + * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag. + * * The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for + * them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same. + */ + static createWithAuthenticationProvider(authProvider) { + const authenticationHandler = new AuthenticationHandler(authProvider); + const retryHandler = new RetryHandler(new RetryHandlerOptions()); + const telemetryHandler = new TelemetryHandler(); + const httpMessageHandler = new HTTPMessageHandler(); + authenticationHandler.setNext(retryHandler); + if (isNodeEnvironment()) { + const redirectHandler = new RedirectHandler(new RedirectHandlerOptions()); + retryHandler.setNext(redirectHandler); + redirectHandler.setNext(telemetryHandler); + } else { + retryHandler.setNext(telemetryHandler); + } + telemetryHandler.setNext(httpMessageHandler); + return HTTPClientFactory.createWithMiddleware(authenticationHandler); + } + /** + * @public + * @static + * Creates a middleware chain with the given one + * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers + * @returns A HTTPClient instance + */ + static createWithMiddleware(...middleware) { + // Middleware should not empty or undefined. This is check is present in the HTTPClient constructor. + return new HTTPClient(...middleware); + } +} +//# sourceMappingURL=HTTPClientFactory.js.map diff --git a/test/dist/es/src/HTTPClientFactory.js.map b/test/dist/es/src/HTTPClientFactory.js.map new file mode 100644 index 000000000..f766d62fe --- /dev/null +++ b/test/dist/es/src/HTTPClientFactory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTTPClientFactory.js","sourceRoot":"","sources":["../../../../src/HTTPClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,GAAY,EAAE;IACvC,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,CAAC;AACrE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC7B;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,gCAAgC,CAAC,YAAoC;QAClF,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAC;QACtE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAChD,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAEpD,qBAAqB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,iBAAiB,EAAE,EAAE;YACxB,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC;YAC1E,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YACtC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;SAC1C;aAAM;YACN,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACvC;QACD,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC7C,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,oBAAoB,CAAC,GAAG,UAAwB;QAC7D,oGAAoG;QACpG,OAAO,IAAI,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;IACtC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthProvider.d.ts b/test/dist/es/src/IAuthProvider.d.ts new file mode 100644 index 000000000..6455c998c --- /dev/null +++ b/test/dist/es/src/IAuthProvider.d.ts @@ -0,0 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { AuthProviderCallback } from "./IAuthProviderCallback"; +/** + * @interface + * Signature that holds authProvider + * @callback - The anonymous callback function which takes a single param + */ +export declare type AuthProvider = (done: AuthProviderCallback) => void; diff --git a/test/dist/es/src/IAuthProvider.js b/test/dist/es/src/IAuthProvider.js new file mode 100644 index 000000000..2ff61ee48 --- /dev/null +++ b/test/dist/es/src/IAuthProvider.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IAuthProvider.js.map diff --git a/test/dist/es/src/IAuthProvider.js.map b/test/dist/es/src/IAuthProvider.js.map new file mode 100644 index 000000000..5f10fae4d --- /dev/null +++ b/test/dist/es/src/IAuthProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IAuthProvider.js","sourceRoot":"","sources":["../../../../src/IAuthProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthProviderCallback.d.ts b/test/dist/es/src/IAuthProviderCallback.d.ts new file mode 100644 index 000000000..8f27ae6fe --- /dev/null +++ b/test/dist/es/src/IAuthProviderCallback.d.ts @@ -0,0 +1,12 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @interface + * Signature that defines callback for an authentication provider + * @callback - The anonymous callback function which takes two params + */ +export declare type AuthProviderCallback = (error: any, accessToken: string | null) => void; diff --git a/test/dist/es/src/IAuthProviderCallback.js b/test/dist/es/src/IAuthProviderCallback.js new file mode 100644 index 000000000..59e35dcd6 --- /dev/null +++ b/test/dist/es/src/IAuthProviderCallback.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IAuthProviderCallback.js.map diff --git a/test/dist/es/src/IAuthProviderCallback.js.map b/test/dist/es/src/IAuthProviderCallback.js.map new file mode 100644 index 000000000..77a7b9efc --- /dev/null +++ b/test/dist/es/src/IAuthProviderCallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IAuthProviderCallback.js","sourceRoot":"","sources":["../../../../src/IAuthProviderCallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthenticationProvider.d.ts b/test/dist/es/src/IAuthenticationProvider.d.ts new file mode 100644 index 000000000..03a2b0f0f --- /dev/null +++ b/test/dist/es/src/IAuthenticationProvider.d.ts @@ -0,0 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; +/** + * @interface + * A signature representing Authentication provider + * @property {Function} getAccessToken - The function to get the access token from the authentication provider + */ +export interface AuthenticationProvider { + /** + * To get access token from the authentication provider + * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance + * @returns A promise that resolves to an access token + */ + getAccessToken: (authenticationProviderOptions?: AuthenticationProviderOptions) => Promise; +} diff --git a/test/dist/es/src/IAuthenticationProvider.js b/test/dist/es/src/IAuthenticationProvider.js new file mode 100644 index 000000000..357ef4cc4 --- /dev/null +++ b/test/dist/es/src/IAuthenticationProvider.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IAuthenticationProvider.js.map diff --git a/test/dist/es/src/IAuthenticationProvider.js.map b/test/dist/es/src/IAuthenticationProvider.js.map new file mode 100644 index 000000000..e5f4518b9 --- /dev/null +++ b/test/dist/es/src/IAuthenticationProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/IAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthenticationProviderOptions.d.ts b/test/dist/es/src/IAuthenticationProviderOptions.d.ts new file mode 100644 index 000000000..d09469347 --- /dev/null +++ b/test/dist/es/src/IAuthenticationProviderOptions.d.ts @@ -0,0 +1,14 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @interface + * A signature represents the Authentication provider options + * @property {string[]} [scopes] - The array of scopes + */ +export interface AuthenticationProviderOptions { + scopes?: string[]; +} diff --git a/test/dist/es/src/IAuthenticationProviderOptions.js b/test/dist/es/src/IAuthenticationProviderOptions.js new file mode 100644 index 000000000..ece3d9c9c --- /dev/null +++ b/test/dist/es/src/IAuthenticationProviderOptions.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IAuthenticationProviderOptions.js.map diff --git a/test/dist/es/src/IAuthenticationProviderOptions.js.map b/test/dist/es/src/IAuthenticationProviderOptions.js.map new file mode 100644 index 000000000..ff80f08a7 --- /dev/null +++ b/test/dist/es/src/IAuthenticationProviderOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../src/IAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IClientOptions.d.ts b/test/dist/es/src/IClientOptions.d.ts new file mode 100644 index 000000000..5b1470070 --- /dev/null +++ b/test/dist/es/src/IClientOptions.d.ts @@ -0,0 +1,27 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { AuthenticationProvider } from "./IAuthenticationProvider"; +import { FetchOptions } from "./IFetchOptions"; +import { Middleware } from "./middleware/IMiddleware"; +/** + * @interface + * Options for initializing the Graph Client + * @property {Function} [authProvider] - The authentication provider instance + * @property {string} [baseUrl] - Base url that needs to be appended to every request + * @property {boolean} [debugLogging] - The boolean to enable/disable debug logging + * @property {string} [defaultVersion] - The default version that needs to be used while making graph api request + * @property {FetchOptions} [fetchOptions] - The options for fetch request + * @property {Middleware| Middleware[]} [middleware] - The first middleware of the middleware chain or an array of the Middleware handlers + */ +export interface ClientOptions { + authProvider?: AuthenticationProvider; + baseUrl?: string; + debugLogging?: boolean; + defaultVersion?: string; + fetchOptions?: FetchOptions; + middleware?: Middleware | Middleware[]; +} diff --git a/test/dist/es/src/IClientOptions.js b/test/dist/es/src/IClientOptions.js new file mode 100644 index 000000000..49e988bbd --- /dev/null +++ b/test/dist/es/src/IClientOptions.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IClientOptions.js.map diff --git a/test/dist/es/src/IClientOptions.js.map b/test/dist/es/src/IClientOptions.js.map new file mode 100644 index 000000000..e0867d978 --- /dev/null +++ b/test/dist/es/src/IClientOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IClientOptions.js","sourceRoot":"","sources":["../../../../src/IClientOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IContext.d.ts b/test/dist/es/src/IContext.d.ts new file mode 100644 index 000000000..aa66332b4 --- /dev/null +++ b/test/dist/es/src/IContext.d.ts @@ -0,0 +1,21 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { FetchOptions } from "./IFetchOptions"; +import { MiddlewareControl } from "./middleware/MiddlewareControl"; +/** + * @interface + * @property {RequestInfo} request - The request url string or the Request instance + * @property {FetchOptions} [options] - The options for the request + * @property {Response} [response] - The response content + * @property {MiddlewareControl} [middlewareControl] - The options for the middleware chain + */ +export interface Context { + request: RequestInfo; + options?: FetchOptions; + response?: Response; + middlewareControl?: MiddlewareControl; +} diff --git a/test/dist/es/src/IContext.js b/test/dist/es/src/IContext.js new file mode 100644 index 000000000..ef5e90a4c --- /dev/null +++ b/test/dist/es/src/IContext.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IContext.js.map diff --git a/test/dist/es/src/IContext.js.map b/test/dist/es/src/IContext.js.map new file mode 100644 index 000000000..1a2142713 --- /dev/null +++ b/test/dist/es/src/IContext.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IContext.js","sourceRoot":"","sources":["../../../../src/IContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IFetchOptions.d.ts b/test/dist/es/src/IFetchOptions.d.ts new file mode 100644 index 000000000..76f54c2df --- /dev/null +++ b/test/dist/es/src/IFetchOptions.d.ts @@ -0,0 +1,29 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @interface {@link https://github.com/bitinn/node-fetch/#options} + * Signature to define the fetch request options for node environment + * @property {number} [follow] - Maximum redirect count. 0 to not follow redirect + * @property {number} [timeout] - Request/Response timeout in milliseconds, it resets on redirect. 0 to disable (OS limit applies) + * @property {number} [compress] - Support gzip/deflate content encoding. false to disable + * @property {number} [size] - Maximum response body size in bytes. 0 to disable + * @property {any} [agent] - HTTP(S).Agent instance, allows custom proxy, certificate, lookup, family etc. + */ +export interface NodeFetchInit { + follow?: number; + timeout?: number; + compress?: boolean; + size?: number; + agent?: any; +} +/** + * @interface + * Signature to define the fetch api options which includes both fetch standard options and also the extended node fetch options + * @extends RequestInit @see {@link https://fetch.spec.whatwg.org/#requestinit} + * @extends NodeFetchInit + */ +export interface FetchOptions extends RequestInit, NodeFetchInit {} diff --git a/test/dist/es/src/IFetchOptions.js b/test/dist/es/src/IFetchOptions.js new file mode 100644 index 000000000..83b13f39f --- /dev/null +++ b/test/dist/es/src/IFetchOptions.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IFetchOptions.js.map diff --git a/test/dist/es/src/IFetchOptions.js.map b/test/dist/es/src/IFetchOptions.js.map new file mode 100644 index 000000000..96bb36791 --- /dev/null +++ b/test/dist/es/src/IFetchOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IFetchOptions.js","sourceRoot":"","sources":["../../../../src/IFetchOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IGraphRequestCallback.d.ts b/test/dist/es/src/IGraphRequestCallback.d.ts new file mode 100644 index 000000000..e48785edb --- /dev/null +++ b/test/dist/es/src/IGraphRequestCallback.d.ts @@ -0,0 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { GraphError } from "./GraphError"; +/** + * @interface + * Signature to define the GraphRequest callback + * @callback - The anonymous callback function + */ +export declare type GraphRequestCallback = (error: GraphError, response: any, rawResponse?: any) => void; diff --git a/test/dist/es/src/IGraphRequestCallback.js b/test/dist/es/src/IGraphRequestCallback.js new file mode 100644 index 000000000..ed6c9c0e3 --- /dev/null +++ b/test/dist/es/src/IGraphRequestCallback.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IGraphRequestCallback.js.map diff --git a/test/dist/es/src/IGraphRequestCallback.js.map b/test/dist/es/src/IGraphRequestCallback.js.map new file mode 100644 index 000000000..1ebf20e4c --- /dev/null +++ b/test/dist/es/src/IGraphRequestCallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IGraphRequestCallback.js","sourceRoot":"","sources":["../../../../src/IGraphRequestCallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IOptions.d.ts b/test/dist/es/src/IOptions.d.ts new file mode 100644 index 000000000..e35597077 --- /dev/null +++ b/test/dist/es/src/IOptions.d.ts @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { AuthProvider } from "./IAuthProvider"; +import { FetchOptions } from "./IFetchOptions"; +/** + * @interface + * Options for initializing the Graph Client + * @property {AuthProvider} authProvider - The function to get the authentication token + * @property {string} [baseUrl] - Base url that needs to be appended to every request + * @property {boolean} [debugLogging] - The boolean to enable/disable debug logging + * @property {string} [defaultVersion] - The default version that needs to be used while making graph api request + * @property {FetchOptions} [fetchOptions] - The options for fetch request + */ +export interface Options { + authProvider: AuthProvider; + baseUrl?: string; + debugLogging?: boolean; + defaultVersion?: string; + fetchOptions?: FetchOptions; +} diff --git a/test/dist/es/src/IOptions.js b/test/dist/es/src/IOptions.js new file mode 100644 index 000000000..dfed1da55 --- /dev/null +++ b/test/dist/es/src/IOptions.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IOptions.js.map diff --git a/test/dist/es/src/IOptions.js.map b/test/dist/es/src/IOptions.js.map new file mode 100644 index 000000000..0d09cac51 --- /dev/null +++ b/test/dist/es/src/IOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IOptions.js","sourceRoot":"","sources":["../../../../src/IOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts b/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts new file mode 100644 index 000000000..d5cd67205 --- /dev/null +++ b/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts @@ -0,0 +1,47 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ImplicitMSALAuthenticationProvider + */ +import { UserAgentApplication } from "msal"; +import { AuthenticationProvider } from "./IAuthenticationProvider"; +import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; +import { MSALAuthenticationProviderOptions } from "./MSALAuthenticationProviderOptions"; +/** + * @class + * Class representing ImplicitMSALAuthenticationProvider + * @extends AuthenticationProvider + */ +export declare class ImplicitMSALAuthenticationProvider implements AuthenticationProvider { + /** + * @private + * A member holding an instance of MSALAuthenticationProviderOptions + */ + private options; + /** + * @private + * A member holding an instance of MSAL UserAgentApplication + */ + private msalApplication; + /** + * @public + * @constructor + * Creates an instance of ImplicitMSALAuthenticationProvider + * @param {UserAgentApplication} msalApplication - An instance of MSAL UserAgentApplication + * @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions + * @returns An instance of ImplicitMSALAuthenticationProvider + */ + constructor(msalApplication: UserAgentApplication, options: MSALAuthenticationProviderOptions); + /** + * @public + * @async + * To get the access token + * @param {AuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object + * @returns The promise that resolves to an access token + */ + getAccessToken(authenticationProviderOptions?: AuthenticationProviderOptions): Promise; +} diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js new file mode 100644 index 000000000..2c3e5ec71 --- /dev/null +++ b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js @@ -0,0 +1,87 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @module ImplicitMSALAuthenticationProvider + */ +import { InteractionRequiredAuthError } from "msal"; +/** + * @class + * Class representing ImplicitMSALAuthenticationProvider + * @extends AuthenticationProvider + */ +export class ImplicitMSALAuthenticationProvider { + /** + * @public + * @constructor + * Creates an instance of ImplicitMSALAuthenticationProvider + * @param {UserAgentApplication} msalApplication - An instance of MSAL UserAgentApplication + * @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions + * @returns An instance of ImplicitMSALAuthenticationProvider + */ + constructor(msalApplication, options) { + this.options = options; + this.msalApplication = msalApplication; + } + /** + * @public + * @async + * To get the access token + * @param {AuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object + * @returns The promise that resolves to an access token + */ + getAccessToken(authenticationProviderOptions) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = authenticationProviderOptions; + let scopes; + if (typeof options !== "undefined") { + scopes = options.scopes; + } + if (typeof scopes === "undefined" || scopes.length === 0) { + scopes = this.options.scopes; + } + if (scopes.length === 0) { + const error = new Error(); + error.name = "EmptyScopes"; + error.message = "Scopes cannot be empty, Please provide a scopes"; + throw error; + } + if (this.msalApplication.getAccount()) { + const tokenRequest = { + scopes, + }; + try { + const authResponse = yield this.msalApplication.acquireTokenSilent(tokenRequest); + return authResponse.accessToken; + } catch (error) { + if (error instanceof InteractionRequiredAuthError) { + try { + const authResponse = yield this.msalApplication.acquireTokenPopup(tokenRequest); + return authResponse.accessToken; + } catch (error) { + throw error; + } + } else { + throw error; + } + } + } else { + try { + const tokenRequest = { + scopes, + }; + yield this.msalApplication.loginPopup(tokenRequest); + const authResponse = yield this.msalApplication.acquireTokenSilent(tokenRequest); + return authResponse.accessToken; + } catch (error) { + throw error; + } + } + }); + } +} +//# sourceMappingURL=ImplicitMSALAuthenticationProvider.js.map diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map new file mode 100644 index 000000000..730c28d5f --- /dev/null +++ b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ImplicitMSALAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/ImplicitMSALAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AAEH,OAAO,EAA0C,4BAA4B,EAAwB,MAAM,MAAM,CAAC;AAMlH;;;;GAIG;AACH,MAAM,OAAO,kCAAkC;IAa9C;;;;;;;OAOG;IACH,YAAmB,eAAqC,EAAE,OAA0C;QACnG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACU,cAAc,CAAC,6BAA6D;;YACxF,MAAM,OAAO,GAAsC,6BAAkE,CAAC;YACtH,IAAI,MAAgB,CAAC;YACrB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;aACxB;YACD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzD,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAC7B;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;gBACxB,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC;gBAC3B,KAAK,CAAC,OAAO,GAAG,iDAAiD,CAAC;gBAClE,MAAM,KAAK,CAAC;aACZ;YACD,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE;gBACtC,MAAM,YAAY,GAA6B;oBAC9C,MAAM;iBACN,CAAC;gBACF,IAAI;oBACH,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;oBAC/F,OAAO,YAAY,CAAC,WAAW,CAAC;iBAChC;gBAAC,OAAO,KAAK,EAAE;oBACf,IAAI,KAAK,YAAY,4BAA4B,EAAE;wBAClD,IAAI;4BACH,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;4BAC9F,OAAO,YAAY,CAAC,WAAW,CAAC;yBAChC;wBAAC,OAAO,KAAK,EAAE;4BACf,MAAM,KAAK,CAAC;yBACZ;qBACD;yBAAM;wBACN,MAAM,KAAK,CAAC;qBACZ;iBACD;aACD;iBAAM;gBACN,IAAI;oBACH,MAAM,YAAY,GAA6B;wBAC9C,MAAM;qBACN,CAAC;oBACF,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;oBACpD,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;oBAC/F,OAAO,YAAY,CAAC,WAAW,CAAC;iBAChC;gBAAC,OAAO,KAAK,EAAE;oBACf,MAAM,KAAK,CAAC;iBACZ;aACD;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts b/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts new file mode 100644 index 000000000..9e919042b --- /dev/null +++ b/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts @@ -0,0 +1,30 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module MSALAuthenticationProviderOptions + */ +import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; +/** + * @class + * @implements AuthenticationProviderOptions + * Class representing MSALAuthenticationProviderOptions + */ +export declare class MSALAuthenticationProviderOptions implements AuthenticationProviderOptions { + /** + * @public + * A member holding array of scopes + */ + scopes: string[]; + /** + * @public + * @constructor + * To create an instance of MSALAuthenticationProviderOptions + * @param {string[]} scopes - An array of scopes + * @returns An instance of MSALAuthenticationProviderOptions + */ + constructor(scopes: string[]); +} diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.js b/test/dist/es/src/MSALAuthenticationProviderOptions.js new file mode 100644 index 000000000..c9234d382 --- /dev/null +++ b/test/dist/es/src/MSALAuthenticationProviderOptions.js @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * @implements AuthenticationProviderOptions + * Class representing MSALAuthenticationProviderOptions + */ +export class MSALAuthenticationProviderOptions { + /** + * @public + * @constructor + * To create an instance of MSALAuthenticationProviderOptions + * @param {string[]} scopes - An array of scopes + * @returns An instance of MSALAuthenticationProviderOptions + */ + constructor(scopes) { + this.scopes = scopes; + } +} +//# sourceMappingURL=MSALAuthenticationProviderOptions.js.map diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.js.map b/test/dist/es/src/MSALAuthenticationProviderOptions.js.map new file mode 100644 index 000000000..dee7f63dc --- /dev/null +++ b/test/dist/es/src/MSALAuthenticationProviderOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MSALAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../src/MSALAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;GAIG;AACH,MAAM,OAAO,iCAAiC;IAO7C;;;;;;OAMG;IACH,YAAmB,MAAgB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/Range.d.ts b/test/dist/es/src/Range.d.ts new file mode 100644 index 000000000..c3ae2503d --- /dev/null +++ b/test/dist/es/src/Range.d.ts @@ -0,0 +1,34 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Range + */ +/** + * @class + * Class representing Range + */ +export declare class Range { + /** + * @public + * The minimum value of the range + */ + minValue: number; + /** + * @public + * The maximum value of the range + */ + maxValue: number; + /** + * @public + * @constructor + * Creates a range for given min and max values + * @param {number} [minVal = -1] - The minimum value. + * @param {number} [maxVal = -1] - The maximum value. + * @returns An instance of a Range + */ + constructor(minVal?: number, maxVal?: number); +} diff --git a/test/dist/es/src/Range.js b/test/dist/es/src/Range.js new file mode 100644 index 000000000..91ef71bfa --- /dev/null +++ b/test/dist/es/src/Range.js @@ -0,0 +1,28 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Range + */ +/** + * @class + * Class representing Range + */ +export class Range { + /** + * @public + * @constructor + * Creates a range for given min and max values + * @param {number} [minVal = -1] - The minimum value. + * @param {number} [maxVal = -1] - The maximum value. + * @returns An instance of a Range + */ + constructor(minVal = -1, maxVal = -1) { + this.minValue = minVal; + this.maxValue = maxVal; + } +} +//# sourceMappingURL=Range.js.map diff --git a/test/dist/es/src/Range.js.map b/test/dist/es/src/Range.js.map new file mode 100644 index 000000000..543c667bf --- /dev/null +++ b/test/dist/es/src/Range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../../src/Range.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,OAAO,KAAK;IAajB;;;;;;;OAOG;IACH,YAAmB,SAAiB,CAAC,CAAC,EAAE,SAAiB,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;IACxB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/RequestMethod.d.ts b/test/dist/es/src/RequestMethod.d.ts new file mode 100644 index 000000000..dfd7cf9ba --- /dev/null +++ b/test/dist/es/src/RequestMethod.d.ts @@ -0,0 +1,22 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @enum + * Enum for RequestMethods + * @property {string} GET - The get request type + * @property {string} PATCH - The patch request type + * @property {string} POST - The post request type + * @property {string} PUT - The put request type + * @property {string} DELETE - The delete request type + */ +export declare enum RequestMethod { + GET = "GET", + PATCH = "PATCH", + POST = "POST", + PUT = "PUT", + DELETE = "DELETE", +} diff --git a/test/dist/es/src/RequestMethod.js b/test/dist/es/src/RequestMethod.js new file mode 100644 index 000000000..c29fd8f05 --- /dev/null +++ b/test/dist/es/src/RequestMethod.js @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @enum + * Enum for RequestMethods + * @property {string} GET - The get request type + * @property {string} PATCH - The patch request type + * @property {string} POST - The post request type + * @property {string} PUT - The put request type + * @property {string} DELETE - The delete request type + */ +export var RequestMethod; +(function(RequestMethod) { + RequestMethod["GET"] = "GET"; + RequestMethod["PATCH"] = "PATCH"; + RequestMethod["POST"] = "POST"; + RequestMethod["PUT"] = "PUT"; + RequestMethod["DELETE"] = "DELETE"; +})(RequestMethod || (RequestMethod = {})); +//# sourceMappingURL=RequestMethod.js.map diff --git a/test/dist/es/src/RequestMethod.js.map b/test/dist/es/src/RequestMethod.js.map new file mode 100644 index 000000000..9d6fa9df1 --- /dev/null +++ b/test/dist/es/src/RequestMethod.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RequestMethod.js","sourceRoot":"","sources":["../../../../src/RequestMethod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACxB,4BAAW,CAAA;IACX,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,4BAAW,CAAA;IACX,kCAAiB,CAAA;AAClB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB"} \ No newline at end of file diff --git a/test/dist/es/src/ResponseType.d.ts b/test/dist/es/src/ResponseType.d.ts new file mode 100644 index 000000000..53a9050c4 --- /dev/null +++ b/test/dist/es/src/ResponseType.d.ts @@ -0,0 +1,25 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @enum + * Enum for ResponseType values + * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer} + * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob} + * @property {string} DOCUMENT - This downloads content as a document or stream + * @property {string} JSON - To download response content as a json + * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html} + * @property {string} TEXT - For downloading response as a text + */ +export declare enum ResponseType { + ARRAYBUFFER = "arraybuffer", + BLOB = "blob", + DOCUMENT = "document", + JSON = "json", + RAW = "raw", + STREAM = "stream", + TEXT = "text", +} diff --git a/test/dist/es/src/ResponseType.js b/test/dist/es/src/ResponseType.js new file mode 100644 index 000000000..4b1b5e630 --- /dev/null +++ b/test/dist/es/src/ResponseType.js @@ -0,0 +1,27 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @enum + * Enum for ResponseType values + * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer} + * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob} + * @property {string} DOCUMENT - This downloads content as a document or stream + * @property {string} JSON - To download response content as a json + * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html} + * @property {string} TEXT - For downloading response as a text + */ +export var ResponseType; +(function(ResponseType) { + ResponseType["ARRAYBUFFER"] = "arraybuffer"; + ResponseType["BLOB"] = "blob"; + ResponseType["DOCUMENT"] = "document"; + ResponseType["JSON"] = "json"; + ResponseType["RAW"] = "raw"; + ResponseType["STREAM"] = "stream"; + ResponseType["TEXT"] = "text"; +})(ResponseType || (ResponseType = {})); +//# sourceMappingURL=ResponseType.js.map diff --git a/test/dist/es/src/ResponseType.js.map b/test/dist/es/src/ResponseType.js.map new file mode 100644 index 000000000..c1cef8465 --- /dev/null +++ b/test/dist/es/src/ResponseType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ResponseType.js","sourceRoot":"","sources":["../../../../src/ResponseType.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACvB,2CAA2B,CAAA;IAC3B,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,6BAAa,CAAA;IACb,2BAAW,CAAA;IACX,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACd,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB"} \ No newline at end of file diff --git a/test/dist/es/src/ValidatePolyFilling.d.ts b/test/dist/es/src/ValidatePolyFilling.d.ts new file mode 100644 index 000000000..cdeb15a3b --- /dev/null +++ b/test/dist/es/src/ValidatePolyFilling.d.ts @@ -0,0 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @constant + * @function + * Validates availability of Promise and fetch in global context + * @returns The true in case the Promise and fetch available, otherwise throws error + */ +export declare const validatePolyFilling: () => boolean; diff --git a/test/dist/es/src/ValidatePolyFilling.js b/test/dist/es/src/ValidatePolyFilling.js new file mode 100644 index 000000000..e3ec4b463 --- /dev/null +++ b/test/dist/es/src/ValidatePolyFilling.js @@ -0,0 +1,29 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @constant + * @function + * Validates availability of Promise and fetch in global context + * @returns The true in case the Promise and fetch available, otherwise throws error + */ +export const validatePolyFilling = () => { + if (typeof Promise === "undefined" && typeof fetch === "undefined") { + const error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them."); + error.name = "PolyFillNotAvailable"; + throw error; + } else if (typeof Promise === "undefined") { + const error = new Error("Library cannot function without Promise. So, please provide polyfill for it."); + error.name = "PolyFillNotAvailable"; + throw error; + } else if (typeof fetch === "undefined") { + const error = new Error("Library cannot function without fetch. So, please provide polyfill for it."); + error.name = "PolyFillNotAvailable"; + throw error; + } + return true; +}; +//# sourceMappingURL=ValidatePolyFilling.js.map diff --git a/test/dist/es/src/ValidatePolyFilling.js.map b/test/dist/es/src/ValidatePolyFilling.js.map new file mode 100644 index 000000000..7b706676a --- /dev/null +++ b/test/dist/es/src/ValidatePolyFilling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ValidatePolyFilling.js","sourceRoot":"","sources":["../../../../src/ValidatePolyFilling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAY,EAAE;IAChD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACnE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;QACpH,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;SAAM,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAC1C,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QACxG,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACxC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QACtG,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/Version.d.ts b/test/dist/es/src/Version.d.ts new file mode 100644 index 000000000..a496a98b1 --- /dev/null +++ b/test/dist/es/src/Version.d.ts @@ -0,0 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module Version + */ +export declare const PACKAGE_VERSION = "2.1.0-Preview.2"; diff --git a/test/dist/es/src/Version.js b/test/dist/es/src/Version.js new file mode 100644 index 000000000..073470dff --- /dev/null +++ b/test/dist/es/src/Version.js @@ -0,0 +1,13 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +// THIS FILE IS AUTO GENERATED +// ANY CHANGES WILL BE LOST DURING BUILD +/** + * @module Version + */ +export const PACKAGE_VERSION = "2.1.0-Preview.2"; +//# sourceMappingURL=Version.js.map diff --git a/test/dist/es/src/Version.js.map b/test/dist/es/src/Version.js.map new file mode 100644 index 000000000..7fa736388 --- /dev/null +++ b/test/dist/es/src/Version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../../../src/Version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8BAA8B;AAC9B,wCAAwC;AAExC;;GAEG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/content/BatchRequestContent.d.ts b/test/dist/es/src/content/BatchRequestContent.d.ts new file mode 100644 index 000000000..9cea5d057 --- /dev/null +++ b/test/dist/es/src/content/BatchRequestContent.d.ts @@ -0,0 +1,144 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @interface + * Signature representing BatchRequestStep data + * @property {string} id - Unique identity for the request, Should not be an empty string + * @property {string[]} [dependsOn] - Array of dependencies + * @property {Request} request - The Request object + */ +export interface BatchRequestStep { + id: string; + dependsOn?: string[]; + request: Request; +} +/** + * @interface + * Signature representing single request in a Batching + * @extends RequestInit + * @see {@link https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L1337} and {@link https://fetch.spec.whatwg.org/#requestinit} + * + * @property {string} url - The url value of the request + */ +export interface RequestData extends RequestInit { + url: string; +} +/** + * @interface + * Signature representing batch request data + * @property {string} id - Unique identity for the request, Should not be an empty string + * @property {string[]} [dependsOn] - Array of dependencies + */ +export interface BatchRequestData extends RequestData { + id: string; + dependsOn?: string[]; +} +/** + * @interface + * Signature representing batch request body + * @property {BatchRequestData[]} requests - Array of request data, a json representation of requests for batch + */ +export interface BatchRequestBody { + requests: BatchRequestData[]; +} +/** + * @class + * Class for handling BatchRequestContent + */ +export declare class BatchRequestContent { + /** + * @private + * @static + * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} + */ + private static requestLimit; + /** + * @public + * To keep track of requests, key will be id of the request and value will be the request json + */ + requests: Map; + /** + * @private + * @static + * Validates the dependency chain of the requests + * + * Note: + * Individual requests can depend on other individual requests. Currently, requests can only depend on a single other request, and must follow one of these three patterns: + * 1. Parallel - no individual request states a dependency in the dependsOn property. + * 2. Serial - all individual requests depend on the previous individual request. + * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency. + * As JSON batching matures, these limitations will be removed. + * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} + * + * @param {Map} requests - The map of requests. + * @returns The boolean indicating the validation status + */ + private static validateDependencies; + /** + * @private + * @static + * @async + * Converts Request Object instance to a JSON + * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance + * @returns A promise that resolves to JSON representation of a request + */ + private static getRequestData; + /** + * @private + * @static + * @async + * Gets the body of a Request object instance + * @param {IsomorphicRequest} request - The IsomorphicRequest object instance + * @returns The Promise that resolves to a body value of a Request + */ + private static getRequestBody; + /** + * @public + * @constructor + * Constructs a BatchRequestContent instance + * @param {BatchRequestStep[]} [requests] - Array of requests value + * @returns An instance of a BatchRequestContent + */ + constructor(requests?: BatchRequestStep[]); + /** + * @public + * Adds a request to the batch request content + * @param {BatchRequestStep} request - The request value + * @returns The id of the added request + */ + addRequest(request: BatchRequestStep): string; + /** + * @public + * Removes request from the batch payload and its dependencies from all dependents + * @param {string} requestId - The id of a request that needs to be removed + * @returns The boolean indicating removed status + */ + removeRequest(requestId: string): boolean; + /** + * @public + * @async + * Serialize content from BatchRequestContent instance + * @returns The body content to make batch request + */ + getContent(): Promise; + /** + * @public + * Adds a dependency for a given dependent request + * @param {string} dependentId - The id of the dependent request + * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency + * @returns Nothing + */ + addDependency(dependentId: string, dependencyId?: string): void; + /** + * @public + * Removes a dependency for a given dependent request id + * @param {string} dependentId - The id of the dependent request + * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request + * @returns The boolean indicating removed status + */ + removeDependency(dependentId: string, dependencyId?: string): boolean; +} diff --git a/test/dist/es/src/content/BatchRequestContent.js b/test/dist/es/src/content/BatchRequestContent.js new file mode 100644 index 000000000..760d2fee5 --- /dev/null +++ b/test/dist/es/src/content/BatchRequestContent.js @@ -0,0 +1,410 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @module BatchRequestContent + */ +import { RequestMethod } from "../RequestMethod"; +/** + * @class + * Class for handling BatchRequestContent + */ +export class BatchRequestContent { + /** + * @public + * @constructor + * Constructs a BatchRequestContent instance + * @param {BatchRequestStep[]} [requests] - Array of requests value + * @returns An instance of a BatchRequestContent + */ + constructor(requests) { + this.requests = new Map(); + if (typeof requests !== "undefined") { + const limit = BatchRequestContent.requestLimit; + if (requests.length > limit) { + const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`); + error.name = "Limit Exceeded Error"; + throw error; + } + for (const req of requests) { + this.addRequest(req); + } + } + } + /** + * @private + * @static + * Validates the dependency chain of the requests + * + * Note: + * Individual requests can depend on other individual requests. Currently, requests can only depend on a single other request, and must follow one of these three patterns: + * 1. Parallel - no individual request states a dependency in the dependsOn property. + * 2. Serial - all individual requests depend on the previous individual request. + * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency. + * As JSON batching matures, these limitations will be removed. + * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} + * + * @param {Map} requests - The map of requests. + * @returns The boolean indicating the validation status + */ + static validateDependencies(requests) { + const isParallel = (reqs) => { + const iterator = reqs.entries(); + let cur = iterator.next(); + while (!cur.done) { + const curReq = cur.value[1]; + if (curReq.dependsOn !== undefined && curReq.dependsOn.length > 0) { + return false; + } + cur = iterator.next(); + } + return true; + }; + const isSerial = (reqs) => { + const iterator = reqs.entries(); + let cur = iterator.next(); + const firstRequest = cur.value[1]; + if (firstRequest.dependsOn !== undefined && firstRequest.dependsOn.length > 0) { + return false; + } + let prev = cur; + cur = iterator.next(); + while (!cur.done) { + const curReq = cur.value[1]; + if (curReq.dependsOn === undefined || curReq.dependsOn.length !== 1 || curReq.dependsOn[0] !== prev.value[1].id) { + return false; + } + prev = cur; + cur = iterator.next(); + } + return true; + }; + const isSame = (reqs) => { + const iterator = reqs.entries(); + let cur = iterator.next(); + const firstRequest = cur.value[1]; + let dependencyId; + if (firstRequest.dependsOn === undefined || firstRequest.dependsOn.length === 0) { + dependencyId = firstRequest.id; + } else { + if (firstRequest.dependsOn.length === 1) { + const fDependencyId = firstRequest.dependsOn[0]; + if (fDependencyId !== firstRequest.id && reqs.has(fDependencyId)) { + dependencyId = fDependencyId; + } else { + return false; + } + } else { + return false; + } + } + cur = iterator.next(); + while (!cur.done) { + const curReq = cur.value[1]; + if ((curReq.dependsOn === undefined || curReq.dependsOn.length === 0) && dependencyId !== curReq.id) { + return false; + } + if (curReq.dependsOn !== undefined && curReq.dependsOn.length !== 0) { + if (curReq.dependsOn.length === 1 && (curReq.id === dependencyId || curReq.dependsOn[0] !== dependencyId)) { + return false; + } + if (curReq.dependsOn.length > 1) { + return false; + } + } + cur = iterator.next(); + } + return true; + }; + if (requests.size === 0) { + const error = new Error("Empty requests map, Please provide at least one request."); + error.name = "Empty Requests Error"; + throw error; + } + return isParallel(requests) || isSerial(requests) || isSame(requests); + } + /** + * @private + * @static + * @async + * Converts Request Object instance to a JSON + * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance + * @returns A promise that resolves to JSON representation of a request + */ + static getRequestData(request) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const requestData = { + url: "", + }; + const hasHttpRegex = new RegExp("^https?://"); + // Stripping off hostname, port and url scheme + requestData.url = hasHttpRegex.test(request.url) ? "/" + request.url.split(/.*?\/\/.*?\//)[1] : request.url; + requestData.method = request.method; + const headers = {}; + request.headers.forEach((value, key) => { + headers[key] = value; + }); + if (Object.keys(headers).length) { + requestData.headers = headers; + } + if (request.method === RequestMethod.PATCH || request.method === RequestMethod.POST || request.method === RequestMethod.PUT) { + requestData.body = yield BatchRequestContent.getRequestBody(request); + } + /** + * TODO: Check any other property needs to be used from the Request object and add them + */ + return requestData; + }); + } + /** + * @private + * @static + * @async + * Gets the body of a Request object instance + * @param {IsomorphicRequest} request - The IsomorphicRequest object instance + * @returns The Promise that resolves to a body value of a Request + */ + static getRequestBody(request) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + let bodyParsed = false; + let body; + try { + const cloneReq = request.clone(); + body = yield cloneReq.json(); + bodyParsed = true; + } catch (e) { + // tslint:disable-line: no-empty + } + if (!bodyParsed) { + try { + if (typeof Blob !== "undefined") { + const blob = yield request.blob(); + const reader = new FileReader(); + body = yield new Promise((resolve) => { + reader.addEventListener( + "load", + () => { + const dataURL = reader.result; + /** + * Some valid dataURL schemes: + * 1. data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh + * 2. data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678 + * 3. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== + * 4. data:image/png,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== + * 5. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== + * @see Syntax {@link https://en.wikipedia.org/wiki/Data_URI_scheme} for more + */ + const regex = new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$"); + const segments = regex.exec(dataURL); + resolve(segments[4]); + }, + false, + ); + reader.readAsDataURL(blob); + }); + } else if (typeof Buffer !== "undefined") { + const buffer = yield request.buffer(); + body = buffer.toString("base64"); + } + bodyParsed = true; + } catch (e) { + // tslint:disable-line: no-empty + } + } + return body; + }); + } + /** + * @public + * Adds a request to the batch request content + * @param {BatchRequestStep} request - The request value + * @returns The id of the added request + */ + addRequest(request) { + const limit = BatchRequestContent.requestLimit; + if (request.id === "") { + const error = new Error(`Id for a request is empty, Please provide an unique id`); + error.name = "Empty Id For Request"; + throw error; + } + if (this.requests.size === limit) { + const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`); + error.name = "Limit Exceeded Error"; + throw error; + } + if (this.requests.has(request.id)) { + const error = new Error(`Adding request with duplicate id ${request.id}, Make the id of the requests unique`); + error.name = "Duplicate RequestId Error"; + throw error; + } + this.requests.set(request.id, request); + return request.id; + } + /** + * @public + * Removes request from the batch payload and its dependencies from all dependents + * @param {string} requestId - The id of a request that needs to be removed + * @returns The boolean indicating removed status + */ + removeRequest(requestId) { + const deleteStatus = this.requests.delete(requestId); + const iterator = this.requests.entries(); + let cur = iterator.next(); + /** + * Removing dependencies where this request is present as a dependency + */ + while (!cur.done) { + const dependencies = cur.value[1].dependsOn; + if (typeof dependencies !== "undefined") { + const index = dependencies.indexOf(requestId); + if (index !== -1) { + dependencies.splice(index, 1); + } + if (dependencies.length === 0) { + delete cur.value[1].dependsOn; + } + } + cur = iterator.next(); + } + return deleteStatus; + } + /** + * @public + * @async + * Serialize content from BatchRequestContent instance + * @returns The body content to make batch request + */ + getContent() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const requests = []; + const requestBody = { + requests, + }; + const iterator = this.requests.entries(); + let cur = iterator.next(); + if (cur.done) { + const error = new Error("No requests added yet, Please add at least one request."); + error.name = "Empty Payload"; + throw error; + } + if (!BatchRequestContent.validateDependencies(this.requests)) { + const error = new Error(`Invalid dependency found, Dependency should be: +1. Parallel - no individual request states a dependency in the dependsOn property. +2. Serial - all individual requests depend on the previous individual request. +3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.`); + error.name = "Invalid Dependency"; + throw error; + } + while (!cur.done) { + const requestStep = cur.value[1]; + const batchRequestData = yield BatchRequestContent.getRequestData(requestStep.request); + /** + * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format} + */ + if (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers["content-type"] === undefined)) { + const error = new Error(`Content-type header is not mentioned for request #${requestStep.id}, For request having body, Content-type header should be mentioned`); + error.name = "Invalid Content-type header"; + throw error; + } + batchRequestData.id = requestStep.id; + if (requestStep.dependsOn !== undefined && requestStep.dependsOn.length > 0) { + batchRequestData.dependsOn = requestStep.dependsOn; + } + requests.push(batchRequestData); + cur = iterator.next(); + } + requestBody.requests = requests; + return requestBody; + }); + } + /** + * @public + * Adds a dependency for a given dependent request + * @param {string} dependentId - The id of the dependent request + * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency + * @returns Nothing + */ + addDependency(dependentId, dependencyId) { + if (!this.requests.has(dependentId)) { + const error = new Error(`Dependent ${dependentId} does not exists, Please check the id`); + error.name = "Invalid Dependent"; + throw error; + } + if (typeof dependencyId !== "undefined" && !this.requests.has(dependencyId)) { + const error = new Error(`Dependency ${dependencyId} does not exists, Please check the id`); + error.name = "Invalid Dependency"; + throw error; + } + if (typeof dependencyId !== "undefined") { + const dependent = this.requests.get(dependentId); + if (dependent.dependsOn === undefined) { + dependent.dependsOn = []; + } + if (dependent.dependsOn.indexOf(dependencyId) !== -1) { + const error = new Error(`Dependency ${dependencyId} is already added for the request ${dependentId}`); + error.name = "Duplicate Dependency"; + throw error; + } + dependent.dependsOn.push(dependencyId); + } else { + const iterator = this.requests.entries(); + let prev; + let cur = iterator.next(); + while (!cur.done && cur.value[1].id !== dependentId) { + prev = cur; + cur = iterator.next(); + } + if (typeof prev !== "undefined") { + const dId = prev.value[0]; + if (cur.value[1].dependsOn === undefined) { + cur.value[1].dependsOn = []; + } + if (cur.value[1].dependsOn.indexOf(dId) !== -1) { + const error = new Error(`Dependency ${dId} is already added for the request ${dependentId}`); + error.name = "Duplicate Dependency"; + throw error; + } + cur.value[1].dependsOn.push(dId); + } else { + const error = new Error(`Can't add dependency ${dependencyId}, There is only a dependent request in the batch`); + error.name = "Invalid Dependency Addition"; + throw error; + } + } + } + /** + * @public + * Removes a dependency for a given dependent request id + * @param {string} dependentId - The id of the dependent request + * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request + * @returns The boolean indicating removed status + */ + removeDependency(dependentId, dependencyId) { + const request = this.requests.get(dependentId); + if (typeof request === "undefined" || request.dependsOn === undefined || request.dependsOn.length === 0) { + return false; + } + if (typeof dependencyId !== "undefined") { + const index = request.dependsOn.indexOf(dependencyId); + if (index === -1) { + return false; + } + request.dependsOn.splice(index, 1); + return true; + } else { + delete request.dependsOn; + return true; + } + } +} +/** + * @private + * @static + * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} + */ +BatchRequestContent.requestLimit = 20; +//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/src/content/BatchRequestContent.js.map b/test/dist/es/src/content/BatchRequestContent.js.map new file mode 100644 index 000000000..fbcbc65d8 --- /dev/null +++ b/test/dist/es/src/content/BatchRequestContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchRequestContent.js","sourceRoot":"","sources":["../../../../../src/content/BatchRequestContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,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ACD,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;SACZ;aAAM;YACN,OAAO,OAAO,CAAC,SAAS,CAAC;YACzB,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;;AAjZD;;;;GAIG;AACY,gCAAY,GAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/content/BatchResponseContent.d.ts b/test/dist/es/src/content/BatchResponseContent.d.ts new file mode 100644 index 000000000..143851052 --- /dev/null +++ b/test/dist/es/src/content/BatchResponseContent.d.ts @@ -0,0 +1,82 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module BatchResponseContent + */ +/** + * @interface + * Signature represents key value pair object + */ +interface KeyValuePairObject { + [key: string]: any; +} +/** + * @interface + * Signature representing Batch response body + * @property {KeyValuePairObject[]} responses - An array of key value pair representing response object for every request + * @property {string} [@odata.nextLink] - The nextLink value to get next set of responses in case of asynchronous batch requests + */ +interface BatchResponseBody { + responses: KeyValuePairObject[]; + "@odata.nextLink"?: string; +} +/** + * @class + * Class that handles BatchResponseContent + */ +export declare class BatchResponseContent { + /** + * To hold the responses + */ + private responses; + /** + * Holds the next link url + */ + private nextLink; + /** + * @public + * @constructor + * Creates the BatchResponseContent instance + * @param {BatchResponseBody} response - The response body returned for batch request from server + * @returns An instance of a BatchResponseContent + */ + constructor(response: BatchResponseBody); + /** + * @private + * Creates native Response object from the json representation of it. + * @param {KeyValuePairObject} responseJSON - The response json value + * @returns The Response Object instance + */ + private createResponseObject; + /** + * @public + * Updates the Batch response content instance with given responses. + * @param {BatchResponseBody} response - The response json representing batch response message + * @returns Nothing + */ + update(response: BatchResponseBody): void; + /** + * @public + * To get the response of a request for a given request id + * @param {string} requestId - The request id value + * @returns The Response object instance for the particular request + */ + getResponseById(requestId: string): Response; + /** + * @public + * To get all the responses of the batch request + * @returns The Map of id and Response objects + */ + getResponses(): Map; + /** + * @public + * To get the iterator for the responses + * @returns The Iterable generator for the response objects + */ + getResponsesIterator(): IterableIterator<[string, Response]>; +} +export {}; diff --git a/test/dist/es/src/content/BatchResponseContent.js b/test/dist/es/src/content/BatchResponseContent.js new file mode 100644 index 000000000..c16517c3f --- /dev/null +++ b/test/dist/es/src/content/BatchResponseContent.js @@ -0,0 +1,89 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * Class that handles BatchResponseContent + */ +export class BatchResponseContent { + /** + * @public + * @constructor + * Creates the BatchResponseContent instance + * @param {BatchResponseBody} response - The response body returned for batch request from server + * @returns An instance of a BatchResponseContent + */ + constructor(response) { + this.responses = new Map(); + this.update(response); + } + /** + * @private + * Creates native Response object from the json representation of it. + * @param {KeyValuePairObject} responseJSON - The response json value + * @returns The Response Object instance + */ + createResponseObject(responseJSON) { + const body = responseJSON.body; + const options = {}; + options.status = responseJSON.status; + if (responseJSON.statusText !== undefined) { + options.statusText = responseJSON.statusText; + } + options.headers = responseJSON.headers; + if (options.headers !== undefined && options.headers["Content-Type"] !== undefined) { + if (options.headers["Content-Type"].split(";")[0] === "application/json") { + const bodyString = JSON.stringify(body); + return new Response(bodyString, options); + } + } + return new Response(body, options); + } + /** + * @public + * Updates the Batch response content instance with given responses. + * @param {BatchResponseBody} response - The response json representing batch response message + * @returns Nothing + */ + update(response) { + this.nextLink = response["@odata.nextLink"]; + const responses = response.responses; + for (let i = 0, l = responses.length; i < l; i++) { + this.responses.set(responses[i].id, this.createResponseObject(responses[i])); + } + } + /** + * @public + * To get the response of a request for a given request id + * @param {string} requestId - The request id value + * @returns The Response object instance for the particular request + */ + getResponseById(requestId) { + return this.responses.get(requestId); + } + /** + * @public + * To get all the responses of the batch request + * @returns The Map of id and Response objects + */ + getResponses() { + return this.responses; + } + /** + * @public + * To get the iterator for the responses + * @returns The Iterable generator for the response objects + */ + *getResponsesIterator() { + const iterator = this.responses.entries(); + let cur = iterator.next(); + while (!cur.done) { + yield cur.value; + cur = iterator.next(); + } + } +} +//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/src/content/BatchResponseContent.js.map b/test/dist/es/src/content/BatchResponseContent.js.map new file mode 100644 index 000000000..ced2c98e9 --- /dev/null +++ b/test/dist/es/src/content/BatchResponseContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../src/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAWhC;;;;;;OAMG;IACH,YAAmB,QAA2B;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACK,oBAAoB,CAAC,YAAgC;QAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAC/B,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QACrC,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;YAC1C,OAAO,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;SAC7C;QACD,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE;YACnF,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,kBAAkB,EAAE;gBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACxC,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;aACzC;SACD;QACD,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAA2B;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YACjD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC7E;IACF,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,SAAiB;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,CAAC,oBAAoB;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE;YACjB,MAAM,GAAG,CAAC,KAAK,CAAC;YAChB,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;SACtB;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/index.d.ts b/test/dist/es/src/index.d.ts new file mode 100644 index 000000000..759a5bfc2 --- /dev/null +++ b/test/dist/es/src/index.d.ts @@ -0,0 +1,42 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export * from "./content/BatchRequestContent"; +export * from "./content/BatchResponseContent"; +export * from "./middleware/AuthenticationHandler"; +export * from "./middleware/HTTPMessageHandler"; +export * from "./middleware/IMiddleware"; +export * from "./middleware/RetryHandler"; +export * from "./middleware/RedirectHandler"; +export * from "./middleware/TelemetryHandler"; +export * from "./middleware/MiddlewareFactory"; +export * from "./middleware/options/AuthenticationHandlerOptions"; +export * from "./middleware/options/IMiddlewareOptions"; +export * from "./middleware/options/RetryHandlerOptions"; +export * from "./middleware/options/RedirectHandlerOptions"; +export * from "./middleware/options/TelemetryHandlerOptions"; +export * from "./middleware/options/ChaosHandlerOptions"; +export * from "./middleware/options/ChaosStrategy"; +export * from "./middleware/ChaosHandler"; +export * from "./tasks/LargeFileUploadTask"; +export * from "./tasks/OneDriveLargeFileUploadTask"; +export * from "./tasks/PageIterator"; +export * from "./Client"; +export * from "./CustomAuthenticationProvider"; +export * from "./GraphError"; +export * from "./GraphRequest"; +export * from "./IAuthProvider"; +export * from "./IAuthenticationProvider"; +export * from "./IAuthenticationProviderOptions"; +export * from "./IAuthProviderCallback"; +export * from "./IClientOptions"; +export * from "./IContext"; +export * from "./IFetchOptions"; +export * from "./IGraphRequestCallback"; +export * from "./ImplicitMSALAuthenticationProvider"; +export * from "./IOptions"; +export * from "./MSALAuthenticationProviderOptions"; +export * from "./ResponseType"; diff --git a/test/dist/es/src/index.js b/test/dist/es/src/index.js new file mode 100644 index 000000000..04556ba60 --- /dev/null +++ b/test/dist/es/src/index.js @@ -0,0 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export * from "./content/BatchRequestContent"; +export * from "./content/BatchResponseContent"; +export * from "./middleware/AuthenticationHandler"; +export * from "./middleware/HTTPMessageHandler"; +export * from "./middleware/RetryHandler"; +export * from "./middleware/RedirectHandler"; +export * from "./middleware/TelemetryHandler"; +export * from "./middleware/MiddlewareFactory"; +export * from "./middleware/options/AuthenticationHandlerOptions"; +export * from "./middleware/options/RetryHandlerOptions"; +export * from "./middleware/options/RedirectHandlerOptions"; +export * from "./middleware/options/TelemetryHandlerOptions"; +export * from "./middleware/options/ChaosHandlerOptions"; +export * from "./middleware/options/ChaosStrategy"; +export * from "./middleware/ChaosHandler"; +export * from "./tasks/LargeFileUploadTask"; +export * from "./tasks/OneDriveLargeFileUploadTask"; +export * from "./tasks/PageIterator"; +export * from "./Client"; +export * from "./CustomAuthenticationProvider"; +export * from "./GraphError"; +export * from "./GraphRequest"; +export * from "./ImplicitMSALAuthenticationProvider"; +export * from "./MSALAuthenticationProviderOptions"; +export * from "./ResponseType"; +//# sourceMappingURL=index.js.map diff --git a/test/dist/es/src/index.js.map b/test/dist/es/src/index.js.map new file mode 100644 index 000000000..baebcdd1c --- /dev/null +++ b/test/dist/es/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAEhD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mDAAmD,CAAC;AAElE,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAE1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AAErC,cAAc,UAAU,CAAC;AACzB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAS/B,cAAc,sCAAsC,CAAC;AAErD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/AuthenticationHandler.d.ts b/test/dist/es/src/middleware/AuthenticationHandler.d.ts new file mode 100644 index 000000000..fab577e3c --- /dev/null +++ b/test/dist/es/src/middleware/AuthenticationHandler.d.ts @@ -0,0 +1,56 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module AuthenticationHandler + */ +import { AuthenticationProvider } from "../IAuthenticationProvider"; +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +/** + * @class + * @implements Middleware + * Class representing AuthenticationHandler + */ +export declare class AuthenticationHandler implements Middleware { + /** + * @private + * A member representing the authorization header name + */ + private static AUTHORIZATION_HEADER; + /** + * @private + * A member to hold an AuthenticationProvider instance + */ + private authenticationProvider; + /** + * @private + * A member to hold next middleware in the middleware chain + */ + private nextMiddleware; + /** + * @public + * @constructor + * Creates an instance of AuthenticationHandler + * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler + */ + constructor(authenticationProvider: AuthenticationProvider); + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context: Context): Promise; + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next: Middleware): void; +} diff --git a/test/dist/es/src/middleware/AuthenticationHandler.js b/test/dist/es/src/middleware/AuthenticationHandler.js new file mode 100644 index 000000000..7f754ea4d --- /dev/null +++ b/test/dist/es/src/middleware/AuthenticationHandler.js @@ -0,0 +1,75 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { MiddlewareControl } from "./MiddlewareControl"; +import { appendRequestHeader } from "./MiddlewareUtil"; +import { AuthenticationHandlerOptions } from "./options/AuthenticationHandlerOptions"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; +/** + * @class + * @implements Middleware + * Class representing AuthenticationHandler + */ +export class AuthenticationHandler { + /** + * @public + * @constructor + * Creates an instance of AuthenticationHandler + * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler + */ + constructor(authenticationProvider) { + this.authenticationProvider = authenticationProvider; + } + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions); + } + let authenticationProvider; + let authenticationProviderOptions; + if (typeof options !== "undefined") { + authenticationProvider = options.authenticationProvider; + authenticationProviderOptions = options.authenticationProviderOptions; + } + if (typeof authenticationProvider === "undefined") { + authenticationProvider = this.authenticationProvider; + } + const token = yield authenticationProvider.getAccessToken(authenticationProviderOptions); + const bearerKey = `Bearer ${token}`; + appendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey); + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + return yield this.nextMiddleware.execute(context); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next) { + this.nextMiddleware = next; + } +} +/** + * @private + * A member representing the authorization header name + */ +AuthenticationHandler.AUTHORIZATION_HEADER = "Authorization"; +//# sourceMappingURL=AuthenticationHandler.js.map diff --git a/test/dist/es/src/middleware/AuthenticationHandler.js.map b/test/dist/es/src/middleware/AuthenticationHandler.js.map new file mode 100644 index 000000000..fabc234cc --- /dev/null +++ b/test/dist/es/src/middleware/AuthenticationHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthenticationHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/AuthenticationHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAmBjC;;;;;OAKG;IACH,YAAmB,sBAA8C;QAChE,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,IAAI,OAAqC,CAAC;gBAC1C,IAAI,OAAO,CAAC,iBAAiB,YAAY,iBAAiB,EAAE;oBAC3D,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,4BAA4B,CAAiC,CAAC;iBACvH;gBACD,IAAI,sBAA8C,CAAC;gBACnD,IAAI,6BAA4D,CAAC;gBACjE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;oBACnC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;oBACxD,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,CAAC;iBACtE;gBACD,IAAI,OAAO,sBAAsB,KAAK,WAAW,EAAE;oBAClD,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;iBACrD;gBACD,MAAM,KAAK,GAAW,MAAM,sBAAsB,CAAC,cAAc,CAAC,6BAA6B,CAAC,CAAC;gBACjG,MAAM,SAAS,GAAW,UAAU,KAAK,EAAE,CAAC;gBAC5C,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;gBAC7G,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACzG,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAClD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AApED;;;GAGG;AACY,0CAAoB,GAAW,eAAe,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/ChaosHandler.d.ts b/test/dist/es/src/middleware/ChaosHandler.d.ts new file mode 100644 index 000000000..4b687c9f5 --- /dev/null +++ b/test/dist/es/src/middleware/ChaosHandler.d.ts @@ -0,0 +1,125 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosHandler + */ +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +import { ChaosHandlerOptions } from "./options/ChaosHandlerOptions"; +/** + * Class representing ChaosHandler + * @class + * Class + * @implements Middleware + */ +export declare class ChaosHandler implements Middleware { + /** + * A member holding options to customize the handler behavior + * + * @private + */ + private options; + /** + * container for the manual map that has been written by the client + * + * @private + */ + private manualMap; + /** + * @private + * A member to hold next middleware in the middleware chain + */ + private nextMiddleware; + /** + * @public + * @constructor + * To create an instance of Testing Handler + * @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The testing handler options instance + * @param manualMap - The Map passed by user containing url-statusCode info + * @returns An instance of Testing Handler + */ + constructor(options?: ChaosHandlerOptions, manualMap?: Map>); + /** + * Generates responseHeader + * @private + * @param {number} statusCode - the status code to be returned for the request + * @param {string} requestID - request id + * @param {string} requestDate - date of the request + * @returns response Header + */ + private createResponseHeaders; + /** + * Generates responseBody + * @private + * @param {number} statusCode - the status code to be returned for the request + * @param {string} statusMessage - the status message to be returned for the request + * @param {string} requestID - request id + * @param {string} requestDate - date of the request + * @param {any?} requestBody - the request body to be returned for the request + * @returns response body + */ + private createResponseBody; + /** + * creates a response + * @private + * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {Context} context - Contains the context of the request + */ + private createResponse; + /** + * Decides whether to send the request to the graph or not + * @private + * @param {ChaosHandlerOptions} chaosHandlerOptions - A ChaosHandlerOptions object + * @param {Context} context - Contains the context of the request + * @returns nothing + */ + private sendRequest; + /** + * Fetches a random status code for the RANDOM mode from the predefined array + * @private + * @param {string} requestMethod - the API method for the request + * @returns a random status code from a given set of status codes + */ + private getRandomStatusCode; + /** + * To fetch the relative URL out of the complete URL using a predefined regex pattern + * @private + * @param {string} urlMethod - the complete URL + * @returns the string as relative URL + */ + private getRelativeURL; + /** + * To fetch the status code from the map(if needed), then returns response by calling createResponse + * @private + * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {string} requestURL - the URL for the request + * @param {string} requestMethod - the API method for the request + */ + private setStatusCode; + /** + * To get the options for execution of the middleware + * @private + * @param {Context} context - The context object + * @returns options for middleware execution + */ + private getOptions; + /** + * To execute the current middleware + * @public + * @async + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context: Context): Promise; + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next: Middleware): void; +} diff --git a/test/dist/es/src/middleware/ChaosHandler.js b/test/dist/es/src/middleware/ChaosHandler.js new file mode 100644 index 000000000..bbd41aea9 --- /dev/null +++ b/test/dist/es/src/middleware/ChaosHandler.js @@ -0,0 +1,246 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { MiddlewareControl } from "./MiddlewareControl"; +import { generateUUID } from "./MiddlewareUtil"; +import { httpStatusCode, methodStatusCode } from "./options/ChaosHandlerData"; +import { ChaosHandlerOptions } from "./options/ChaosHandlerOptions"; +import { ChaosStrategy } from "./options/ChaosStrategy"; +/** + * Class representing ChaosHandler + * @class + * Class + * @implements Middleware + */ +export class ChaosHandler { + /** + * @public + * @constructor + * To create an instance of Testing Handler + * @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The testing handler options instance + * @param manualMap - The Map passed by user containing url-statusCode info + * @returns An instance of Testing Handler + */ + constructor(options = new ChaosHandlerOptions(), manualMap) { + this.options = options; + this.manualMap = manualMap; + } + /** + * Generates responseHeader + * @private + * @param {number} statusCode - the status code to be returned for the request + * @param {string} requestID - request id + * @param {string} requestDate - date of the request + * @returns response Header + */ + createResponseHeaders(statusCode, requestID, requestDate) { + const responseHeader = new Headers(); + responseHeader.append("Cache-Control", "no-store"); + responseHeader.append("request-id", requestID); + responseHeader.append("client-request-id", requestID); + responseHeader.append("x-ms-ags-diagnostic", ""); + responseHeader.append("Date", requestDate); + responseHeader.append("Strict-Transport-Security", ""); + if (statusCode === 429) { + // throttling case has to have a timeout scenario + responseHeader.append("retry-after", "300"); + } + return responseHeader; + } + /** + * Generates responseBody + * @private + * @param {number} statusCode - the status code to be returned for the request + * @param {string} statusMessage - the status message to be returned for the request + * @param {string} requestID - request id + * @param {string} requestDate - date of the request + * @param {any?} requestBody - the request body to be returned for the request + * @returns response body + */ + createResponseBody(statusCode, statusMessage, requestID, requestDate, responseBody) { + if (responseBody) { + return responseBody; + } + let body; + if (statusCode >= 400) { + const codeMessage = httpStatusCode[statusCode]; + const errMessage = statusMessage; + body = { + error: { + code: codeMessage, + message: errMessage, + innerError: { + "request-id": requestID, + date: requestDate, + }, + }, + }; + } else { + body = {}; + } + return body; + } + /** + * creates a response + * @private + * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {Context} context - Contains the context of the request + */ + createResponse(chaosHandlerOptions, context) { + try { + let responseBody; + let responseHeader; + let requestID; + let requestDate; + const requestURL = context.request; + requestID = generateUUID(); + requestDate = new Date(); + responseHeader = this.createResponseHeaders(chaosHandlerOptions.statusCode, requestID, requestDate.toString()); + responseBody = this.createResponseBody(chaosHandlerOptions.statusCode, chaosHandlerOptions.statusMessage, requestID, requestDate.toString(), chaosHandlerOptions.responseBody); + const init = { url: requestURL, status: chaosHandlerOptions.statusCode, statusText: chaosHandlerOptions.statusMessage, headers: responseHeader }; + context.response = new Response(responseBody, init); + } catch (error) { + throw error; + } + } + /** + * Decides whether to send the request to the graph or not + * @private + * @param {ChaosHandlerOptions} chaosHandlerOptions - A ChaosHandlerOptions object + * @param {Context} context - Contains the context of the request + * @returns nothing + */ + sendRequest(chaosHandlerOptions, context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + this.setStatusCode(chaosHandlerOptions, context.request, context.options.method); + if (!chaosHandlerOptions.statusCode) { + yield this.nextMiddleware.execute(context); + } else { + this.createResponse(chaosHandlerOptions, context); + } + } catch (error) { + throw error; + } + }); + } + /** + * Fetches a random status code for the RANDOM mode from the predefined array + * @private + * @param {string} requestMethod - the API method for the request + * @returns a random status code from a given set of status codes + */ + getRandomStatusCode(requestMethod) { + try { + const statusCodeArray = methodStatusCode[requestMethod]; + return statusCodeArray[Math.floor(Math.random() * statusCodeArray.length)]; + } catch (error) { + throw error; + } + } + /** + * To fetch the relative URL out of the complete URL using a predefined regex pattern + * @private + * @param {string} urlMethod - the complete URL + * @returns the string as relative URL + */ + getRelativeURL(urlMethod) { + const pattern = /https?:\/\/graph\.microsoft\.com\/[^/]+(.+?)(\?|$)/; + let relativeURL; + if (pattern.exec(urlMethod) !== null) { + relativeURL = pattern.exec(urlMethod)[1]; + } + return relativeURL; + } + /** + * To fetch the status code from the map(if needed), then returns response by calling createResponse + * @private + * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object + * @param {string} requestURL - the URL for the request + * @param {string} requestMethod - the API method for the request + */ + setStatusCode(chaosHandlerOptions, requestURL, requestMethod) { + try { + if (chaosHandlerOptions.chaosStrategy === ChaosStrategy.MANUAL) { + if (chaosHandlerOptions.statusCode === undefined) { + // manual mode with no status code, can be a global level or request level without statusCode + const relativeURL = this.getRelativeURL(requestURL); + if (this.manualMap.get(relativeURL) !== undefined) { + // checking Manual Map for exact match + if (this.manualMap.get(relativeURL).get(requestMethod) !== undefined) { + chaosHandlerOptions.statusCode = this.manualMap.get(relativeURL).get(requestMethod); + } + // else statusCode would be undefined + } else { + // checking for regex match if exact match doesn't work + this.manualMap.forEach((value, key) => { + const regexURL = new RegExp(key + "$"); + if (regexURL.test(relativeURL)) { + if (this.manualMap.get(key).get(requestMethod) !== undefined) { + chaosHandlerOptions.statusCode = this.manualMap.get(key).get(requestMethod); + } + // else statusCode would be undefined + } + }); + } + // Case of redirection or request url not in map ---> statusCode would be undefined + } + } else { + // Handling the case of Random here + if (Math.floor(Math.random() * 100) < chaosHandlerOptions.chaosPercentage) { + chaosHandlerOptions.statusCode = this.getRandomStatusCode(requestMethod); + } + // else statusCode would be undefined + } + } catch (error) { + throw error; + } + } + /** + * To get the options for execution of the middleware + * @private + * @param {Context} context - The context object + * @returns options for middleware execution + */ + getOptions(context) { + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(ChaosHandlerOptions); + } + if (typeof options === "undefined") { + options = Object.assign(new ChaosHandlerOptions(), this.options); + } + return options; + } + /** + * To execute the current middleware + * @public + * @async + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const chaosHandlerOptions = this.getOptions(context); + return yield this.sendRequest(chaosHandlerOptions, context); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next) { + this.nextMiddleware = next; + } +} +//# sourceMappingURL=ChaosHandler.js.map diff --git a/test/dist/es/src/middleware/ChaosHandler.js.map b/test/dist/es/src/middleware/ChaosHandler.js.map new file mode 100644 index 000000000..b17904193 --- /dev/null +++ b/test/dist/es/src/middleware/ChaosHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChaosHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/ChaosHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAqBxB;;;;;;;OAOG;IACH,YAAmB,UAA+B,IAAI,mBAAmB,EAAE,EAAE,SAA4C;QACxH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACK,qBAAqB,CAAC,UAAkB,EAAE,SAAiB,EAAE,WAAmB;QACvF,MAAM,cAAc,GAAY,IAAI,OAAO,EAAE,CAAC;QAE9C,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QACnD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;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AO,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;aAC5D;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.d.ts b/test/dist/es/src/middleware/HTTPMessageHandler.d.ts new file mode 100644 index 000000000..2a44ccdf7 --- /dev/null +++ b/test/dist/es/src/middleware/HTTPMessageHandler.d.ts @@ -0,0 +1,26 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module HTTPMessageHandler + */ +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +/** + * @class + * @implements Middleware + * Class for HTTPMessageHandler + */ +export declare class HTTPMessageHandler implements Middleware { + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The request context object + * @returns A promise that resolves to nothing + */ + execute(context: Context): Promise; +} diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.js b/test/dist/es/src/middleware/HTTPMessageHandler.js new file mode 100644 index 000000000..1075f6d8e --- /dev/null +++ b/test/dist/es/src/middleware/HTTPMessageHandler.js @@ -0,0 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * @implements Middleware + * Class for HTTPMessageHandler + */ +export class HTTPMessageHandler { + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The request context object + * @returns A promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + context.response = yield fetch(context.request, context.options); + return; + } catch (error) { + throw error; + } + }); + } +} +//# sourceMappingURL=HTTPMessageHandler.js.map diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.js.map b/test/dist/es/src/middleware/HTTPMessageHandler.js.map new file mode 100644 index 000000000..dc045e810 --- /dev/null +++ b/test/dist/es/src/middleware/HTTPMessageHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTTPMessageHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/HTTPMessageHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,OAAO,CAAC,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBACjE,OAAO;aACP;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/IMiddleware.d.ts b/test/dist/es/src/middleware/IMiddleware.d.ts new file mode 100644 index 000000000..0ae1f6bde --- /dev/null +++ b/test/dist/es/src/middleware/IMiddleware.d.ts @@ -0,0 +1,16 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { Context } from "../IContext"; +/** + * @interface + * @property {Function} execute - The method to execute the middleware + * @property {Function} [setNext] - A method to set the next middleware in the chain + */ +export interface Middleware { + execute: (context: Context) => Promise; + setNext?: (middleware: Middleware) => void; +} diff --git a/test/dist/es/src/middleware/IMiddleware.js b/test/dist/es/src/middleware/IMiddleware.js new file mode 100644 index 000000000..7d850edb5 --- /dev/null +++ b/test/dist/es/src/middleware/IMiddleware.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IMiddleware.js.map diff --git a/test/dist/es/src/middleware/IMiddleware.js.map b/test/dist/es/src/middleware/IMiddleware.js.map new file mode 100644 index 000000000..75092c1da --- /dev/null +++ b/test/dist/es/src/middleware/IMiddleware.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IMiddleware.js","sourceRoot":"","sources":["../../../../../src/middleware/IMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareControl.d.ts b/test/dist/es/src/middleware/MiddlewareControl.d.ts new file mode 100644 index 000000000..f040abcb3 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareControl.d.ts @@ -0,0 +1,48 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module MiddlewareControl + */ +import { MiddlewareOptions } from "./options/IMiddlewareOptions"; +/** + * @class + * Class representing MiddlewareControl + */ +export declare class MiddlewareControl { + /** + * @private + * A member holding map of MiddlewareOptions + */ + private middlewareOptions; + /** + * @public + * @constructor + * Creates an instance of MiddlewareControl + * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions + * @returns The instance of MiddlewareControl + */ + constructor(middlewareOptions?: MiddlewareOptions[]); + /** + * @public + * To get the middleware option using the class of the option + * @param {Function} fn - The class of the strongly typed option class + * @returns The middleware option + * @example + * // if you wanted to return the middleware option associated with this class (MiddlewareControl) + * // call this function like this: + * getMiddlewareOptions(MiddlewareControl) + */ + getMiddlewareOptions(fn: Function): MiddlewareOptions; + /** + * @public + * To set the middleware options using the class of the option + * @param {Function} fn - The class of the strongly typed option class + * @param {MiddlewareOptions} option - The strongly typed middleware option + * @returns nothing + */ + setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void; +} diff --git a/test/dist/es/src/middleware/MiddlewareControl.js b/test/dist/es/src/middleware/MiddlewareControl.js new file mode 100644 index 000000000..ccc3fdf62 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareControl.js @@ -0,0 +1,53 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * Class representing MiddlewareControl + */ +export class MiddlewareControl { + /** + * @public + * @constructor + * Creates an instance of MiddlewareControl + * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions + * @returns The instance of MiddlewareControl + */ + constructor(middlewareOptions = []) { + // tslint:disable-next-line:ban-types + this.middlewareOptions = new Map(); + for (const option of middlewareOptions) { + const fn = option.constructor; + this.middlewareOptions.set(fn, option); + } + } + /** + * @public + * To get the middleware option using the class of the option + * @param {Function} fn - The class of the strongly typed option class + * @returns The middleware option + * @example + * // if you wanted to return the middleware option associated with this class (MiddlewareControl) + * // call this function like this: + * getMiddlewareOptions(MiddlewareControl) + */ + // tslint:disable-next-line:ban-types + getMiddlewareOptions(fn) { + return this.middlewareOptions.get(fn); + } + /** + * @public + * To set the middleware options using the class of the option + * @param {Function} fn - The class of the strongly typed option class + * @param {MiddlewareOptions} option - The strongly typed middleware option + * @returns nothing + */ + // tslint:disable-next-line:ban-types + setMiddlewareOptions(fn, option) { + this.middlewareOptions.set(fn, option); + } +} +//# sourceMappingURL=MiddlewareControl.js.map diff --git a/test/dist/es/src/middleware/MiddlewareControl.js.map b/test/dist/es/src/middleware/MiddlewareControl.js.map new file mode 100644 index 000000000..060675319 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareControl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MiddlewareControl.js","sourceRoot":"","sources":["../../../../../src/middleware/MiddlewareControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAQ7B;;;;;;OAMG;IACH,YAAmB,oBAAyC,EAAE;QAC7D,qCAAqC;QACrC,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAA+B,CAAC;QAChE,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE;YACvC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;YAC9B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SACvC;IACF,CAAC;IAED;;;;;;;;;OASG;IACH,qCAAqC;IAC9B,oBAAoB,CAAC,EAAY;QACvC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACH,qCAAqC;IAC9B,oBAAoB,CAAC,EAAY,EAAE,MAAyB;QAClE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareFactory.d.ts b/test/dist/es/src/middleware/MiddlewareFactory.d.ts new file mode 100644 index 000000000..db45e331e --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareFactory.d.ts @@ -0,0 +1,25 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module MiddlewareFactory + */ +import { AuthenticationProvider } from "../IAuthenticationProvider"; +import { Middleware } from "./IMiddleware"; +/** + * @class + * Class containing function(s) related to the middleware pipelines. + */ +export declare class MiddlewareFactory { + /** + * @public + * @static + * Returns the default middleware chain an array with the middleware handlers + * @param {AuthenticationProvider} authProvider - The authentication provider instance + * @returns an array of the middleware handlers of the default middleware chain + */ + static getDefaultMiddlewareChain(authProvider: AuthenticationProvider): Middleware[]; +} diff --git a/test/dist/es/src/middleware/MiddlewareFactory.js b/test/dist/es/src/middleware/MiddlewareFactory.js new file mode 100644 index 000000000..4cd58cef2 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareFactory.js @@ -0,0 +1,51 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { AuthenticationHandler } from "./AuthenticationHandler"; +import { HTTPMessageHandler } from "./HTTPMessageHandler"; +import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; +import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; +import { RedirectHandler } from "./RedirectHandler"; +import { RetryHandler } from "./RetryHandler"; +import { TelemetryHandler } from "./TelemetryHandler"; +/** + * @private + * To check whether the environment is node or not + * @returns A boolean representing the environment is node or not + */ +const isNodeEnvironment = () => { + return typeof process === "object" && typeof require === "function"; +}; +/** + * @class + * Class containing function(s) related to the middleware pipelines. + */ +export class MiddlewareFactory { + /** + * @public + * @static + * Returns the default middleware chain an array with the middleware handlers + * @param {AuthenticationProvider} authProvider - The authentication provider instance + * @returns an array of the middleware handlers of the default middleware chain + */ + static getDefaultMiddlewareChain(authProvider) { + const middleware = []; + const authenticationHandler = new AuthenticationHandler(authProvider); + const retryHandler = new RetryHandler(new RetryHandlerOptions()); + const telemetryHandler = new TelemetryHandler(); + const httpMessageHandler = new HTTPMessageHandler(); + middleware.push(authenticationHandler); + middleware.push(retryHandler); + if (isNodeEnvironment()) { + const redirectHandler = new RedirectHandler(new RedirectHandlerOptions()); + middleware.push(redirectHandler); + } + middleware.push(telemetryHandler); + middleware.push(httpMessageHandler); + return middleware; + } +} +//# sourceMappingURL=MiddlewareFactory.js.map diff --git a/test/dist/es/src/middleware/MiddlewareFactory.js.map b/test/dist/es/src/middleware/MiddlewareFactory.js.map new file mode 100644 index 000000000..084b2b733 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareFactory.js.map @@ -0,0 +1 @@ +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CAAC,eAAe,CAAC,CAAC;SACjC;QACD,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpC,OAAO,UAAU,CAAC;IACnB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareUtil.d.ts b/test/dist/es/src/middleware/MiddlewareUtil.d.ts new file mode 100644 index 000000000..8c26a066a --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareUtil.d.ts @@ -0,0 +1,53 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module MiddlewareUtil + */ +import { FetchOptions } from "../IFetchOptions"; +/** + * @constant + * To generate the UUID + * @returns The UUID string + */ +export declare const generateUUID: () => string; +/** + * @constant + * To get the request header from the request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @returns A header value for the given key from the request + */ +export declare const getRequestHeader: (request: RequestInfo, options: FetchOptions, key: string) => string; +/** + * @constant + * To set the header value to the given request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @param {string } value - The header value string + * @returns Nothing + */ +export declare const setRequestHeader: (request: RequestInfo, options: FetchOptions, key: string, value: string) => void; +/** + * @constant + * To append the header value to the given request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @param {string } value - The header value string + * @returns Nothing + */ +export declare const appendRequestHeader: (request: RequestInfo, options: FetchOptions, key: string, value: string) => void; +/** + * @constant + * To clone the request with the new url + * @param {string} url - The new url string + * @param {Request} request - The request object + * @returns A promise that resolves to request object + */ +export declare const cloneRequestWithNewUrl: (newUrl: string, request: Request) => Promise; diff --git a/test/dist/es/src/middleware/MiddlewareUtil.js b/test/dist/es/src/middleware/MiddlewareUtil.js new file mode 100644 index 000000000..6fa1dbd01 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareUtil.js @@ -0,0 +1,136 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @constant + * To generate the UUID + * @returns The UUID string + */ +export const generateUUID = () => { + let uuid = ""; + for (let j = 0; j < 32; j++) { + if (j === 8 || j === 12 || j === 16 || j === 20) { + uuid += "-"; + } + uuid += Math.floor(Math.random() * 16).toString(16); + } + return uuid; +}; +/** + * @constant + * To get the request header from the request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @returns A header value for the given key from the request + */ +export const getRequestHeader = (request, options, key) => { + let value = null; + if (typeof Request !== "undefined" && request instanceof Request) { + value = request.headers.get(key); + } else if (typeof options !== "undefined" && options.headers !== undefined) { + if (typeof Headers !== "undefined" && options.headers instanceof Headers) { + value = options.headers.get(key); + } else if (options.headers instanceof Array) { + const headers = options.headers; + for (let i = 0, l = headers.length; i < l; i++) { + if (headers[i][0] === key) { + value = headers[i][1]; + break; + } + } + } else if (options.headers[key] !== undefined) { + value = options.headers[key]; + } + } + return value; +}; +/** + * @constant + * To set the header value to the given request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @param {string } value - The header value string + * @returns Nothing + */ +export const setRequestHeader = (request, options, key, value) => { + if (typeof Request !== "undefined" && request instanceof Request) { + request.headers.set(key, value); + } else if (typeof options !== "undefined") { + if (options.headers === undefined) { + options.headers = new Headers({ + [key]: value, + }); + } else { + if (typeof Headers !== "undefined" && options.headers instanceof Headers) { + options.headers.set(key, value); + } else if (options.headers instanceof Array) { + let i = 0; + const l = options.headers.length; + for (; i < l; i++) { + const header = options.headers[i]; + if (header[0] === key) { + header[1] = value; + break; + } + } + if (i === l) { + options.headers.push([key, value]); + } + } else { + Object.assign(options.headers, { [key]: value }); + } + } + } +}; +/** + * @constant + * To append the header value to the given request + * @param {RequestInfo} request - The request object or the url string + * @param {FetchOptions|undefined} options - The request options object + * @param {string} key - The header key string + * @param {string } value - The header value string + * @returns Nothing + */ +export const appendRequestHeader = (request, options, key, value) => { + if (typeof Request !== "undefined" && request instanceof Request) { + request.headers.append(key, value); + } else if (typeof options !== "undefined") { + if (options.headers === undefined) { + options.headers = new Headers({ + [key]: value, + }); + } else { + if (typeof Headers !== "undefined" && options.headers instanceof Headers) { + options.headers.append(key, value); + } else if (options.headers instanceof Array) { + options.headers.push([key, value]); + } else if (options.headers === undefined) { + options.headers = { [key]: value }; + } else if (options.headers[key] === undefined) { + options.headers[key] = value; + } else { + options.headers[key] += `, ${value}`; + } + } + } +}; +/** + * @constant + * To clone the request with the new url + * @param {string} url - The new url string + * @param {Request} request - The request object + * @returns A promise that resolves to request object + */ +export const cloneRequestWithNewUrl = (newUrl, request) => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const body = request.headers.get("Content-Type") ? yield request.blob() : yield Promise.resolve(undefined); + const { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request; + return new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal }); + }); +//# sourceMappingURL=MiddlewareUtil.js.map diff --git a/test/dist/es/src/middleware/MiddlewareUtil.js.map b/test/dist/es/src/middleware/MiddlewareUtil.js.map new file mode 100644 index 000000000..0ac4039e0 --- /dev/null +++ b/test/dist/es/src/middleware/MiddlewareUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MiddlewareUtil.js","sourceRoot":"","sources":["../../../../../src/middleware/MiddlewareUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAW,EAAE;IACxC,IAAI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AAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;aACnC;iBAAM,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBAC9C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;iBAAM;gBACN,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;aACrC;SACD;KACD;AACF,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAO,MAAc,EAAE,OAAgB,EAAoB,EAAE;IAClG,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3G,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;AACnJ,CAAC,CAAA,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/RedirectHandler.d.ts b/test/dist/es/src/middleware/RedirectHandler.d.ts new file mode 100644 index 000000000..4f808676c --- /dev/null +++ b/test/dist/es/src/middleware/RedirectHandler.d.ts @@ -0,0 +1,145 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module RedirectHandler + */ +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; +/** + * @class + * Class + * @implements Middleware + * Class representing RedirectHandler + */ +export declare class RedirectHandler implements Middleware { + /** + * @private + * @static + * A member holding the array of redirect status codes + */ + private static REDIRECT_STATUS_CODES; + /** + * @private + * @static + * A member holding SeeOther status code + */ + private static STATUS_CODE_SEE_OTHER; + /** + * @private + * @static + * A member holding the name of the location header + */ + private static LOCATION_HEADER; + /** + * @private + * @static + * A member representing the authorization header name + */ + private static AUTHORIZATION_HEADER; + /** + * @private + * @static + * A member holding the manual redirect value + */ + private static MANUAL_REDIRECT; + /** + * @private + * A member holding options to customize the handler behavior + */ + private options; + /** + * @private + * A member to hold next middleware in the middleware chain + */ + private nextMiddleware; + /** + * @public + * @constructor + * To create an instance of RedirectHandler + * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance + * @returns An instance of RedirectHandler + */ + constructor(options?: RedirectHandlerOptions); + /** + * @private + * To check whether the response has the redirect status code or not + * @param {Response} response - The response object + * @returns A boolean representing whether the response contains the redirect status code or not + */ + private isRedirect; + /** + * @private + * To check whether the response has location header or not + * @param {Response} response - The response object + * @returns A boolean representing the whether the response has location header or not + */ + private hasLocationHeader; + /** + * @private + * To get the redirect url from location header in response object + * @param {Response} response - The response object + * @returns A redirect url from location header + */ + private getLocationHeader; + /** + * @private + * To check whether the given url is a relative url or not + * @param {string} url - The url string value + * @returns A boolean representing whether the given url is a relative url or not + */ + private isRelativeURL; + /** + * @private + * To check whether the authorization header in the request should be dropped for consequent redirected requests + * @param {string} requestUrl - The request url value + * @param {string} redirectUrl - The redirect url value + * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests + */ + private shouldDropAuthorizationHeader; + /** + * @private + * @async + * To update a request url with the redirect url + * @param {string} redirectUrl - The redirect url value + * @param {Context} context - The context object value + * @returns Nothing + */ + private updateRequestUrl; + /** + * @private + * To get the options for execution of the middleware + * @param {Context} context - The context object + * @returns A options for middleware execution + */ + private getOptions; + /** + * @private + * @async + * To execute the next middleware and to handle in case of redirect response returned by the server + * @param {Context} context - The context object + * @param {number} redirectCount - The redirect count value + * @param {RedirectHandlerOptions} options - The redirect handler options instance + * @returns A promise that resolves to nothing + */ + private executeWithRedirect; + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context: Context): Promise; + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next: Middleware): void; +} diff --git a/test/dist/es/src/middleware/RedirectHandler.js b/test/dist/es/src/middleware/RedirectHandler.js new file mode 100644 index 000000000..1458d753e --- /dev/null +++ b/test/dist/es/src/middleware/RedirectHandler.js @@ -0,0 +1,211 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { RequestMethod } from "../RequestMethod"; +import { MiddlewareControl } from "./MiddlewareControl"; +import { cloneRequestWithNewUrl, setRequestHeader } from "./MiddlewareUtil"; +import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; +/** + * @class + * Class + * @implements Middleware + * Class representing RedirectHandler + */ +export class RedirectHandler { + /** + * @public + * @constructor + * To create an instance of RedirectHandler + * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance + * @returns An instance of RedirectHandler + */ + constructor(options = new RedirectHandlerOptions()) { + this.options = options; + } + /** + * @private + * To check whether the response has the redirect status code or not + * @param {Response} response - The response object + * @returns A boolean representing whether the response contains the redirect status code or not + */ + isRedirect(response) { + return RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1; + } + /** + * @private + * To check whether the response has location header or not + * @param {Response} response - The response object + * @returns A boolean representing the whether the response has location header or not + */ + hasLocationHeader(response) { + return response.headers.has(RedirectHandler.LOCATION_HEADER); + } + /** + * @private + * To get the redirect url from location header in response object + * @param {Response} response - The response object + * @returns A redirect url from location header + */ + getLocationHeader(response) { + return response.headers.get(RedirectHandler.LOCATION_HEADER); + } + /** + * @private + * To check whether the given url is a relative url or not + * @param {string} url - The url string value + * @returns A boolean representing whether the given url is a relative url or not + */ + isRelativeURL(url) { + return url.indexOf("://") === -1; + } + /** + * @private + * To check whether the authorization header in the request should be dropped for consequent redirected requests + * @param {string} requestUrl - The request url value + * @param {string} redirectUrl - The redirect url value + * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests + */ + shouldDropAuthorizationHeader(requestUrl, redirectUrl) { + const schemeHostRegex = /^[A-Za-z].+?:\/\/.+?(?=\/|$)/; + const requestMatches = schemeHostRegex.exec(requestUrl); + let requestAuthority; + let redirectAuthority; + if (requestMatches !== null) { + requestAuthority = requestMatches[0]; + } + const redirectMatches = schemeHostRegex.exec(redirectUrl); + if (redirectMatches !== null) { + redirectAuthority = redirectMatches[0]; + } + return typeof requestAuthority !== "undefined" && typeof redirectAuthority !== "undefined" && requestAuthority !== redirectAuthority; + } + /** + * @private + * @async + * To update a request url with the redirect url + * @param {string} redirectUrl - The redirect url value + * @param {Context} context - The context object value + * @returns Nothing + */ + updateRequestUrl(redirectUrl, context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + context.request = typeof context.request === "string" ? redirectUrl : yield cloneRequestWithNewUrl(redirectUrl, context.request); + }); + } + /** + * @private + * To get the options for execution of the middleware + * @param {Context} context - The context object + * @returns A options for middleware execution + */ + getOptions(context) { + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions); + } + if (typeof options === "undefined") { + options = Object.assign(new RedirectHandlerOptions(), this.options); + } + return options; + } + /** + * @private + * @async + * To execute the next middleware and to handle in case of redirect response returned by the server + * @param {Context} context - The context object + * @param {number} redirectCount - The redirect count value + * @param {RedirectHandlerOptions} options - The redirect handler options instance + * @returns A promise that resolves to nothing + */ + executeWithRedirect(context, redirectCount, options) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + yield this.nextMiddleware.execute(context); + const response = context.response; + if (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) { + ++redirectCount; + if (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) { + context.options.method = RequestMethod.GET; + delete context.options.body; + } else { + const redirectUrl = this.getLocationHeader(response); + if (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) { + setRequestHeader(context.request, context.options, RedirectHandler.AUTHORIZATION_HEADER, undefined); + } + yield this.updateRequestUrl(redirectUrl, context); + } + yield this.executeWithRedirect(context, redirectCount, options); + } else { + return; + } + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const redirectCount = 0; + const options = this.getOptions(context); + context.options.redirect = RedirectHandler.MANUAL_REDIRECT; + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED); + return yield this.executeWithRedirect(context, redirectCount, options); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next) { + this.nextMiddleware = next; + } +} +/** + * @private + * @static + * A member holding the array of redirect status codes + */ +RedirectHandler.REDIRECT_STATUS_CODES = [301, 302, 303, 307, 308]; +/** + * @private + * @static + * A member holding SeeOther status code + */ +RedirectHandler.STATUS_CODE_SEE_OTHER = 303; +/** + * @private + * @static + * A member holding the name of the location header + */ +RedirectHandler.LOCATION_HEADER = "Location"; +/** + * @private + * @static + * A member representing the authorization header name + */ +RedirectHandler.AUTHORIZATION_HEADER = "Authorization"; +/** + * @private + * @static + * A member holding the manual redirect value + */ +RedirectHandler.MANUAL_REDIRECT = "manual"; +//# sourceMappingURL=RedirectHandler.js.map diff --git a/test/dist/es/src/middleware/RedirectHandler.js.map b/test/dist/es/src/middleware/RedirectHandler.js.map new file mode 100644 index 000000000..cbc823d73 --- /dev/null +++ b/test/dist/es/src/middleware/RedirectHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RedirectHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/RedirectHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAsD3B;;;;;;OAMG;IAEH,YAAmB,UAAkC,IAAI,sBAAsB,EAAE;QAChF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACK,UAAU,CAAC,QAAkB;QACpC,OAAO,eAAe,CAAC,qBAAqB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,QAAkB;QAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,QAAkB;QAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,GAA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aAAa,EAAE,OAAO,CAAC,CAAC;iBAChE;qBAAM;oBACN,OAAO;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,MAAM,aAAa,GAAW,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACzC,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC;gBAC3D,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;gBACnG,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;aACvE;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AAzND;;;;GAIG;AACY,qCAAqB,GAAa;IAChD,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACH,CAAC;AAEF;;;;GAIG;AACY,qCAAqB,GAAW,GAAG,CAAC;AAEnD;;;;GAIG;AACY,+BAAe,GAAW,UAAU,CAAC;AAEpD;;;;GAIG;AACY,oCAAoB,GAAW,eAAe,CAAC;AAE9D;;;;GAIG;AACY,+BAAe,GAAoB,QAAQ,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/RetryHandler.d.ts b/test/dist/es/src/middleware/RetryHandler.d.ts new file mode 100644 index 000000000..ffaa37eed --- /dev/null +++ b/test/dist/es/src/middleware/RetryHandler.d.ts @@ -0,0 +1,121 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module RetryHandler + */ +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; +/** + * @class + * @implements Middleware + * Class for RetryHandler + */ +export declare class RetryHandler implements Middleware { + /** + * @private + * @static + * A list of status codes that needs to be retried + */ + private static RETRY_STATUS_CODES; + /** + * @private + * @static + * A member holding the name of retry attempt header + */ + private static RETRY_ATTEMPT_HEADER; + /** + * @private + * @static + * A member holding the name of retry after header + */ + private static RETRY_AFTER_HEADER; + /** + * @private + * A member to hold next middleware in the middleware chain + */ + private nextMiddleware; + /** + * @private + * A member holding the retry handler options + */ + private options; + /** + * @public + * @constructor + * To create an instance of RetryHandler + * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value + * @returns An instance of RetryHandler + */ + constructor(options?: RetryHandlerOptions); + /** + * + * @private + * To check whether the response has the retry status code + * @param {Response} response - The response object + * @returns Whether the response has retry status code or not + */ + private isRetry; + /** + * @private + * To check whether the payload is buffered or not + * @param {RequestInfo} request - The url string or the request object value + * @param {FetchOptions} options - The options of a request + * @returns Whether the payload is buffered or not + */ + private isBuffered; + /** + * @private + * To get the delay for a retry + * @param {Response} response - The response object + * @param {number} retryAttempts - The current attempt count + * @param {number} delay - The delay value in seconds + * @returns A delay for a retry + */ + private getDelay; + /** + * @private + * To get an exponential back off value + * @param {number} attempts - The current attempt count + * @returns An exponential back off value + */ + private getExponentialBackOffTime; + /** + * @private + * @async + * To add delay for the execution + * @param {number} delaySeconds - The delay value in seconds + * @returns Nothing + */ + private sleep; + private getOptions; + /** + * @private + * @async + * To execute the middleware with retries + * @param {Context} context - The context object + * @param {number} retryAttempts - The current attempt count + * @param {RetryHandlerOptions} options - The retry middleware options instance + * @returns A Promise that resolves to nothing + */ + private executeWithRetry; + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context: Context): Promise; + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next: Middleware): void; +} diff --git a/test/dist/es/src/middleware/RetryHandler.js b/test/dist/es/src/middleware/RetryHandler.js new file mode 100644 index 000000000..abc5c76c9 --- /dev/null +++ b/test/dist/es/src/middleware/RetryHandler.js @@ -0,0 +1,189 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { RequestMethod } from "../RequestMethod"; +import { MiddlewareControl } from "./MiddlewareControl"; +import { getRequestHeader, setRequestHeader } from "./MiddlewareUtil"; +import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; +/** + * @class + * @implements Middleware + * Class for RetryHandler + */ +export class RetryHandler { + /** + * @public + * @constructor + * To create an instance of RetryHandler + * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value + * @returns An instance of RetryHandler + */ + constructor(options = new RetryHandlerOptions()) { + this.options = options; + } + /** + * + * @private + * To check whether the response has the retry status code + * @param {Response} response - The response object + * @returns Whether the response has retry status code or not + */ + isRetry(response) { + return RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1; + } + /** + * @private + * To check whether the payload is buffered or not + * @param {RequestInfo} request - The url string or the request object value + * @param {FetchOptions} options - The options of a request + * @returns Whether the payload is buffered or not + */ + isBuffered(request, options) { + const method = typeof request === "string" ? options.method : request.method; + const isPutPatchOrPost = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST; + if (isPutPatchOrPost) { + const isStream = getRequestHeader(request, options, "Content-Type") === "application/octet-stream"; + if (isStream) { + return false; + } + } + return true; + } + /** + * @private + * To get the delay for a retry + * @param {Response} response - The response object + * @param {number} retryAttempts - The current attempt count + * @param {number} delay - The delay value in seconds + * @returns A delay for a retry + */ + getDelay(response, retryAttempts, delay) { + const getRandomness = () => Number(Math.random().toFixed(3)); + const retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null; + let newDelay; + if (retryAfter !== null) { + // tslint:disable: prefer-conditional-expression + if (Number.isNaN(Number(retryAfter))) { + newDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000); + } else { + newDelay = Number(retryAfter); + } + // tslint:enable: prefer-conditional-expression + } else { + // Adding randomness to avoid retrying at a same + newDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness(); + } + return Math.min(newDelay, this.options.getMaxDelay() + getRandomness()); + } + /** + * @private + * To get an exponential back off value + * @param {number} attempts - The current attempt count + * @returns An exponential back off value + */ + getExponentialBackOffTime(attempts) { + return Math.round((1 / 2) * (Math.pow(2, attempts) - 1)); + } + /** + * @private + * @async + * To add delay for the execution + * @param {number} delaySeconds - The delay value in seconds + * @returns Nothing + */ + sleep(delaySeconds) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const delayMilliseconds = delaySeconds * 1000; + return new Promise((resolve) => setTimeout(resolve, delayMilliseconds)); + }); + } + getOptions(context) { + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(this.options.constructor); + } + if (typeof options === "undefined") { + options = Object.assign(new RetryHandlerOptions(), this.options); + } + return options; + } + /** + * @private + * @async + * To execute the middleware with retries + * @param {Context} context - The context object + * @param {number} retryAttempts - The current attempt count + * @param {RetryHandlerOptions} options - The retry middleware options instance + * @returns A Promise that resolves to nothing + */ + executeWithRetry(context, retryAttempts, options) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + yield this.nextMiddleware.execute(context); + if (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) { + ++retryAttempts; + setRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString()); + const delay = this.getDelay(context.response, retryAttempts, options.delay); + yield this.sleep(delay); + return yield this.executeWithRetry(context, retryAttempts, options); + } else { + return; + } + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const retryAttempts = 0; + const options = this.getOptions(context); + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED); + return yield this.executeWithRetry(context, retryAttempts, options); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next) { + this.nextMiddleware = next; + } +} +/** + * @private + * @static + * A list of status codes that needs to be retried + */ +RetryHandler.RETRY_STATUS_CODES = [429, 503, 504]; +/** + * @private + * @static + * A member holding the name of retry attempt header + */ +RetryHandler.RETRY_ATTEMPT_HEADER = "Retry-Attempt"; +/** + * @private + * @static + * A member holding the name of retry after header + */ +RetryHandler.RETRY_AFTER_HEADER = "Retry-After"; +//# sourceMappingURL=RetryHandler.js.map diff --git a/test/dist/es/src/middleware/RetryHandler.js.map b/test/dist/es/src/middleware/RetryHandler.js.map new file mode 100644 index 000000000..3c4964721 --- /dev/null +++ b/test/dist/es/src/middleware/RetryHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RetryHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/RetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,mBAAmB,E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,EAAE,OAAO,CAAC,CAAC;iBACpE;qBAAM;oBACN,OAAO;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,MAAM,aAAa,GAAW,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAwB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;gBAChG,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;aACpE;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AA9LD;;;;GAIG;AACY,+BAAkB,GAAa;IAC7C,GAAG;IACH,GAAG;IACH,GAAG;CACH,CAAC;AAEF;;;;GAIG;AACY,iCAAoB,GAAW,eAAe,CAAC;AAE9D;;;;GAIG;AACY,+BAAkB,GAAW,aAAa,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/TelemetryHandler.d.ts b/test/dist/es/src/middleware/TelemetryHandler.d.ts new file mode 100644 index 000000000..238381fa7 --- /dev/null +++ b/test/dist/es/src/middleware/TelemetryHandler.d.ts @@ -0,0 +1,62 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module TelemetryHandler + */ +import { Context } from "../IContext"; +import { Middleware } from "./IMiddleware"; +/** + * @class + * @implements Middleware + * Class for TelemetryHandler + */ +export declare class TelemetryHandler implements Middleware { + /** + * @private + * @static + * A member holding the name of the client request id header + */ + private static CLIENT_REQUEST_ID_HEADER; + /** + * @private + * @static + * A member holding the name of the sdk version header + */ + private static SDK_VERSION_HEADER; + /** + * @private + * @static + * A member holding the language prefix for the sdk version header value + */ + private static PRODUCT_NAME; + /** + * @private + * @static + * A member holding the key for the feature usage metrics + */ + private static FEATURE_USAGE_STRING; + /** + * @private + * A member to hold next middleware in the middleware chain + */ + private nextMiddleware; + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context: Context): Promise; + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next: Middleware): void; +} diff --git a/test/dist/es/src/middleware/TelemetryHandler.js b/test/dist/es/src/middleware/TelemetryHandler.js new file mode 100644 index 000000000..97799773e --- /dev/null +++ b/test/dist/es/src/middleware/TelemetryHandler.js @@ -0,0 +1,83 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { PACKAGE_VERSION } from "../Version"; +import { MiddlewareControl } from "./MiddlewareControl"; +import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "./MiddlewareUtil"; +import { TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; +/** + * @class + * @implements Middleware + * Class for TelemetryHandler + */ +export class TelemetryHandler { + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The context object of the request + * @returns A Promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + let clientRequestId = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER); + if (clientRequestId === null) { + clientRequestId = generateUUID(); + setRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId); + } + let sdkVersionValue = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`; + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); + } + if (typeof options !== "undefined") { + const featureUsage = options.getFeatureUsage(); + sdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`; + } + appendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue); + return yield this.nextMiddleware.execute(context); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To set the next middleware in the chain + * @param {Middleware} next - The middleware instance + * @returns Nothing + */ + setNext(next) { + this.nextMiddleware = next; + } +} +/** + * @private + * @static + * A member holding the name of the client request id header + */ +TelemetryHandler.CLIENT_REQUEST_ID_HEADER = "client-request-id"; +/** + * @private + * @static + * A member holding the name of the sdk version header + */ +TelemetryHandler.SDK_VERSION_HEADER = "SdkVersion"; +/** + * @private + * @static + * A member holding the language prefix for the sdk version header value + */ +TelemetryHandler.PRODUCT_NAME = "graph-js"; +/** + * @private + * @static + * A member holding the key for the feature usage metrics + */ +TelemetryHandler.FEATURE_USAGE_STRING = "featureUsage"; +//# sourceMappingURL=TelemetryHandler.js.map diff --git a/test/dist/es/src/middleware/TelemetryHandler.js.map b/test/dist/es/src/middleware/TelemetryHandler.js.map new file mode 100644 index 000000000..762ec9cde --- /dev/null +++ b/test/dist/es/src/middleware/TelemetryHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TelemetryHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/TelemetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAA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;;AAxED;;;;GAIG;AACY,yCAAwB,GAAG,mBAAmB,CAAC;AAE9D;;;;GAIG;AACY,mCAAkB,GAAG,YAAY,CAAC;AAEjD;;;;GAIG;AACY,6BAAY,GAAG,UAAU,CAAC;AAEzC;;;;GAIG;AACY,qCAAoB,GAAG,cAAc,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts new file mode 100644 index 000000000..cab6d3b8a --- /dev/null +++ b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts @@ -0,0 +1,38 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module AuthenticationHandlerOptions + */ +import { AuthenticationProvider } from "../../IAuthenticationProvider"; +import { AuthenticationProviderOptions } from "../../IAuthenticationProviderOptions"; +import { MiddlewareOptions } from "./IMiddlewareOptions"; +/** + * @class + * @implements MiddlewareOptions + * Class representing AuthenticationHandlerOptions + */ +export declare class AuthenticationHandlerOptions implements MiddlewareOptions { + /** + * @public + * A member holding an instance of an authentication provider + */ + authenticationProvider: AuthenticationProvider; + /** + * @public + * A member holding an instance of authentication provider options + */ + authenticationProviderOptions: AuthenticationProviderOptions; + /** + * @public + * @constructor + * To create an instance of AuthenticationHandlerOptions + * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance + * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance + * @returns An instance of AuthenticationHandlerOptions + */ + constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions); +} diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js new file mode 100644 index 000000000..e7c0a3391 --- /dev/null +++ b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js @@ -0,0 +1,26 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * @implements MiddlewareOptions + * Class representing AuthenticationHandlerOptions + */ +export class AuthenticationHandlerOptions { + /** + * @public + * @constructor + * To create an instance of AuthenticationHandlerOptions + * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance + * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance + * @returns An instance of AuthenticationHandlerOptions + */ + constructor(authenticationProvider, authenticationProviderOptions) { + this.authenticationProvider = authenticationProvider; + this.authenticationProviderOptions = authenticationProviderOptions; + } +} +//# sourceMappingURL=AuthenticationHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map new file mode 100644 index 000000000..5903c3b3f --- /dev/null +++ b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthenticationHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/AuthenticationHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAaxC;;;;;;;OAOG;IACH,YAAmB,sBAA+C,EAAE,6BAA6D;QAChI,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;IACpE,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts b/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts new file mode 100644 index 000000000..715c7021b --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts @@ -0,0 +1,21 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosHandlerData + */ +/** + * Contains RequestMethod to corresponding array of possible status codes, used for Random mode + */ +export declare const methodStatusCode: { + [key: string]: number[]; +}; +/** + * Contains statusCode to statusMessage map + */ +export declare const httpStatusCode: { + [key: number]: string; +}; diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.js b/test/dist/es/src/middleware/options/ChaosHandlerData.js new file mode 100644 index 000000000..d3452a647 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerData.js @@ -0,0 +1,86 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosHandlerData + */ +/** + * Contains RequestMethod to corresponding array of possible status codes, used for Random mode + */ +export const methodStatusCode = { + GET: [429, 500, 502, 503, 504], + POST: [429, 500, 502, 503, 504, 507], + PUT: [429, 500, 502, 503, 504, 507], + PATCH: [429, 500, 502, 503, 504], + DELETE: [429, 500, 502, 503, 504, 507], +}; +/** + * Contains statusCode to statusMessage map + */ +export const httpStatusCode = { + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Early Hints", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 208: "Already Reported", + 226: "IM Used", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Payload Too Large", + 414: "URI Too Long", + 415: "Unsupported Media Type", + 416: "Range Not Satisfiable", + 417: "Expectation Failed", + 421: "Misdirected Request", + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 425: "Too Early", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 451: "Unavailable For Legal Reasons", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 510: "Not Extended", + 511: "Network Authentication Required", +}; +//# sourceMappingURL=ChaosHandlerData.js.map diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.js.map b/test/dist/es/src/middleware/options/ChaosHandlerData.js.map new file mode 100644 index 000000000..a05acfba9 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChaosHandlerData.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosHandlerData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgC;IAC5D,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC9B,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACpC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,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B;IACvB,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,iCAAiC;IACtC,GAAG,EAAE,+BAA+B;IACpC,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,4BAA4B;IACjC,GAAG,EAAE,yBAAyB;IAC9B,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,iCAAiC;CACtC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts b/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts new file mode 100644 index 000000000..2b16ba627 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts @@ -0,0 +1,62 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosHandlerOptions + */ +import { ChaosStrategy } from "./ChaosStrategy"; +import { MiddlewareOptions } from "./IMiddlewareOptions"; +/** + * Class representing ChaosHandlerOptions + * @class + * Class + * @implements MiddlewareOptions + */ +export declare class ChaosHandlerOptions implements MiddlewareOptions { + /** + * Specifies the startegy used for the Testing Handler -> RANDOM/MANUAL + * + * @public + */ + chaosStrategy: ChaosStrategy; + /** + * Status code to be returned in the response + * + * @public + */ + statusCode: number; + /** + * The Message to be returned in the response + * + * @public + */ + statusMessage: string; + /** + * The percentage of randomness/chaos in the handler + * + * Setting the default value as 10% + * @public + */ + chaosPercentage: number; + /** + * The response body to be returned in the response + * + * @public + */ + responseBody: any; + /** + * @public + * @constructor + * To create an instance of Testing Handler Options + * @param {ChaosStrategy} ChaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL + * @param {string} statusMessage - The Message to be returned in the response + * @param {number?} statusCode - The statusCode to be returned in the response + * @param {number?} chaosPercentage - The percentage of randomness/chaos in the handler + * @param {any?} responseBody - The response body to be returned in the response + * @returns An instance of ChaosHandlerOptions + */ + constructor(chaosStrategy?: ChaosStrategy, statusMessage?: string, statusCode?: number, chaosPercentage?: number, responseBody?: any); +} diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js new file mode 100644 index 000000000..1003f10d4 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js @@ -0,0 +1,40 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosHandlerOptions + */ +import { ChaosStrategy } from "./ChaosStrategy"; +/** + * Class representing ChaosHandlerOptions + * @class + * Class + * @implements MiddlewareOptions + */ +export class ChaosHandlerOptions { + /** + * @public + * @constructor + * To create an instance of Testing Handler Options + * @param {ChaosStrategy} ChaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL + * @param {string} statusMessage - The Message to be returned in the response + * @param {number?} statusCode - The statusCode to be returned in the response + * @param {number?} chaosPercentage - The percentage of randomness/chaos in the handler + * @param {any?} responseBody - The response body to be returned in the response + * @returns An instance of ChaosHandlerOptions + */ + constructor(chaosStrategy = ChaosStrategy.RANDOM, statusMessage = "Some error Happened", statusCode, chaosPercentage, responseBody) { + this.chaosStrategy = chaosStrategy; + this.statusCode = statusCode; + this.statusMessage = statusMessage; + this.chaosPercentage = chaosPercentage !== undefined ? chaosPercentage : 10; + this.responseBody = responseBody; + if (this.chaosPercentage > 100) { + throw new Error("Error Pecentage can not be more than 100"); + } + } +} +//# sourceMappingURL=ChaosHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map new file mode 100644 index 000000000..7ad1d9877 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChaosHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAqC/B;;;;;;;;;;OAUG;IACH,YAAmB,gBAA+B,aAAa,CAAC,MAAM,EAAE,gBAAwB,qBAAqB,EAAE,UAAmB,EAAE,eAAwB,EAAE,YAAkB;QACvL,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,IAAI,CAAC,eAAe,GAAG,GAAG,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC5D;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.d.ts b/test/dist/es/src/middleware/options/ChaosStrategy.d.ts new file mode 100644 index 000000000..6d6d3f38f --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosStrategy.d.ts @@ -0,0 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosStrategy + */ +/** + * Strategy used for Testing Handler + * @enum + */ +export declare enum ChaosStrategy { + MANUAL = 0, + RANDOM = 1, +} diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.js b/test/dist/es/src/middleware/options/ChaosStrategy.js new file mode 100644 index 000000000..986a693a6 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosStrategy.js @@ -0,0 +1,19 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module ChaosStrategy + */ +/** + * Strategy used for Testing Handler + * @enum + */ +export var ChaosStrategy; +(function(ChaosStrategy) { + ChaosStrategy[(ChaosStrategy["MANUAL"] = 0)] = "MANUAL"; + ChaosStrategy[(ChaosStrategy["RANDOM"] = 1)] = "RANDOM"; +})(ChaosStrategy || (ChaosStrategy = {})); +//# sourceMappingURL=ChaosStrategy.js.map diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.js.map b/test/dist/es/src/middleware/options/ChaosStrategy.js.map new file mode 100644 index 000000000..927bc5846 --- /dev/null +++ b/test/dist/es/src/middleware/options/ChaosStrategy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChaosStrategy.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosStrategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACxB,qDAAM,CAAA;IACN,qDAAM,CAAA;AACP,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts b/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts new file mode 100644 index 000000000..277236bdc --- /dev/null +++ b/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts @@ -0,0 +1,11 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @interface + * Signature representing the middleware options + */ +export interface MiddlewareOptions {} diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.js b/test/dist/es/src/middleware/options/IMiddlewareOptions.js new file mode 100644 index 000000000..6af75b995 --- /dev/null +++ b/test/dist/es/src/middleware/options/IMiddlewareOptions.js @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +//# sourceMappingURL=IMiddlewareOptions.js.map diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map b/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map new file mode 100644 index 000000000..560447882 --- /dev/null +++ b/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IMiddlewareOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/IMiddlewareOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts b/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts new file mode 100644 index 000000000..c3bde4cae --- /dev/null +++ b/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts @@ -0,0 +1,58 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module RedirectHandlerOptions + */ +import { MiddlewareOptions } from "./IMiddlewareOptions"; +/** + * @type + * A type declaration for shouldRetry callback + */ +export declare type ShouldRedirect = (response: Response) => boolean; +/** + * @class + * @implements MiddlewareOptions + * A class representing RedirectHandlerOptions + */ +export declare class RedirectHandlerOptions implements MiddlewareOptions { + /** + * @private + * @static + * A member holding default max redirects value + */ + private static DEFAULT_MAX_REDIRECTS; + /** + * @private + * @static + * A member holding maximum max redirects value + */ + private static MAX_MAX_REDIRECTS; + /** + * @public + * A member holding max redirects value + */ + maxRedirects: number; + /** + * @public + * A member holding shouldRedirect callback + */ + shouldRedirect: ShouldRedirect; + /** + * @private + * A member holding default shouldRedirect callback + */ + private static DEFAULT_SHOULD_RETRY; + /** + * @public + * @constructor + * To create an instance of RedirectHandlerOptions + * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value + * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback + * @returns An instance of RedirectHandlerOptions + */ + constructor(maxRedirects?: number, shouldRedirect?: ShouldRedirect); +} diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js new file mode 100644 index 000000000..cac35599f --- /dev/null +++ b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js @@ -0,0 +1,53 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * @implements MiddlewareOptions + * A class representing RedirectHandlerOptions + */ +export class RedirectHandlerOptions { + /** + * @public + * @constructor + * To create an instance of RedirectHandlerOptions + * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value + * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback + * @returns An instance of RedirectHandlerOptions + */ + constructor(maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY) { + if (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) { + const error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`); + error.name = "MaxLimitExceeded"; + throw error; + } + if (maxRedirects < 0) { + const error = new Error(`MaxRedirects should not be negative`); + error.name = "MinExpectationNotMet"; + throw error; + } + this.maxRedirects = maxRedirects; + this.shouldRedirect = shouldRedirect; + } +} +/** + * @private + * @static + * A member holding default max redirects value + */ +RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS = 5; +/** + * @private + * @static + * A member holding maximum max redirects value + */ +RedirectHandlerOptions.MAX_MAX_REDIRECTS = 20; +/** + * @private + * A member holding default shouldRedirect callback + */ +RedirectHandlerOptions.DEFAULT_SHOULD_RETRY = () => true; +//# sourceMappingURL=RedirectHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map new file mode 100644 index 000000000..2bb2a79a4 --- /dev/null +++ b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RedirectHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/RedirectHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAiClC;;;;;;;OAOG;IACH,YAAmB,eAAuB,sBAAsB,CAAC,qBAAqB,EAAE,iBAAiC,sBAAsB,CAAC,oBAAoB;QACnK,IAAI,YAAY,GAAG,sBAAsB,CAAC,iBAAiB,EAAE;YAC5D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,wCAAwC,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,CAAC;YAC5G,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;YAChC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,YAAY,GAAG,CAAC,EAAE;YACrB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YAC/D,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACtC,CAAC;;AArDD;;;;GAIG;AACY,4CAAqB,GAAW,CAAC,CAAC;AAEjD;;;;GAIG;AACY,wCAAiB,GAAW,EAAE,CAAC;AAc9C;;;GAGG;AACY,2CAAoB,GAAmB,GAAG,EAAE,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts b/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts new file mode 100644 index 000000000..0f0359697 --- /dev/null +++ b/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts @@ -0,0 +1,83 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module RetryHandlerOptions + */ +import { FetchOptions } from "../../IFetchOptions"; +import { MiddlewareOptions } from "./IMiddlewareOptions"; +/** + * @type + * A type declaration for shouldRetry callback + */ +export declare type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean; +/** + * @class + * @implements MiddlewareOptions + * Class for RetryHandlerOptions + */ +export declare class RetryHandlerOptions implements MiddlewareOptions { + /** + * @private + * @static + * A member holding default delay value in seconds + */ + private static DEFAULT_DELAY; + /** + * @private + * @static + * A member holding default maxRetries value + */ + private static DEFAULT_MAX_RETRIES; + /** + * @private + * @static + * A member holding maximum delay value in seconds + */ + private static MAX_DELAY; + /** + * @private + * @static + * A member holding maximum maxRetries value + */ + private static MAX_MAX_RETRIES; + /** + * @public + * A member holding delay value in seconds + */ + delay: number; + /** + * @public + * A member holding maxRetries value + */ + maxRetries: number; + /** + * @public + * A member holding shouldRetry callback + */ + shouldRetry: ShouldRetry; + /** + * @private + * A member holding default shouldRetry callback + */ + private static DEFAULT_SHOULD_RETRY; + /** + * @public + * @constructor + * To create an instance of RetryHandlerOptions + * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds + * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value + * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function + * @returns An instance of RetryHandlerOptions + */ + constructor(delay?: number, maxRetries?: number, shouldRetry?: ShouldRetry); + /** + * @public + * To get the maximum delay + * @returns A maximum delay + */ + getMaxDelay(): number; +} diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.js b/test/dist/es/src/middleware/options/RetryHandlerOptions.js new file mode 100644 index 000000000..79bfa9b6f --- /dev/null +++ b/test/dist/es/src/middleware/options/RetryHandlerOptions.js @@ -0,0 +1,90 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * @implements MiddlewareOptions + * Class for RetryHandlerOptions + */ +export class RetryHandlerOptions { + /** + * @public + * @constructor + * To create an instance of RetryHandlerOptions + * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds + * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value + * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function + * @returns An instance of RetryHandlerOptions + */ + constructor(delay = RetryHandlerOptions.DEFAULT_DELAY, maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY) { + if (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) { + const error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`); + error.name = "MaxLimitExceeded"; + throw error; + } else if (delay > RetryHandlerOptions.MAX_DELAY) { + const error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`); + error.name = "MaxLimitExceeded"; + throw error; + } else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) { + const error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`); + error.name = "MaxLimitExceeded"; + throw error; + } else if (delay < 0 && maxRetries < 0) { + const error = new Error(`Delay and MaxRetries should not be negative`); + error.name = "MinExpectationNotMet"; + throw error; + } else if (delay < 0) { + const error = new Error(`Delay should not be negative`); + error.name = "MinExpectationNotMet"; + throw error; + } else if (maxRetries < 0) { + const error = new Error(`MaxRetries should not be negative`); + error.name = "MinExpectationNotMet"; + throw error; + } + this.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY); + this.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES); + this.shouldRetry = shouldRetry; + } + /** + * @public + * To get the maximum delay + * @returns A maximum delay + */ + getMaxDelay() { + return RetryHandlerOptions.MAX_DELAY; + } +} +/** + * @private + * @static + * A member holding default delay value in seconds + */ +RetryHandlerOptions.DEFAULT_DELAY = 3; +/** + * @private + * @static + * A member holding default maxRetries value + */ +RetryHandlerOptions.DEFAULT_MAX_RETRIES = 3; +/** + * @private + * @static + * A member holding maximum delay value in seconds + */ +RetryHandlerOptions.MAX_DELAY = 180; +/** + * @private + * @static + * A member holding maximum maxRetries value + */ +RetryHandlerOptions.MAX_MAX_RETRIES = 10; +/** + * @private + * A member holding default shouldRetry callback + */ +RetryHandlerOptions.DEFAULT_SHOULD_RETRY = () => true; +//# sourceMappingURL=RetryHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map b/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map new file mode 100644 index 000000000..e5f12069b --- /dev/null +++ b/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RetryHandlerOptions.js","sourceRoot":"","sources":["../../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AA8B,CAAC,CAAC;YACxD,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;aAAM,IAAI,UAAU,GAAG,CAAC,EAAE;YAC1B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAC7D,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;QAC5E,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,WAAW;QACjB,OAAO,mBAAmB,CAAC,SAAS,CAAC;IACtC,CAAC;;AAnGD;;;;GAIG;AACY,iCAAa,GAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACY,uCAAmB,GAAW,CAAC,CAAC;AAE/C;;;;GAIG;AACY,6BAAS,GAAW,GAAG,CAAC;AAEvC;;;;GAIG;AACY,mCAAe,GAAW,EAAE,CAAC;AAoB5C;;;GAGG;AACY,wCAAoB,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts new file mode 100644 index 000000000..4331b4feb --- /dev/null +++ b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts @@ -0,0 +1,58 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module TelemetryHandlerOptions + */ +import { Context } from "../../IContext"; +import { MiddlewareOptions } from "./IMiddlewareOptions"; +/** + * @enum + * @property {number} NONE - The hexadecimal flag value for nothing enabled + * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled + * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled + * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled + */ +export declare enum FeatureUsageFlag { + NONE = 0, + REDIRECT_HANDLER_ENABLED = 1, + RETRY_HANDLER_ENABLED = 2, + AUTHENTICATION_HANDLER_ENABLED = 4, +} +/** + * @class + * @implements MiddlewareOptions + * Class for TelemetryHandlerOptions + */ +export declare class TelemetryHandlerOptions implements MiddlewareOptions { + /** + * @private + * A member to hold the OR of feature usage flags + */ + private featureUsage; + /** + * @public + * @static + * To update the feature usage in the context object + * @param {Context} context - The request context object containing middleware options + * @param {FeatureUsageFlag} flag - The flag value + * @returns nothing + */ + static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void; + /** + * @private + * To set the feature usage flag + * @param {FeatureUsageFlag} flag - The flag value + * @returns nothing + */ + private setFeatureUsage; + /** + * @public + * To get the feature usage + * @returns A feature usage flag as hexadecimal string + */ + getFeatureUsage(): string; +} diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js new file mode 100644 index 000000000..9d3b929ac --- /dev/null +++ b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js @@ -0,0 +1,76 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { MiddlewareControl } from "../MiddlewareControl"; +/** + * @enum + * @property {number} NONE - The hexadecimal flag value for nothing enabled + * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled + * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled + * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled + */ +export var FeatureUsageFlag; +(function(FeatureUsageFlag) { + FeatureUsageFlag[(FeatureUsageFlag["NONE"] = 0)] = "NONE"; + FeatureUsageFlag[(FeatureUsageFlag["REDIRECT_HANDLER_ENABLED"] = 1)] = "REDIRECT_HANDLER_ENABLED"; + FeatureUsageFlag[(FeatureUsageFlag["RETRY_HANDLER_ENABLED"] = 2)] = "RETRY_HANDLER_ENABLED"; + FeatureUsageFlag[(FeatureUsageFlag["AUTHENTICATION_HANDLER_ENABLED"] = 4)] = "AUTHENTICATION_HANDLER_ENABLED"; +})(FeatureUsageFlag || (FeatureUsageFlag = {})); +/** + * @class + * @implements MiddlewareOptions + * Class for TelemetryHandlerOptions + */ +export class TelemetryHandlerOptions { + constructor() { + /** + * @private + * A member to hold the OR of feature usage flags + */ + this.featureUsage = FeatureUsageFlag.NONE; + } + /** + * @public + * @static + * To update the feature usage in the context object + * @param {Context} context - The request context object containing middleware options + * @param {FeatureUsageFlag} flag - The flag value + * @returns nothing + */ + static updateFeatureUsageFlag(context, flag) { + let options; + if (context.middlewareControl instanceof MiddlewareControl) { + options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); + } else { + context.middlewareControl = new MiddlewareControl(); + } + if (typeof options === "undefined") { + options = new TelemetryHandlerOptions(); + context.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options); + } + options.setFeatureUsage(flag); + } + /** + * @private + * To set the feature usage flag + * @param {FeatureUsageFlag} flag - The flag value + * @returns nothing + */ + setFeatureUsage(flag) { + /* tslint:disable: no-bitwise */ + this.featureUsage = this.featureUsage | flag; + /* tslint:enable: no-bitwise */ + } + /** + * @public + * To get the feature usage + * @returns A feature usage flag as hexadecimal string + */ + getFeatureUsage() { + return this.featureUsage.toString(16); + } +} +//# sourceMappingURL=TelemetryHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map new file mode 100644 index 000000000..beff023b0 --- /dev/null +++ b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TelemetryHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/TelemetryHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,uDAAU,CAAA;IACV,+FAA8B,CAAA;IAC9B,yFAA2B,CAAA;IAC3B,2GAAoC,CAAA;AACrC,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;;;GAIG;AAEH,MAAM,OAAO,uBAAuB;IAApC;QACC;;;WAGG;QACK,iBAAY,GAAqB,gBAAgB,CAAC,IAAI,CAAC;IA4ChE,CAAC;IA1CA;;;;;;;OAOG;IACI,MAAM,CAAC,sBAAsB,CAAC,OAAgB,EAAE,IAAsB;QAC5E,IAAI,OAAgC,CAAC;QACrC,IAAI,OAAO,CAAC,iBAAiB,YAAY,iBAAiB,EAAE;YAC3D,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,uBAAuB,CAA4B,CAAC;SAC7G;aAAM;YACN,OAAO,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;SACpD;QACD,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;YACnC,OAAO,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACxC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;SACjF;QACD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACK,eAAe,CAAC,IAAsB;QAC7C,gCAAgC;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7C,+BAA+B;IAChC,CAAC;IAED;;;;OAIG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.d.ts b/test/dist/es/src/tasks/LargeFileUploadTask.d.ts new file mode 100644 index 000000000..abcff1cf5 --- /dev/null +++ b/test/dist/es/src/tasks/LargeFileUploadTask.d.ts @@ -0,0 +1,172 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module LargeFileUploadTask + */ +import { Client } from "../index"; +import { Range } from "../Range"; +/** + * @interface + * Signature to representing key value pairs + * @property {[key: string] : string | number} - The Key value pair + */ +interface KeyValuePairObjectStringNumber { + [key: string]: string | number; +} +/** + * @interface + * Signature to define options for upload task + * @property {number} [rangeSize = LargeFileUploadTask.DEFAULT_FILE_SIZE] - Specifies the range chunk size + */ +export interface LargeFileUploadTaskOptions { + rangeSize?: number; +} +/** + * @interface + * Signature to represent upload session resulting from the session creation in the server + * @property {string} url - The URL to which the file upload is made + * @property {Date} expiry - The expiration of the time of the upload session + */ +export interface LargeFileUploadSession { + url: string; + expiry: Date; +} +/** + * @interface + * Signature to define the properties and content of the file in upload task + * @property {ArrayBuffer | File} content - The actual file content + * @property {string} name - Specifies the file name with extension + * @property {number} size - Specifies size of the file + */ +export interface FileObject { + content: ArrayBuffer | File; + name: string; + size: number; +} +/** + * @class + * Class representing LargeFileUploadTask + */ +export declare class LargeFileUploadTask { + /** + * @private + * Default value for the rangeSize + */ + private DEFAULT_FILE_SIZE; + /** + * @protected + * The GraphClient instance + */ + protected client: Client; + /** + * @protected + * The object holding file details + */ + protected file: FileObject; + /** + * @protected + * The object holding options for the task + */ + protected options: LargeFileUploadTaskOptions; + /** + * @protected + * The object for upload session + */ + protected uploadSession: LargeFileUploadSession; + /** + * @protected + * The next range needs to be uploaded + */ + protected nextRange: Range; + /** + * @public + * @static + * @async + * Makes request to the server to create an upload session + * @param {Client} client - The GraphClient instance + * @param {any} payload - The payload that needs to be sent + * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent + * @returns The promise that resolves to LargeFileUploadSession + */ + static createUploadSession(client: Client, requestUrl: string, payload: any, headers?: KeyValuePairObjectStringNumber): Promise; + /** + * @public + * @constructor + * Constructs a LargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded + * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done + * @param {LargeFileUploadTaskOptions} options - The upload task options + * @returns An instance of LargeFileUploadTask + */ + constructor(client: Client, file: FileObject, uploadSession: LargeFileUploadSession, options?: LargeFileUploadTaskOptions); + /** + * @private + * Parses given range string to the Range instance + * @param {string[]} ranges - The ranges value + * @returns The range instance + */ + private parseRange; + /** + * @private + * Updates the expiration date and the next range + * @param {UploadStatusResponse} response - The response of the upload status + * @returns Nothing + */ + private updateTaskStatus; + /** + * @public + * Gets next range that needs to be uploaded + * @returns The range instance + */ + getNextRange(): Range; + /** + * @public + * Slices the file content to the given range + * @param {Range} range - The range value + * @returns The sliced ArrayBuffer or Blob + */ + sliceFile(range: Range): ArrayBuffer | Blob; + /** + * @public + * @async + * Uploads file to the server in a sequential order by slicing the file + * @returns The promise resolves to uploaded response + */ + upload(): Promise; + /** + * @public + * @async + * Uploads given slice to the server + * @param {ArrayBuffer | Blob | File} fileSlice - The file slice + * @param {Range} range - The range value + * @param {number} totalSize - The total size of a complete file + */ + uploadSlice(fileSlice: ArrayBuffer | Blob | File, range: Range, totalSize: number): Promise; + /** + * @public + * @async + * Deletes upload session in the server + * @returns The promise resolves to cancelled response + */ + cancel(): Promise; + /** + * @public + * @async + * Gets status for the upload session + * @returns The promise resolves to the status enquiry response + */ + getStatus(): Promise; + /** + * @public + * @async + * Resumes upload session and continue uploading the file from the last sent range + * @returns The promise resolves to the uploaded response + */ + resume(): Promise; +} +export {}; diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.js b/test/dist/es/src/tasks/LargeFileUploadTask.js new file mode 100644 index 000000000..8db182747 --- /dev/null +++ b/test/dist/es/src/tasks/LargeFileUploadTask.js @@ -0,0 +1,223 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { Range } from "../Range"; +/** + * @class + * Class representing LargeFileUploadTask + */ +export class LargeFileUploadTask { + /** + * @public + * @constructor + * Constructs a LargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded + * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done + * @param {LargeFileUploadTaskOptions} options - The upload task options + * @returns An instance of LargeFileUploadTask + */ + constructor(client, file, uploadSession, options = {}) { + /** + * @private + * Default value for the rangeSize + */ + this.DEFAULT_FILE_SIZE = 5 * 1024 * 1024; + this.client = client; + this.file = file; + if (options.rangeSize === undefined) { + options.rangeSize = this.DEFAULT_FILE_SIZE; + } + this.options = options; + this.uploadSession = uploadSession; + this.nextRange = new Range(0, this.options.rangeSize - 1); + } + /** + * @public + * @static + * @async + * Makes request to the server to create an upload session + * @param {Client} client - The GraphClient instance + * @param {any} payload - The payload that needs to be sent + * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent + * @returns The promise that resolves to LargeFileUploadSession + */ + static createUploadSession(client, requestUrl, payload, headers = {}) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const session = yield client + .api(requestUrl) + .headers(headers) + .post(payload); + const largeFileUploadSession = { + url: session.uploadUrl, + expiry: new Date(session.expirationDateTime), + }; + return largeFileUploadSession; + } catch (err) { + throw err; + } + }); + } + /** + * @private + * Parses given range string to the Range instance + * @param {string[]} ranges - The ranges value + * @returns The range instance + */ + parseRange(ranges) { + const rangeStr = ranges[0]; + if (typeof rangeStr === "undefined" || rangeStr === "") { + return new Range(); + } + const firstRange = rangeStr.split("-"); + const minVal = parseInt(firstRange[0], 10); + let maxVal = parseInt(firstRange[1], 10); + if (Number.isNaN(maxVal)) { + maxVal = this.file.size - 1; + } + return new Range(minVal, maxVal); + } + /** + * @private + * Updates the expiration date and the next range + * @param {UploadStatusResponse} response - The response of the upload status + * @returns Nothing + */ + updateTaskStatus(response) { + this.uploadSession.expiry = new Date(response.expirationDateTime); + this.nextRange = this.parseRange(response.nextExpectedRanges); + } + /** + * @public + * Gets next range that needs to be uploaded + * @returns The range instance + */ + getNextRange() { + if (this.nextRange.minValue === -1) { + return this.nextRange; + } + const minVal = this.nextRange.minValue; + let maxValue = minVal + this.options.rangeSize - 1; + if (maxValue >= this.file.size) { + maxValue = this.file.size - 1; + } + return new Range(minVal, maxValue); + } + /** + * @public + * Slices the file content to the given range + * @param {Range} range - The range value + * @returns The sliced ArrayBuffer or Blob + */ + sliceFile(range) { + const blob = this.file.content.slice(range.minValue, range.maxValue + 1); + return blob; + } + /** + * @public + * @async + * Uploads file to the server in a sequential order by slicing the file + * @returns The promise resolves to uploaded response + */ + upload() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + while (true) { + const nextRange = this.getNextRange(); + if (nextRange.maxValue === -1) { + const err = new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file"); + err.name = "Invalid Session"; + throw err; + } + const fileSlice = this.sliceFile(nextRange); + const response = yield this.uploadSlice(fileSlice, nextRange, this.file.size); + // Upon completion of upload process incase of onedrive, driveItem is returned, which contains id + if (response.id !== undefined) { + return response; + } else { + this.updateTaskStatus(response); + } + } + } catch (err) { + throw err; + } + }); + } + /** + * @public + * @async + * Uploads given slice to the server + * @param {ArrayBuffer | Blob | File} fileSlice - The file slice + * @param {Range} range - The range value + * @param {number} totalSize - The total size of a complete file + */ + uploadSlice(fileSlice, range, totalSize) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return yield this.client + .api(this.uploadSession.url) + .headers({ + "Content-Length": `${range.maxValue - range.minValue + 1}`, + "Content-Range": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`, + }) + .put(fileSlice); + } catch (err) { + throw err; + } + }); + } + /** + * @public + * @async + * Deletes upload session in the server + * @returns The promise resolves to cancelled response + */ + cancel() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return yield this.client.api(this.uploadSession.url).delete(); + } catch (err) { + throw err; + } + }); + } + /** + * @public + * @async + * Gets status for the upload session + * @returns The promise resolves to the status enquiry response + */ + getStatus() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const response = yield this.client.api(this.uploadSession.url).get(); + this.updateTaskStatus(response); + return response; + } catch (err) { + throw err; + } + }); + } + /** + * @public + * @async + * Resumes upload session and continue uploading the file from the last sent range + * @returns The promise resolves to the uploaded response + */ + resume() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + yield this.getStatus(); + return yield this.upload(); + } catch (err) { + throw err; + } + }); + } +} +//# sourceMappingURL=LargeFileUploadTask.js.map diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.js.map b/test/dist/es/src/tasks/LargeFileUploadTask.js.map new file mode 100644 index 000000000..2cca17b24 --- /dev/null +++ b/test/dist/es/src/tasks/LargeFileUploadTask.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../src/tasks/LargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAuDjC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA+D/B;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,IAAgB,EAAE,aAAqC,EAAE,UAAsC,EAAE;QAxEpI;;;WAGG;QACK,sBAAiB,GAAW,CAAC,GAAG,IAAI,GAAG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;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM;;YAClB,IAAI;gBACH,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;aAC9D;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,SAAS;;YACrB,IAAI;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;gBACrE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBAChC,OAAO,QAAQ,CAAC;aAChB;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM;;YAClB,IAAI;gBACH,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;gBACvB,OAAO,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;aAC3B;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts new file mode 100644 index 000000000..5726eeebd --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts @@ -0,0 +1,86 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/// +/** + * @module OneDriveLargeFileUploadTask + */ +import { Client } from "../index"; +import { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from "./LargeFileUploadTask"; +/** + * @interface + * Signature to define options when creating an upload task + * @property {string} fileName - Specifies the name of a file to be uploaded (with extension) + * @property {string} [path] - The path to which the file needs to be uploaded + * @property {number} [rangeSize] - Specifies the range chunk size + */ +interface OneDriveLargeFileUploadOptions { + fileName: string; + path?: string; + rangeSize?: number; +} +/** + * @class + * Class representing OneDriveLargeFileUploadTask + */ +export declare class OneDriveLargeFileUploadTask extends LargeFileUploadTask { + /** + * @private + * @static + * Default path for the file being uploaded + */ + private static DEFAULT_UPLOAD_PATH; + /** + * @private + * @static + * Constructs the create session url for Onedrive + * @param {string} fileName - The name of the file + * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload + * @returns The constructed create session url + */ + private static constructCreateSessionUrl; + /** + * @public + * @static + * @async + * Creates a OneDriveLargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {Blob | Buffer | File} file - File represented as Blob, Buffer or File + * @param {OneDriveLargeFileUploadOptions} options - The options for upload task + * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance + */ + static create(client: Client, file: Blob | Buffer | File, options: OneDriveLargeFileUploadOptions): Promise; + /** + * @public + * @static + * @async + * Makes request to the server to create an upload session + * @param {Client} client - The GraphClient instance + * @param {string} requestUrl - The URL to create the upload session + * @param {string} fileName - The name of a file to upload, (with extension) + * @returns The promise that resolves to LargeFileUploadSession + */ + static createUploadSession(client: Client, requestUrl: string, fileName: string): Promise; + /** + * @public + * @constructor + * Constructs a OneDriveLargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded + * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done + * @param {LargeFileUploadTaskOptions} options - The upload task options + * @returns An instance of OneDriveLargeFileUploadTask + */ + constructor(client: Client, file: FileObject, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions); + /** + * @public + * Commits upload session to end uploading + * @param {string} requestUrl - The URL to commit the upload session + * @returns The promise resolves to committed response + */ + commit(requestUrl: string): Promise; +} +export {}; diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js new file mode 100644 index 000000000..489db2d22 --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js @@ -0,0 +1,153 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { LargeFileUploadTask } from "./LargeFileUploadTask"; +import { getValidRangeSize } from "./OneDriveLargeFileUploadTaskUtil"; +/** + * @class + * Class representing OneDriveLargeFileUploadTask + */ +export class OneDriveLargeFileUploadTask extends LargeFileUploadTask { + /** + * @public + * @constructor + * Constructs a OneDriveLargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded + * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done + * @param {LargeFileUploadTaskOptions} options - The upload task options + * @returns An instance of OneDriveLargeFileUploadTask + */ + constructor(client, file, uploadSession, options) { + super(client, file, uploadSession, options); + } + /** + * @private + * @static + * Constructs the create session url for Onedrive + * @param {string} fileName - The name of the file + * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload + * @returns The constructed create session url + */ + static constructCreateSessionUrl(fileName, path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH) { + fileName = fileName.trim(); + path = path.trim(); + if (path === "") { + path = "/"; + } + if (path[0] !== "/") { + path = `/${path}`; + } + if (path[path.length - 1] !== "/") { + path = `${path}/`; + } + // we choose to encode each component of the file path separately because when encoding full URI + // with encodeURI, special characters like # or % in the file name doesn't get encoded as desired + return `/me/drive/root:${path + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/")}${encodeURIComponent(fileName)}:/createUploadSession`; + } + /** + * @public + * @static + * @async + * Creates a OneDriveLargeFileUploadTask + * @param {Client} client - The GraphClient instance + * @param {Blob | Buffer | File} file - File represented as Blob, Buffer or File + * @param {OneDriveLargeFileUploadOptions} options - The options for upload task + * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance + */ + static create(client, file, options) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const name = options.fileName; + let content; + let size; + if (typeof Blob !== "undefined" && file instanceof Blob) { + content = new File([file], name); + size = content.size; + } else if (typeof File !== "undefined" && file instanceof File) { + content = file; + size = content.size; + } else if (typeof Buffer !== "undefined" && file instanceof Buffer) { + const b = file; + size = b.byteLength - b.byteOffset; + content = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength); + } + try { + const requestUrl = OneDriveLargeFileUploadTask.constructCreateSessionUrl(options.fileName, options.path); + const session = yield OneDriveLargeFileUploadTask.createUploadSession(client, requestUrl, options.fileName); + const rangeSize = getValidRangeSize(options.rangeSize); + const fileObj = { + name, + content, + size, + }; + return new OneDriveLargeFileUploadTask(client, fileObj, session, { + rangeSize, + }); + } catch (err) { + throw err; + } + }); + } + /** + * @public + * @static + * @async + * Makes request to the server to create an upload session + * @param {Client} client - The GraphClient instance + * @param {string} requestUrl - The URL to create the upload session + * @param {string} fileName - The name of a file to upload, (with extension) + * @returns The promise that resolves to LargeFileUploadSession + */ + static createUploadSession(client, requestUrl, fileName) { + const _super = Object.create(null, { + createUploadSession: { get: () => super.createUploadSession }, + }); + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const payload = { + item: { + "@microsoft.graph.conflictBehavior": "rename", + name: fileName, + }, + }; + try { + return _super.createUploadSession.call(this, client, requestUrl, payload); + } catch (err) { + throw err; + } + }); + } + /** + * @public + * Commits upload session to end uploading + * @param {string} requestUrl - The URL to commit the upload session + * @returns The promise resolves to committed response + */ + commit(requestUrl) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const payload = { + name: this.file.name, + "@microsoft.graph.conflictBehavior": "rename", + "@microsoft.graph.sourceUrl": this.uploadSession.url, + }; + return yield this.client.api(requestUrl).put(payload); + } catch (err) { + throw err; + } + }); + } +} +/** + * @private + * @static + * Default path for the file being uploaded + */ +OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH = "/"; +//# sourceMappingURL=OneDriveLargeFileUploadTask.js.map diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map new file mode 100644 index 000000000..4da5c589b --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OneDriveLargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../src/tasks/OneDriveLargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH,OAAO,EAAsC,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAetE;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,mBAAmB;IAuGnE;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,IAAgB,EAAE,aAAqC,EAAE,OAAmC;QAC9H,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IA3GD;;;;;;;OAOG;IACK,MAAM,CAAC,yBAAyB,CAAC,QAAgB,EAAE,OAAe,2BAA2B,CAAC,mBAAmB;QACxH,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,IAAI,KAAK,EAAE,EAAE;YAChB,IAAI,GAAG,GAAG,CAAC;SACX;QACD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACpB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;SAClB;QACD,IAAI,IAAI,C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EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;;AArID;;;;GAIG;AACY,+CAAmB,GAAW,GAAG,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts new file mode 100644 index 000000000..5f59e5e20 --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts @@ -0,0 +1,15 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @constant + * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here + * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session}) + * + * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value. + * @returns The valid rangeSize + */ +export declare const getValidRangeSize: (rangeSize?: number) => number; diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js new file mode 100644 index 000000000..b7999dfee --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js @@ -0,0 +1,43 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module OneDriveLargeFileUploadTaskUtil + */ +/** + * @constant + * Default value for the rangeSize + * Recommended size is between 5 - 10 MB {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#best-practices} + */ +const DEFAULT_FILE_SIZE = 5 * 1024 * 1024; +/** + * @constant + * Rounds off the given value to a multiple of 320 KB + * @param {number} value - The value + * @returns The rounded off value + */ +const roundTo320KB = (value) => { + if (value > 320 * 1024) { + value = Math.floor(value / (320 * 1024)) * 320 * 1024; + } + return value; +}; +/** + * @constant + * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here + * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session}) + * + * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value. + * @returns The valid rangeSize + */ +export const getValidRangeSize = (rangeSize = DEFAULT_FILE_SIZE) => { + const sixtyMB = 60 * 1024 * 1024; + if (rangeSize > sixtyMB) { + rangeSize = sixtyMB; + } + return roundTo320KB(rangeSize); +}; +//# sourceMappingURL=OneDriveLargeFileUploadTaskUtil.js.map diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map new file mode 100644 index 000000000..a0f48e2eb --- /dev/null +++ b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OneDriveLargeFileUploadTaskUtil.js","sourceRoot":"","sources":["../../../../../src/tasks/OneDriveLargeFileUploadTaskUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,MAAM,iBAAiB,GAAW,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IAC9C,IAAI,KAAK,GAAG,GAAG,GAAG,IAAI,EAAE;QACvB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;KACtD;IACD,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAoB,iBAAiB,EAAU,EAAE;IAClF,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,IAAI,SAAS,GAAG,OAAO,EAAE;QACxB,SAAS,GAAG,OAAO,CAAC;KACpB;IACD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/PageIterator.d.ts b/test/dist/es/src/tasks/PageIterator.d.ts new file mode 100644 index 000000000..f795aea55 --- /dev/null +++ b/test/dist/es/src/tasks/PageIterator.d.ts @@ -0,0 +1,134 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module PageIterator + */ +import { FetchOptions } from "../IFetchOptions"; +import { Client } from "../index"; +import { MiddlewareOptions } from "../middleware/options/IMiddlewareOptions"; +/** + * Signature representing PageCollection + * @property {any[]} value - The collection value + * @property {string} [@odata.nextLink] - The nextLink value + * @property {string} [@odata.deltaLink] - The deltaLink value + * @property {any} Additional - Any number of additional properties (This is to accept the any additional data returned by in the response to the nextLink request) + */ +export interface PageCollection { + value: any[]; + "@odata.nextLink"?: string; + "@odata.deltaLink"?: string; + [Key: string]: any; +} +/** + * Signature to define the request options to be sent during request. + * The values of the GraphRequestOptions properties are passed to the Graph Request object. + * @property {HeadersInit} headers - the header options for the request + * @property {MiddlewareOptions[]} middlewareoptions - The middleware options for the request + * @property {FetchOptions} options - The fetch options for the request + */ +export interface GraphRequestOptions { + headers?: HeadersInit; + middlewareOptions?: MiddlewareOptions[]; + options?: FetchOptions; +} +/** + * Signature representing callback for page iterator + * @property {Function} callback - The callback function which should return boolean to continue the continue/stop the iteration. + */ +export declare type PageIteratorCallback = (data: any) => boolean; +/** + * @class + * Class for PageIterator + */ +export declare class PageIterator { + /** + * @private + * Member holding the GraphClient instance + */ + private client; + /** + * @private + * Member holding the page collection + */ + private collection; + /** + * @private + * Member variable referring to nextLink of the page collection + */ + private nextLink; + /** + * @private + * Member variable referring to deltaLink of the request + */ + private deltaLink; + /** + * @private + * Holding callback for Iteration. + */ + private callback; + /** + * @private + * Member holding a complete/incomplete status of an iterator + */ + private complete; + /** + * Information to be added to the request + */ + private requestOptions; + /** + * @public + * @constructor + * Creates new instance for PageIterator + * @param {Client} client - The graph client instance + * @param {PageCollection} pageCollection - The page collection object + * @param {PageIteratorCallback} callBack - The callback function + * @param {GraphRequestOptions} requestOptions - The request options + * @returns An instance of a PageIterator + */ + constructor(client: Client, pageCollection: PageCollection, callback: PageIteratorCallback, requestOptions?: GraphRequestOptions); + /** + * @private + * Iterates over a collection by enqueuing entries one by one and kicking the callback with the enqueued entry + * @returns A boolean indicating the continue flag to process next page + */ + private iterationHelper; + /** + * @private + * @async + * Helper to make a get request to fetch next page with nextLink url and update the page iterator instance with the returned response + * @returns A promise that resolves to a response data with next page collection + */ + private fetchAndUpdateNextPageData; + /** + * @public + * Getter to get the deltaLink in the current response + * @returns A deltaLink which is being used to make delta requests in future + */ + getDeltaLink(): string | undefined; + /** + * @public + * @async + * Iterates over the collection and kicks callback for each item on iteration. Fetches next set of data through nextLink and iterates over again + * This happens until the nextLink is drained out or the user responds with a red flag to continue from callback + * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy. + */ + iterate(): Promise; + /** + * @public + * @async + * To resume the iteration + * Note: This internally calls the iterate method, It's just for more readability. + * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy + */ + resume(): Promise; + /** + * @public + * To get the completeness status of the iterator + * @returns Boolean indicating the completeness + */ + isComplete(): boolean; +} diff --git a/test/dist/es/src/tasks/PageIterator.js b/test/dist/es/src/tasks/PageIterator.js new file mode 100644 index 000000000..e56f47a8e --- /dev/null +++ b/test/dist/es/src/tasks/PageIterator.js @@ -0,0 +1,138 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * Class for PageIterator + */ +export class PageIterator { + /** + * @public + * @constructor + * Creates new instance for PageIterator + * @param {Client} client - The graph client instance + * @param {PageCollection} pageCollection - The page collection object + * @param {PageIteratorCallback} callBack - The callback function + * @param {GraphRequestOptions} requestOptions - The request options + * @returns An instance of a PageIterator + */ + constructor(client, pageCollection, callback, requestOptions) { + this.client = client; + this.collection = pageCollection.value; + this.nextLink = pageCollection["@odata.nextLink"]; + this.deltaLink = pageCollection["@odata.deltaLink"]; + this.callback = callback; + this.complete = false; + this.requestOptions = requestOptions; + } + /** + * @private + * Iterates over a collection by enqueuing entries one by one and kicking the callback with the enqueued entry + * @returns A boolean indicating the continue flag to process next page + */ + iterationHelper() { + if (this.collection === undefined) { + return false; + } + let advance = true; + while (advance && this.collection.length !== 0) { + const item = this.collection.shift(); + advance = this.callback(item); + } + return advance; + } + /** + * @private + * @async + * Helper to make a get request to fetch next page with nextLink url and update the page iterator instance with the returned response + * @returns A promise that resolves to a response data with next page collection + */ + fetchAndUpdateNextPageData() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + let graphRequest = this.client.api(this.nextLink); + if (this.requestOptions) { + if (this.requestOptions.headers) { + graphRequest = graphRequest.headers(this.requestOptions.headers); + } + if (this.requestOptions.middlewareOptions) { + graphRequest = graphRequest.middlewareOptions(this.requestOptions.middlewareOptions); + } + if (this.requestOptions.options) { + graphRequest = graphRequest.options(this.requestOptions.options); + } + } + const response = yield graphRequest.get(); + this.collection = response.value; + this.nextLink = response["@odata.nextLink"]; + this.deltaLink = response["@odata.deltaLink"]; + } catch (error) { + throw error; + } + }); + } + /** + * @public + * Getter to get the deltaLink in the current response + * @returns A deltaLink which is being used to make delta requests in future + */ + getDeltaLink() { + return this.deltaLink; + } + /** + * @public + * @async + * Iterates over the collection and kicks callback for each item on iteration. Fetches next set of data through nextLink and iterates over again + * This happens until the nextLink is drained out or the user responds with a red flag to continue from callback + * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy. + */ + iterate() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + let advance = this.iterationHelper(); + while (advance) { + if (this.nextLink !== undefined) { + yield this.fetchAndUpdateNextPageData(); + advance = this.iterationHelper(); + } else { + advance = false; + } + } + if (this.nextLink === undefined && this.collection.length === 0) { + this.complete = true; + } + } catch (error) { + throw error; + } + }); + } + /** + * @public + * @async + * To resume the iteration + * Note: This internally calls the iterate method, It's just for more readability. + * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy + */ + resume() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + return this.iterate(); + } catch (error) { + throw error; + } + }); + } + /** + * @public + * To get the completeness status of the iterator + * @returns Boolean indicating the completeness + */ + isComplete() { + return this.complete; + } +} +//# sourceMappingURL=PageIterator.js.map diff --git a/test/dist/es/src/tasks/PageIterator.js.map b/test/dist/es/src/tasks/PageIterator.js.map new file mode 100644 index 000000000..4e3c4c44e --- /dev/null +++ b/test/dist/es/src/tasks/PageIterator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PageIterator.js","sourceRoot":"","sources":["../../../../../src/tasks/PageIterator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AA4CH;;;GAGG;AACH,MAAM,OAAO,YAAY;IA2CxB;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,cAA8B,EAAE,QAA8B,EAAE,cAAoC;QACtI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,cAAc,CA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AAC,kBAAkB,CAAC,CAAC;aAC9C;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACU,OAAO;;YACnB,IAAI;gBACH,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrC,OAAO,OAAO,EAAE;oBACf,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;wBAChC,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;wBACxC,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;qBACjC;yBAAM;wBACN,OAAO,GAAG,KAAK,CAAC;qBAChB;iBACD;gBACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;oBAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;iBACrB;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,MAAM;;YAClB,IAAI;gBACH,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;aACtB;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;OAIG;IACI,UAAU;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/DummyAuthenticationProvider.d.ts b/test/dist/es/test/DummyAuthenticationProvider.d.ts new file mode 100644 index 000000000..c0a51386d --- /dev/null +++ b/test/dist/es/test/DummyAuthenticationProvider.d.ts @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module DummyAuthenticationProvider + */ +import { AuthenticationProvider } from "../src/IAuthenticationProvider"; +/** + * @class + * @implements AuthenticationProvider + * Class representing DummyAuthenticationProvider + */ +export declare class DummyAuthenticationProvider implements AuthenticationProvider { + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken(): Promise; +} diff --git a/test/dist/es/test/DummyAuthenticationProvider.js b/test/dist/es/test/DummyAuthenticationProvider.js new file mode 100644 index 000000000..7c0f06fc7 --- /dev/null +++ b/test/dist/es/test/DummyAuthenticationProvider.js @@ -0,0 +1,27 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * @implements AuthenticationProvider + * Class representing DummyAuthenticationProvider + */ +export class DummyAuthenticationProvider { + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const token = "DUMMY_TOKEN"; + return Promise.resolve(token); + }); + } +} +//# sourceMappingURL=DummyAuthenticationProvider.js.map diff --git a/test/dist/es/test/DummyAuthenticationProvider.js.map b/test/dist/es/test/DummyAuthenticationProvider.js.map new file mode 100644 index 000000000..8abdb1b4a --- /dev/null +++ b/test/dist/es/test/DummyAuthenticationProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyAuthenticationProvider.js","sourceRoot":"","sources":["../../../DummyAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IACvC;;;;;OAKG;IACU,cAAc;;YAC1B,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.d.ts b/test/dist/es/test/common/DummyAuthenticationProvider.d.ts new file mode 100644 index 000000000..7f458e752 --- /dev/null +++ b/test/dist/es/test/common/DummyAuthenticationProvider.d.ts @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module DummyAuthenticationProvider + */ +import { AuthenticationProvider } from "../../src/IAuthenticationProvider"; +/** + * @class + * @implements AuthenticationProvider + * Class representing DummyAuthenticationProvider + */ +export declare class DummyAuthenticationProvider implements AuthenticationProvider { + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken(): Promise; +} diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.js b/test/dist/es/test/common/DummyAuthenticationProvider.js new file mode 100644 index 000000000..7c0f06fc7 --- /dev/null +++ b/test/dist/es/test/common/DummyAuthenticationProvider.js @@ -0,0 +1,27 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * @implements AuthenticationProvider + * Class representing DummyAuthenticationProvider + */ +export class DummyAuthenticationProvider { + /** + * @public + * @async + * To get the access token + * @returns The promise that resolves to an access token + */ + getAccessToken() { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + const token = "DUMMY_TOKEN"; + return Promise.resolve(token); + }); + } +} +//# sourceMappingURL=DummyAuthenticationProvider.js.map diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.js.map b/test/dist/es/test/common/DummyAuthenticationProvider.js.map new file mode 100644 index 000000000..ab14869e9 --- /dev/null +++ b/test/dist/es/test/common/DummyAuthenticationProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyAuthenticationProvider.js","sourceRoot":"","sources":["../../../../common/DummyAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IACvC;;;;;OAKG;IACU,cAAc;;YAC1B,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts b/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts new file mode 100644 index 000000000..4df35323d --- /dev/null +++ b/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts @@ -0,0 +1,46 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module DummyHTTPMessageHandler + */ +import { Context } from "../../src/IContext"; +import { Middleware } from "../../src/middleware/IMiddleware"; +/** + * @class + * @implements Middleware + * Class representing DummyHTTPMessageHandler + */ +export declare class DummyHTTPMessageHandler implements Middleware { + /** + * @private + * A member holding the array of response objects + */ + private responses; + /** + * @public + * @constructor + * To create an instance of DummyHTTPMessageHandler + * @param {Response[]} [responses = []] - The array of response objects + * @returns An instance of DummyHTTPMessageHandler + */ + constructor(responses?: Response[]); + /** + * @public + * To set the array of responses + * @param {Response[]} response - The array of responses + * @returns Nothing + */ + setResponses(responses: Response[]): void; + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The request context object + * @returns A promise that resolves to nothing + */ + execute(context: Context): Promise; +} diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.js b/test/dist/es/test/common/DummyHTTPMessageHandler.js new file mode 100644 index 000000000..01ee72001 --- /dev/null +++ b/test/dist/es/test/common/DummyHTTPMessageHandler.js @@ -0,0 +1,47 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +/** + * @class + * @implements Middleware + * Class representing DummyHTTPMessageHandler + */ +export class DummyHTTPMessageHandler { + /** + * @public + * @constructor + * To create an instance of DummyHTTPMessageHandler + * @param {Response[]} [responses = []] - The array of response objects + * @returns An instance of DummyHTTPMessageHandler + */ + constructor(responses = []) { + this.responses = responses; + } + /** + * @public + * To set the array of responses + * @param {Response[]} response - The array of responses + * @returns Nothing + */ + setResponses(responses) { + this.responses = responses; + } + /** + * @public + * @async + * To execute the current middleware + * @param {Context} context - The request context object + * @returns A promise that resolves to nothing + */ + execute(context) { + return tslib_1.__awaiter(this, void 0, void 0, function*() { + context.response = this.responses.shift(); + return; + }); + } +} +//# sourceMappingURL=DummyHTTPMessageHandler.js.map diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.js.map b/test/dist/es/test/common/DummyHTTPMessageHandler.js.map new file mode 100644 index 000000000..8f9b9b5f0 --- /dev/null +++ b/test/dist/es/test/common/DummyHTTPMessageHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyHTTPMessageHandler.js","sourceRoot":"","sources":["../../../../common/DummyHTTPMessageHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAOnC;;;;;;OAMG;IACH,YAAmB,YAAwB,EAAE;QAC5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,SAAqB;QACxC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC1C,OAAO;QACR,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyHandlerOptions.d.ts b/test/dist/es/test/common/DummyHandlerOptions.d.ts new file mode 100644 index 000000000..44253ffe6 --- /dev/null +++ b/test/dist/es/test/common/DummyHandlerOptions.d.ts @@ -0,0 +1,30 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module DummyHandlerOptions + */ +import { MiddlewareOptions } from "../../src/middleware/options/IMiddlewareOptions"; +/** + * @class + * @implements MiddlewareOptions + * Class for DummyHandlerOptions + */ +export declare class DummyHandlerOptions implements MiddlewareOptions { + /** + * @public + * A member holding a dummy string + */ + dummyString: string; + /** + * @public + * @async + * To create an instance of DummyHandlerOptions + * @param {string} dummyString - The dummy string + * @returns An instance of DummyHandlerOptions + */ + constructor(dummyString?: string); +} diff --git a/test/dist/es/test/common/DummyHandlerOptions.js b/test/dist/es/test/common/DummyHandlerOptions.js new file mode 100644 index 000000000..4c269450f --- /dev/null +++ b/test/dist/es/test/common/DummyHandlerOptions.js @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @class + * @implements MiddlewareOptions + * Class for DummyHandlerOptions + */ +export class DummyHandlerOptions { + /** + * @public + * @async + * To create an instance of DummyHandlerOptions + * @param {string} dummyString - The dummy string + * @returns An instance of DummyHandlerOptions + */ + constructor(dummyString = "dummy") { + this.dummyString = dummyString; + } +} +//# sourceMappingURL=DummyHandlerOptions.js.map diff --git a/test/dist/es/test/common/DummyHandlerOptions.js.map b/test/dist/es/test/common/DummyHandlerOptions.js.map new file mode 100644 index 000000000..ce7628dee --- /dev/null +++ b/test/dist/es/test/common/DummyHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DummyHandlerOptions.js","sourceRoot":"","sources":["../../../../common/DummyHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;GAIG;AAEH,MAAM,OAAO,mBAAmB;IAO/B;;;;;;OAMG;IACH,YAAmB,cAAsB,OAAO;QAC/C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/content/BatchRequestContent.d.ts b/test/dist/es/test/common/content/BatchRequestContent.d.ts new file mode 100644 index 000000000..ac7981909 --- /dev/null +++ b/test/dist/es/test/common/content/BatchRequestContent.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/content/BatchRequestContent.js b/test/dist/es/test/common/content/BatchRequestContent.js new file mode 100644 index 000000000..67548e6fc --- /dev/null +++ b/test/dist/es/test/common/content/BatchRequestContent.js @@ -0,0 +1,601 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import * as fs from "fs"; +import "isomorphic-fetch"; +import { BatchRequestContent } from "../../../src/content/BatchRequestContent"; +import { randomString } from "../test-helper"; +const folderName = randomString(); +const folderDetails = { + name: folderName, + folder: {}, +}; +const createFolderRequest = new Request("/me/drive/root/children", { + method: "POST", + headers: { + "Content-type": "application/json", + }, + body: JSON.stringify(folderDetails), +}); +const getCreateFolderRequestCopy = () => { + return { + id: "1", + request: createFolderRequest, + }; +}; +const getCreateFolderRequestWithDependsOnCopy = () => { + const data = { + id: "1", + request: createFolderRequest, + dependsOn: undefined, + }; + data.dependsOn = []; + return data; +}; +describe("BatchRequestContent.ts", () => { + describe("Create", function() { + this.timeout(20 * 1000); + it("Should Create BatchRequestContent instance with no requests", (done) => { + const batchReq = new BatchRequestContent(); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + it("Should create BatchRequestContent instance with empty array", (done) => { + const batchReq = new BatchRequestContent([]); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + it("Should create BatchRequestContent instance with requests", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + const createFolderDuplicate2 = getCreateFolderRequestCopy(); + createFolderDuplicate2.id = "2"; + const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); + assert.equal(batchReq.requests.size, 2); + done(); + }); + it("Should throw error for empty request id", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + createFolderDuplicate1.id = ""; + try { + const batchReq = new BatchRequestContent([createFolderDuplicate1]); + throw new Error("Something wrong with the empty id check"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + } + done(); + }); + it("Should return error incase of number of requests limit exceeding", (done) => { + const requests = []; + for (let i = 0; i < 25; i++) { + const req = getCreateFolderRequestCopy(); + req.id = "" + i; + requests.push(req); + } + try { + const batchReq = new BatchRequestContent(requests); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + }); + describe("addRequest", function() { + this.timeout(20 * 1000); + it("Should emit size exceed error", (done) => { + const requests = []; + for (let i = 0; i < 20; i++) { + const r = getCreateFolderRequestCopy(); + r.id = "" + i; + requests.push(r); + } + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(requests); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + it("Should add Request JSON to the BatchRequestContent instance", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(); + const id = batchReq.addRequest(req); + assert.equal(req.id, id); + done(); + }); + it("Should throw duplicate id error", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addRequest(req2); + throw new Error("Something wrong with duplicate id validation"); + } catch (error) { + assert.equal(error.name, "Duplicate RequestId Error"); + done(); + } + }); + it("Should throw duplicate id error", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = ""; + const batchReq = new BatchRequestContent(); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with empty id validation"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + done(); + } + }); + }); + describe("removeRequest", () => { + it("Should delete the request present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, batchReq.removeRequest(req.id)); + done(); + }); + it("Should return false for the request that is not present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(false, batchReq.removeRequest("1000")); + done(); + }); + it("Should remove dependencies in case dependencies present", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + const req4 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + batchReq.addDependency("2", "1"); + batchReq.addDependency("3", "2"); + batchReq.addDependency("4", "1"); + batchReq.addDependency("4", "2"); + batchReq.addDependency("4", "3"); + batchReq.removeRequest("2"); + assert.isUndefined(batchReq.requests.get("1").dependsOn); + assert.isUndefined(batchReq.requests.get("3").dependsOn); + assert.equal(batchReq.requests.get("4").dependsOn.length, 2); + done(); + }); + }); + describe("addDependency", function() { + this.timeout(20 * 1000); + it("Should return error for request with dependent id not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1"); + throw new Error("Dependent validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency Addition"); + done(); + } + }); + it("Should return error for the request with given dependency id is not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1", "100"); + throw new Error("Dependency validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency"); + done(); + } + }); + it("Should add dependency for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2", "1"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("2", "3"); + assert.equal(batchReq.requests.get("2").dependsOn.length, 2); + done(); + }); + it("Should return error for adding duplicate dependency", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2", "1"); + try { + batchReq.addDependency("2", "1"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + it("Should add dependency for dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("3"); + assert.isDefined(batchReq.requests.get("3").dependsOn); + done(); + }); + it("Should return error for adding duplicate dependency when dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + try { + batchReq.addDependency("2"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addDependency("1"); + } catch (e) { + assert.equal(e.name, "Invalid Dependency Addition"); + done(); + } + }); + }); + describe("getContent", () => { + it("Should return error for empty requests", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const batchReq = new BatchRequestContent(); + try { + const content = yield batchReq.getContent(); + throw new Error("Something wrong with the empty requests validation"); + } catch (error) { + assert.equal(error.name, "Empty Payload"); + } + })); + it("Should return json content", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + const content = yield batchReq.getContent(); + assert.isDefined(content.requests[0].body); + assert.equal(typeof content.requests[0].body, "object"); + } catch (error) { + throw error; + } + })); + it("Should return image's base64 string", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const fileName = "sample_image.jpg"; + fs.readFile(`./spec/sample_files/${fileName}`, {}, (err, file) => + tslib_1.__awaiter(this, void 0, void 0, function*() { + if (err) { + throw err; + } + const uploadOneDriveFile = { + id: "1", + request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { + method: "PUT", + headers: { + "Content-type": "image/jpg", + }, + body: file, + }), + }; + const batchReq = new BatchRequestContent([uploadOneDriveFile]); + try { + const content = yield batchReq.getContent(); + assert.isDefined(content.requests[0].body); + } catch (error) { + throw error; + } + }), + ); + })); + it("Should throw error for request does not have content-type header if it does have a body", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { + method: "POST", + body: JSON.stringify(folderDetails), + }); + const batchReq = new BatchRequestContent([ + { + id: "1", + request: createFolderReqWithoutHeader, + }, + ]); + try { + const content = yield batchReq.getContent(); + throw new Error("Something wrong with the header checking"); + } catch (error) { + assert.equal(error.name, "Invalid Content-type header"); + } + })); + }); + describe("removeDependency", function() { + this.timeout(20 * 1000); + it("Should return false for dependent not present", (done) => { + const batchReq = new BatchRequestContent(); + assert.equal(false, batchReq.removeDependency("1")); + done(); + }); + it("Should return false for dependency array not present in the request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(false, batchReq.removeDependency("2")); + done(); + }); + it("Should return false for given dependency id is not present in the dependent request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(false, batchReq.removeDependency("2", "5")); + done(); + }); + it("Should delete the given dependency and dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(true, batchReq.removeDependency("2", "1")); + done(); + }); + it("Should delete all dependencies for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("3", "1"); + batchReq.addDependency("3", "2"); + assert.equal(true, batchReq.removeDependency("3")); + done(); + }); + }); + describe("validateDependencies", () => { + /* tslint:disable: no-string-literal */ + it("Should throw error for empty request object", (done) => { + try { + BatchRequestContent["validateDependencies"](new Map()); + throw new Error("Something wrong with the empty requests check"); + } catch (error) { + assert.equal(error.name, "Empty Requests Error"); + done(); + } + }); + it("isParallel - Should validate for single request", () => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for multiple requests", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for requests with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for requests with empty dependsOn array", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for first request having dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = undefined; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for a request does not depend on anything", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for a request does not depend on previous request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["4"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for requests having more than one dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["2", "3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for proper serial dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for first request having dependency on itself", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["1"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for first request having dependency on non existing request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["10"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["10"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["10"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for requests dependsOn some middle order request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request with empty dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["2"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + /* tslint:enable: no-string-literal */ + }); +}); +//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/test/common/content/BatchRequestContent.js.map b/test/dist/es/test/common/content/BatchRequestContent.js.map new file mode 100644 index 000000000..cc2ff470e --- /dev/null +++ b/test/dist/es/test/common/content/BatchRequestContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchRequestContent.js","sourceRoot":"","sources":["../../../../../common/content/BatchRequestContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,E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AC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uHAAuH,EAAE,GAAG,EAAE;YAChI,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/content/BatchResponseContent.d.ts b/test/dist/es/test/common/content/BatchResponseContent.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/content/BatchResponseContent.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/content/BatchResponseContent.js b/test/dist/es/test/common/content/BatchResponseContent.js new file mode 100644 index 000000000..78f9dc62f --- /dev/null +++ b/test/dist/es/test/common/content/BatchResponseContent.js @@ -0,0 +1,114 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; +const redirect = { + id: "1", + status: 302, + headers: { + location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", + }, +}; +const forbidden = { + id: "3", + status: 401, + body: { + error: { + code: "Forbidden", + message: "...", + }, + }, +}; +const okWithBody = { + id: "2", + status: 200, + body: { + "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", + value: [], + }, +}; +const okWithoutBody = { + id: "4", + status: 204, + body: null, +}; +describe("BatchResponseContent.ts", () => { + describe("update", function() { + this.timeout(20 * 1000); + it("Should update instance with nextLink responses", (done) => { + const responses = [redirect, forbidden]; + const batchRes = new BatchResponseContent({ + responses, + "@odata.nextLink": "dummy nextlink", + }); + batchRes.update({ + responses: [okWithoutBody, okWithBody], + }); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + describe("createResponseObject", function() { + this.timeout(20 * 1000); + it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + assert.isDefined(batchRes.getResponseById("1")); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("3")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + describe("getResponseById", function() { + this.timeout(20 * 1000); + it("Should return response object for given id", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponseById("1")); + done(); + }); + it("Should return undefined for given id for which the response is not present", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isUndefined(batchRes.getResponseById("100")); + done(); + }); + }); + describe("getResponses", function() { + this.timeout(20 * 1000); + it("Should return responses map", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponses()); + done(); + }); + }); + describe("getResponsesIterator", function() { + this.timeout(20 * 1000); + it("Should return iterator", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + let count = 0; + const iterator = batchRes.getResponsesIterator(); + let data = iterator.next(); + while (!data.done) { + data = iterator.next(); + count++; + } + assert.equal(count, 4); + done(); + }); + }); +}); +//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/test/common/content/BatchResponseContent.js.map b/test/dist/es/test/common/content/BatchResponseContent.js.map new file mode 100644 index 000000000..911f71f36 --- /dev/null +++ b/test/dist/es/test/common/content/BatchResponseContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../common/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,QAAQ,GAAG;IAChB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,OAAO,EAAE;QACR,QAAQ,EAAE,uEAAuE;KACjF;CACD,CAAC;AACF,MAAM,SAAS,GAAG;IACjB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,KAAK,EAAE;YACN,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,KAAK;SACd;KACD;CACD,CAAC;AACF,MAAM,UAAU,GAAG;IAClB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,gBAAgB,EAAE,oFAAoF;QACtG,KAAK,EAAE,EAAE;KACT;CACD,CAAC;AACF,MAAM,aAAa,GAAG;IACrB,EAAE,EAAE,GAAG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,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAExB,EAAE,CAAC,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;YACrC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACzC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC;aAC3D,CAAC,CAAC;YACH,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,QAAQ,GAAG,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YACjD,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBAClB,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACvB,KAAK,EAAE,CAAC;aACR;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/Client.d.ts b/test/dist/es/test/common/core/Client.d.ts new file mode 100644 index 000000000..ac7981909 --- /dev/null +++ b/test/dist/es/test/common/core/Client.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/core/Client.js b/test/dist/es/test/common/core/Client.js new file mode 100644 index 000000000..5b41681f6 --- /dev/null +++ b/test/dist/es/test/common/core/Client.js @@ -0,0 +1,105 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import "isomorphic-fetch"; +import { CustomAuthenticationProvider, TelemetryHandler } from "../../../src"; +import { Client } from "../../../src/Client"; +import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; +import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; +import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; +import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; +import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +describe("Client.ts", () => { + /* tslint:disable: no-string-literal */ + describe("initWithMiddleware", () => { + const dummyAuthProvider = new DummyAuthenticationProvider(); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + it("Should throw an error in case if both auth provider and custom middleware is passed", () => { + try { + const options = { + authProvider: dummyAuthProvider, + middleware: dummyHTTPHandler, + }; + const client = Client.initWithMiddleware(options); + throw new Error("Something wrong with the ambiguity check"); + } catch (error) { + assert.equal(error.name, "AmbiguityInInitialization"); + } + }); + it("Should return client instance for an authentication provider", () => { + const options = { + authProvider: dummyAuthProvider, + }; + const client = Client.initWithMiddleware(options); + assert.isTrue(client instanceof Client); + assert.isDefined(client["httpClient"]); + }); + it("Should return client instance for a custom middleware chain", () => { + const options = { + middleware: dummyHTTPHandler, + }; + const client = Client.initWithMiddleware(options); + assert.isTrue(client instanceof Client); + assert.isDefined(client["httpClient"]); + }); + it("Should throw error in case of neither auth provider nor custom middleware is passed", () => { + try { + const options = {}; + Client.initWithMiddleware(options); + throw new Error("Something wrong with the client initialization check"); + } catch (error) { + assert.equal(error.name, "InvalidMiddlewareChain"); + } + }); + it("Init middleware using a middleware array", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const provider = (done) => { + done(null, "dummy_token"); + }; + const authHandler = new AuthenticationHandler(new CustomAuthenticationProvider(provider)); + const responseBody = "Test response body"; + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Testing middleware array", 200, 0, responseBody); + const middlewareArray = [authHandler, new ChaosHandler(options)]; + const client = Client.initWithMiddleware({ middleware: middlewareArray }); + const response = yield client.api("me").get(); + assert.equal(response, responseBody); + })); + it("Init middleware using a chained middleware array", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const provider = (done) => { + done(null, "dummy_token"); + }; + const authHandler = new AuthenticationHandler(new CustomAuthenticationProvider(provider)); + const responseBody = "Test response body"; + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Testing chained middleware array", 200, 0, responseBody); + const chaosHandler = new ChaosHandler(options); + const telemetryHandler = new TelemetryHandler(); + authHandler.setNext(telemetryHandler); + telemetryHandler.setNext(chaosHandler); + const middlewareArray = [authHandler]; + const client = Client.initWithMiddleware({ middleware: middlewareArray }); + const response = yield client.api("me").get(); + assert.equal(response, responseBody); + })); + }); + describe("init", () => { + it("Should return a client instance with default authentication provider and default middleware chain", () => { + const provider = (done) => { + done(null, "dummy_token"); + }; + const options = { + authProvider: provider, + }; + const client = Client.init(options); + assert.isDefined(client["httpClient"]); + }); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=Client.js.map diff --git a/test/dist/es/test/common/core/Client.js.map b/test/dist/es/test/common/core/Client.js.map new file mode 100644 index 000000000..790f0c5a0 --- /dev/null +++ b/test/dist/es/test/common/core/Client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../../../common/core/Client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+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AAE;QACrB,EAAE,CAAC,mGAAmG,EAAE,GAAG,EAAE;YAC5G,MAAM,QAAQ,GAAiB,CAAC,IAAI,EAAE,EAAE;gBACvC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;YAC3B,CAAC,CAAC;YACF,MAAM,OAAO,GAAY;gBACxB,YAAY,EAAE,QAAQ;aACtB,CAAC;YACF,MAAM,MAAM,GAAW,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphErrorHandler.d.ts b/test/dist/es/test/common/core/GraphErrorHandler.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/GraphErrorHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/GraphErrorHandler.js b/test/dist/es/test/common/core/GraphErrorHandler.js new file mode 100644 index 000000000..80e2fbe1e --- /dev/null +++ b/test/dist/es/test/common/core/GraphErrorHandler.js @@ -0,0 +1,102 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { GraphErrorHandler } from "../../../src/GraphErrorHandler"; +describe("GraphErrorHandler.ts", () => { + /* tslint:disable: no-string-literal */ + describe("constructError", () => { + it("Should return custom error without code", () => { + const message = "test"; + const error = new Error(message); + const gError = GraphErrorHandler["constructError"](error); + assert.equal(gError.message, message); + }); + it("Should return custom error with code and message", () => { + const message = "test"; + const name = "test_name"; + const error = new Error(message); + error.name = name; + const gError = GraphErrorHandler["constructError"](error); + assert.equal(gError.message, message); + assert.equal(gError.code, name); + }); + }); + describe("constructErrorFromResponse", () => { + const statusCode = 400; + const error = { + error: { + code: "DataNotAvailable", + message: "The data that is being requested is not present", + }, + }; + it("Should construct error for error response without innerError property", () => { + const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); + assert.equal(gError.statusCode, statusCode); + assert.equal(gError.requestId, null); + }); + it("Should construct error for the response missing one or more properties in innerError property", () => { + error.error.innerError = { + "request-id": "some random id", + }; + const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); + assert.equal(gError.statusCode, statusCode); + assert.equal(gError.requestId, "some random id"); + }); + it("Should construct error for the complete error response", () => { + const date = new Date(); + const requestId = "some random id"; + error.error.innerError = { + "request-id": requestId, + date, + }; + const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); + assert.equal(gError.statusCode, statusCode); + assert.equal(gError.requestId, "some random id"); + assert.equal(gError.date.toUTCString(), date.toUTCString()); + }); + }); + /* tslint:enable: no-string-literal */ + describe("getError", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + it("Should construct error from response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const errorResponse = { + error: { + code: "500", + message: "Internal Server Error", + innerError: { + "request-id": "some random id", + }, + }, + }; + const gError = yield GraphErrorHandler.getError(errorResponse); + assert.equal(gError.requestId, "some random id"); + assert.equal(gError.code, "500"); + assert.equal(gError.message, "Internal Server Error"); + })); + it("Should construct error from error object", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const error = new Error("Some Error"); + error.name = "InvalidError"; + const gError = yield GraphErrorHandler.getError(error); + assert.equal(gError.requestId, null); + assert.equal(gError.message, "Some Error"); + assert.equal(gError.code, "InvalidError"); + })); + it("Should construct some default error", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const gError = yield GraphErrorHandler.getError(); + assert.equal(gError.message, ""); + assert.equal(gError.statusCode, -1); + assert.equal(gError.code, null); + assert.equal(gError.body, null); + assert.equal(gError.requestId, null); + })); + })); +}); +//# sourceMappingURL=GraphErrorHandler.js.map diff --git a/test/dist/es/test/common/core/GraphErrorHandler.js.map b/test/dist/es/test/common/core/GraphErrorHandler.js.map new file mode 100644 index 000000000..cfb9c8ea2 --- /dev/null +++ b/test/dist/es/test/common/core/GraphErrorHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphErrorHandler.js","sourceRoot":"","sources":["../../../../../common/core/GraphErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,uCAAuC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YAClD,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC3D,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,IAAI,GAAG,WAAW,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,MAAM,MAAM,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1D,MAAM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AAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3C,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;YACpD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAClD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACjC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphRequestUtil.d.ts b/test/dist/es/test/common/core/GraphRequestUtil.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/GraphRequestUtil.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/GraphRequestUtil.js b/test/dist/es/test/common/core/GraphRequestUtil.js new file mode 100644 index 000000000..d0bd25f46 --- /dev/null +++ b/test/dist/es/test/common/core/GraphRequestUtil.js @@ -0,0 +1,69 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { serializeContent, urlJoin } from "../../../src/GraphRequestUtil"; +describe("GraphRequestUtil.ts", () => { + describe("urlJoin", () => { + const output = "host/version/path"; + it("Should append parts with /", () => { + const joined = urlJoin(["host", "version", "path"]); + assert.equal(joined, output); + }); + it("Should append parts with / by removing / from start", () => { + const joined = urlJoin(["host", "/version", "/path"]); + assert.equal(joined, output); + }); + it("Should append parts with / by removing / from end", () => { + const joined = urlJoin(["host/", "version/", "path"]); + assert.equal(joined, output); + }); + it("Should append parts with / by removing / from start and end", () => { + const joined = urlJoin(["host/", "/version/", "/path"]); + assert.equal(joined, output); + }); + }); + describe("serializeContent", () => { + it("Should return Buffer/Blob/File/FormData/String as it is", () => { + const str = "Content"; + assert.equal(serializeContent(str), str); + const buffer = new Buffer("Buffer"); + assert.equal(serializeContent(buffer), buffer); + }); + it("Should convert it to string", () => { + const data = 123; + const str = "123"; + assert.equal(serializeContent(data), str); + }); + it("Should throw error for objects that cannot be converted to string", () => { + const node1 = { + data: 1, + link: undefined, + }; + const node2 = { + data: 2, + link: undefined, + }; + node1.link = node2; + node2.link = node1; + try { + serializeContent(node1); + throw new Error("Something wrong with the serialize content, it should not stringify cyclic referenced objects"); + } catch (error) { + assert.equal(error.message, "Unable to stringify the content"); + } + }); + it("Should return undefined for the case of undefined content value", () => { + const val = undefined; + assert.equal(serializeContent(val), undefined); + }); + it("Should return 'null' for the case of null content value", () => { + const val = null; + assert.equal(serializeContent(val), "null"); + }); + }); +}); +//# sourceMappingURL=GraphRequestUtil.js.map diff --git a/test/dist/es/test/common/core/GraphRequestUtil.js.map b/test/dist/es/test/common/core/GraphRequestUtil.js.map new file mode 100644 index 000000000..4d4ed23ea --- /dev/null +++ b/test/dist/es/test/common/core/GraphRequestUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphRequestUtil.js","sourceRoot":"","sources":["../../../../../common/core/GraphRequestUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE1E,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACxB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;YACtE,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YACxD,MAAM,CAAC,KAAK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EAAiE,EAAE,GAAG,EAAE;YAC1E,MAAM,GAAG,GAAG,SAAS,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YAClE,MAAM,GAAG,GAAG,IAAI,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphResponseHandler.d.ts b/test/dist/es/test/common/core/GraphResponseHandler.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/GraphResponseHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/GraphResponseHandler.js b/test/dist/es/test/common/core/GraphResponseHandler.js new file mode 100644 index 000000000..7bb3780dc --- /dev/null +++ b/test/dist/es/test/common/core/GraphResponseHandler.js @@ -0,0 +1,162 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; +import { ResponseType } from "../../../src/ResponseType"; +describe("GraphResponseHandler.ts", () => { + const htmlString = ` + + + + Testing Document + + +

Testing

+ + `; + const status200 = { + status: 200, + statusText: "OK", + }; + const status204 = { + status: 204, + statusText: "OK", + }; + const status500 = { + status: 500, + statusText: "Internal Server Error", + }; + const status202 = { + status: 202, + statusText: "OK", + }; + const status200Text = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "text/plain", + }, + }; + const status200Json = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "application/json", + }, + }; + const status200Image = { + status: 200, + stautsText: "OK", + headers: { + "Content-Type": "image/jpeg", + }, + }; + const status200Unknown = { + status: 200, + statusText: "OK", + headers: { + "Content-Type": "dummy/unknown", + }, + }; + /* tslint:disable: no-string-literal */ + describe("parseDocumentResponse", () => { + it("Should return the html string", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const dom = yield GraphResponseHandler["parseDocumentResponse"](response, DocumentType.TEXT_HTML); + assert.isDefined(dom); + assert.equal(typeof dom, "string"); + })); + }); + describe("convertResponse", () => { + it("Should return empty response for the NO CONTENT (204 response)", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(undefined, status204); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.isUndefined(responseValue); + })); + it("Should return empty text value for empty response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(undefined, status202); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.isUndefined(responseValue); + })); + it("Should return text data for text/plain content-type", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const data = "text data"; + const response = new Response(data, status200Text); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue, data); + })); + it("Should return json data for application/json content-type", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const data = { + test: "test", + }; + const response = new Response(JSON.stringify(data), status200Json); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue.test, data.test); + })); + it("Should return raw response incase of unknown content-type", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const data = "test data"; + const response = new Response(data, status200Unknown); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.equal(responseValue, data); + })); + it("Should return response value as text", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.TEXT); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + })); + it("Should return response value as text for text/html return type", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.DOCUMENT); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + })); + it("Should return response value as json", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const json = { test: "test" }; + const response = new Response(JSON.stringify(json), status200); + const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.JSON); + assert.isDefined(responseValue); + assert.equal(responseValue.test, "test"); + })); + it("Should return response value as text for default response type", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const responseValue = yield GraphResponseHandler["convertResponse"](response); + assert.isDefined(responseValue); + assert.equal(typeof responseValue, "string"); + assert.equal(responseValue, htmlString); + })); + }); + /* tslint:enable: no-string-literal */ + describe("getResponse", () => { + it("Should return a raw response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const responseValue = yield GraphResponseHandler.getResponse(response, ResponseType.RAW); + assert.isDefined(responseValue); + assert.isTrue(responseValue instanceof Response); + })); + it("Should return valid 200 OK response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const response = new Response(htmlString, status200); + const responseValue = yield GraphResponseHandler.getResponse(response, ResponseType.TEXT); + assert.isDefined(responseValue); + })); + }); +}); +//# sourceMappingURL=GraphResponseHandler.js.map diff --git a/test/dist/es/test/common/core/GraphResponseHandler.js.map b/test/dist/es/test/common/core/GraphResponseHandler.js.map new file mode 100644 index 000000000..6f23e1d07 --- /dev/null +++ b/test/dist/es/test/common/core/GraphResponseHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"GraphResponseHandler.js","sourceRoot":"","sources":["../../../../../common/core/GraphResponseHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,MAAM,UAAU,GAAG;;;;;;;;;gCASY,CAAC;IAChC,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,uBAAuB;KACnC,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,aAAa,GAAG;QACrB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,YAAY;SAC5B;KACD,CAAC;IACF,MAAM,aAAa,GAAG;QACrB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;SAClC;KACD,CAAC;IACF,MAAM,cAAc,GAAG;QACtB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,YAAY;SAC5B;KACD,CAAC;IACF,MAAM,gBAAgB,GAAG;QACxB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,eAAe;SAC/B;KACD,CAAC;IACF,uCAAuC;IACvC,QAAQ,CAAC,uBAAuB,EAAE,G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AChC,MAAM,CAAC,KAAK,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;IAEtC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,8BAA8B,EAAE,GAAS,EAAE;YAC7C,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;YACzF,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,aAAa,YAAY,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;YACpD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;YAC1F,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/HTTPClient.d.ts b/test/dist/es/test/common/core/HTTPClient.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClient.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/HTTPClient.js b/test/dist/es/test/common/core/HTTPClient.js new file mode 100644 index 000000000..b644343de --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClient.js @@ -0,0 +1,95 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { HTTPClient } from "../../../src/HTTPClient"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +describe("HTTPClient.ts", () => { + const httpMessageHandler = new DummyHTTPMessageHandler(); + const httpClient = new HTTPClient(httpMessageHandler); + /* tslint:disable: no-string-literal */ + describe("constructor", () => { + it("Should create an instance and populate middleware member", () => { + assert.isDefined(httpClient["middleware"]); + assert.equal(httpClient["middleware"], httpMessageHandler); + }); + it("Should create an instance and populate middleware member when passing a middleware array", () => { + const client = new HTTPClient(...[httpMessageHandler]); + assert.isDefined(client["middleware"]); + assert.equal(client["middleware"], httpMessageHandler); + }); + it("Should throw an error if middleware is undefined", () => { + try { + const client = new HTTPClient(); + } catch (error) { + assert.equal(error.name, "InvalidMiddlewareChain"); + } + }); + it("Should throw an error if middleware is passed as null", () => { + try { + const client = new HTTPClient(null); + } catch (error) { + assert.equal(error.name, "InvalidMiddlewareChain"); + } + }); + it("Should throw an error if middleware is passed as an empty array", () => { + try { + const client = new HTTPClient(...[]); + } catch (error) { + assert.equal(error.name, "InvalidMiddlewareChain"); + } + }); + }); + /* tslint:enable: no-string-literal */ + describe("sendRequest", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + it("Should throw error for invalid request options incase if the url and options are passed", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const url = "dummy_url"; + const context = { + request: url, + }; + yield httpClient.sendRequest(context); + throw new Error("Something wrong with the context validation"); + } catch (error) { + assert.equal(error.name, "InvalidRequestOptions"); + } + })); + it("Should execute for context object with Request instance", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const request = new Request("dummy_url", { + method: "GET", + }); + const context = { + request, + }; + yield httpClient.sendRequest(context); + } catch (error) { + throw error; + } + })); + it("Should execute for context object with request uri and options", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const url = "dummy_url"; + const options = { + method: "GET", + }; + const context = { + request: url, + options, + }; + yield httpClient.sendRequest(context); + } catch (error) { + throw error; + } + })); + })); +}); +//# sourceMappingURL=HTTPClient.js.map diff --git a/test/dist/es/test/common/core/HTTPClient.js.map b/test/dist/es/test/common/core/HTTPClient.js.map new file mode 100644 index 000000000..3ca0ba328 --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClient.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTTPClient.js","sourceRoot":"","sources":["../../../../../common/core/HTTPClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,MAAM,kBAAkB,GAA4B,IAAI,uBAAuB,EAAE,CAAC;IAClF,MAAM,UAAU,GAAe,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAClE,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YACnE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0FAA0F,EAAE,GAAG,EAAE;YACnG,MAAM,MAAM,GAAG,IAAI,UAAU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,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAC/D;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;aAClD;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAS,EAAE;YACxE,IAAI;gBACH,MAAM,OAAO,GAAY,IAAI,OAAO,CAAC,WAAW,EAAE;oBACjD,MAAM,EAAE,KAAK;iBACb,CAAC,CAAC;gBACH,MAAM,OAAO,GAAY;oBACxB,OAAO;iBACP,CAAC;gBACF,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAS,EAAE;YAC/E,IAAI;gBACH,MAAM,GAAG,GAAG,WAAW,CAAC;gBACxB,MAAM,OAAO,GAAiB;oBAC7B,MAAM,EAAE,KAAK;iBACb,CAAC;gBACF,MAAM,OAAO,GAAY;oBACxB,OAAO,EAAE,GAAG;oBACZ,OAAO;iBACP,CAAC;gBACF,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/HTTPClientFactory.d.ts b/test/dist/es/test/common/core/HTTPClientFactory.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClientFactory.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/HTTPClientFactory.js b/test/dist/es/test/common/core/HTTPClientFactory.js new file mode 100644 index 000000000..17fd3c903 --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClientFactory.js @@ -0,0 +1,30 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { HTTPClient } from "../../../src/HTTPClient"; +import { HTTPClientFactory } from "../../../src/HTTPClientFactory"; +import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +describe("HTTPClientFactory.ts", () => { + /* tslint:disable: no-string-literal */ + describe("createWithAuthenticationProvider", () => { + const dummyAuthProvider = new DummyAuthenticationProvider(); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + it("Should create an HTTPClient instance with default middleware chain", () => { + const client = HTTPClientFactory.createWithAuthenticationProvider(dummyAuthProvider); + assert.isTrue(client instanceof HTTPClient); + assert.isDefined(client["middleware"]); + }); + it("Should create an HTTPClient with given middleware chain", () => { + const client = HTTPClientFactory.createWithMiddleware(dummyHTTPHandler); + assert.isTrue(client instanceof HTTPClient); + assert.isDefined(client["middleware"]); + }); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=HTTPClientFactory.js.map diff --git a/test/dist/es/test/common/core/HTTPClientFactory.js.map b/test/dist/es/test/common/core/HTTPClientFactory.js.map new file mode 100644 index 000000000..c7db6058a --- /dev/null +++ b/test/dist/es/test/common/core/HTTPClientFactory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HTTPClientFactory.js","sourceRoot":"","sources":["../../../../../common/core/HTTPClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,uCAAuC;IACvC,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACjD,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;QAC5D,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;QACvD,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;YAC7E,MAAM,MAAM,GAAe,iBAAiB,CAAC,gCAAgC,CAAC,iBAAiB,CAAC,CAAC;YACjG,MAAM,CAAC,MAAM,CAAC,MAAM,YAAY,UAAU,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YAClE,MAAM,MAAM,GAAe,iBAAiB,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;YACpF,MAAM,CAAC,MAAM,CAAC,MAAM,YAAY,UAAU,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/Range.d.ts b/test/dist/es/test/common/core/Range.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/Range.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/Range.js b/test/dist/es/test/common/core/Range.js new file mode 100644 index 000000000..5d17115ce --- /dev/null +++ b/test/dist/es/test/common/core/Range.js @@ -0,0 +1,32 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { Range } from "../../../src/Range"; +describe("Range.ts", () => { + describe("Constructor", () => { + const defaultValue = -1; + it("Should create a Range instance with given min and max values", () => { + const min = 1; + const max = 10; + const range = new Range(min, max); + assert.equal(range.minValue, min); + assert.equal(range.maxValue, max); + }); + it("Should create a range instance with default values", () => { + const range = new Range(); + assert.equal(range.minValue, defaultValue); + assert.equal(range.maxValue, defaultValue); + }); + it("Should create a range instance with default max value", () => { + const min = 1; + const range = new Range(min); + assert.equal(range.minValue, min); + assert.equal(range.maxValue, defaultValue); + }); + }); +}); +//# sourceMappingURL=Range.js.map diff --git a/test/dist/es/test/common/core/Range.js.map b/test/dist/es/test/common/core/Range.js.map new file mode 100644 index 000000000..7fb927417 --- /dev/null +++ b/test/dist/es/test/common/core/Range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../../../common/core/Range.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACzB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC;QAExB,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;YACvE,MAAM,GAAG,GAAG,CAAC,CAAC;YACd,MAAM,GAAG,GAAG,EAAE,CAAC;YACf,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAChE,MAAM,GAAG,GAAG,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/urlGeneration.d.ts b/test/dist/es/test/common/core/urlGeneration.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/urlGeneration.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/urlGeneration.js b/test/dist/es/test/common/core/urlGeneration.js new file mode 100644 index 000000000..a9788cc25 --- /dev/null +++ b/test/dist/es/test/common/core/urlGeneration.js @@ -0,0 +1,146 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { getClient } from "../test-helper"; +const client = getClient(); +const cases = []; +cases.push({ + url: "https://graph.microsoft.com/v1.0/me?$select=displayName", + request: client.api("/me").select("displayName"), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me?$select=displayName", + request: client.api("/me").select(["displayName"]), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle", + request: client.api("me").select(["displayName", "jobTitle"]), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle", + request: client + .api("/me") + .select(["displayName"]) + .select("jobTitle"), +}); +cases.push({ + url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle", + request: client + .api("/me") + .version("beta") + .select(["displayName"]) + .select("jobTitle"), +}); +cases.push({ + url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle", + request: client + .api("/me") + .version("beta") + .select(["displayName"]) + .select("jobTitle"), +}); +// Need to figure out type signature of select() to allow string, array of strings, and unlimited string parameters +// cases.push({ +// url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle,mailNickname", +// request: client.api("/me") +// .version("beta") +// .select("displayName", "jobTitle", "mailNickname") +// }) +cases.push({ + url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true", + request: client + .api("/me/people") + .version("beta") + .select(["displayName"]) + .select("title") + .count(true), +}); +cases.push({ + url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true&$search=senior", + request: client + .api("/me/people") + .version("beta") + .select(["displayName", "title"]) + .count(true) + .query({ $search: "senior" }), +}); +cases.push({ + url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true&$search=senior", + request: client + .api("/me/people") + .version("beta") + .select(["displayName", "title"]) + .count(true) + .query("$search=senior"), +}); +cases.push({ + url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title,id&$count=false&$expand=a($expand=a,b)", + request: client + .api("/me/people") + .version("beta") + .select(["displayName", "title"]) + .count(true) + .expand("a($expand=a,b)") + .query("$select=id") + .query("$count=false"), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/people?$select=displayName,title,id&select=value", + request: client + .api("/me/people") + .version("v1.0") + .select(["displayName", "title"]) + .query({ select: "value" }) + .query({ $select: "id" }), +}); +// handling an invalid input +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/people?$select=displayName,title&select=value&test", + request: client + .api("/me/people") + .version("v1.0") + .select(["displayName", "title"]) + .query({ select: "value" }) + .query("test"), +}); +// handling an invalid input +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/people?$expand=address($select=home,$expand=city)&$select=home,displayName,title&select=value&test", + request: client + .api("/me/people?$expand=address($select=home,$expand=city)&$select=home") + .version("v1.0") + .select(["displayName", "title"]) + .query({ select: "value" }) + .query("test"), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/people?$expand=home($select=home)&name=test", + request: client.api("/me/people").query("?name=test&$expand=home($select=home)"), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/people?$expand=home($select=home)&name=test", + request: client.api("/me/people?name=test&$expand=home($select=home)"), +}); +cases.push({ + url: "https://graph.microsoft.com/v1.0/me/drive/root?$expand=children($select=name),permissions", + request: client + .api("me/drive/root") + .expand("children($select=name)") + .expand("permissions"), +}); +describe("urlGeneration.ts", () => { + /* tslint:disable: no-string-literal */ + describe("buildFullUrl", () => { + for (const testCase of cases) { + it("should correctly build " + testCase.url, () => { + assert.equal(testCase.url, testCase.request["buildFullUrl"]()); + }); + } + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=urlGeneration.js.map diff --git a/test/dist/es/test/common/core/urlGeneration.js.map b/test/dist/es/test/common/core/urlGeneration.js.map new file mode 100644 index 000000000..dd9ccb0eb --- /dev/null +++ b/test/dist/es/test/common/core/urlGeneration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"urlGeneration.js","sourceRoot":"","sources":["../../../../../common/core/urlGeneration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAC3B,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,yDAAyD;IAC9D,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;CAChD,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,yDAAyD;IAC9D,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;CAC7D,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,MAAM;SACb,GAAG,CAAC,KAAK,CAAC;SACV,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;SACvB,MAAM,CAAC,UAAU,CAAC;CACpB,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,MAAM;SACb,GAAG,CAAC,KAAK,CAAC;SACV,OAAO,CAAC,MAAM,CAAC;SACf,M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K,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,iFAAiF;IACtF,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC;CAChF,CAAC,CAAC;AACH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,iFAAiF;IACtF,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC;CACtE,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,2FAA2F;IAChG,OAAO,EAAE,MAAM;SACb,GAAG,CAAC,eAAe,CAAC;SACpB,MAAM,CAAC,wBAAwB,CAAC;SAChC,MAAM,CAAC,aAAa,CAAC;CACvB,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,uCAAuC;IACvC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC7B,EAAE,CAAC,yBAAyB,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE;gBACjD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;SACH;IACF,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/urlParsing.d.ts b/test/dist/es/test/common/core/urlParsing.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/core/urlParsing.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/core/urlParsing.js b/test/dist/es/test/common/core/urlParsing.js new file mode 100644 index 000000000..249574655 --- /dev/null +++ b/test/dist/es/test/common/core/urlParsing.js @@ -0,0 +1,54 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { getClient } from "../test-helper"; +const client = getClient(); +const testCases = { + "/me": "https://graph.microsoft.com/v1.0/me", + "/me/": "https://graph.microsoft.com/v1.0/me/", + me: "https://graph.microsoft.com/v1.0/me", + "me/events": "https://graph.microsoft.com/v1.0/me/events", + "/me/events": "https://graph.microsoft.com/v1.0/me/events", + "https://graph.microsoft.com/v1.0/me/events": "https://graph.microsoft.com/v1.0/me/events", + "https://graph.microsoft.com/beta/me/events?$filter=startswith(subject, 'update')": "https://graph.microsoft.com/beta/me/events?$filter=startswith(subject, 'update')", + "me/events?$filter=startswith(subject, 'update')": "https://graph.microsoft.com/v1.0/me/events?$filter=startswith(subject, 'update')", + "/me?a=b": "https://graph.microsoft.com/v1.0/me?a=b", + "/me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d", + "me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d", + // oData params should work with and without $ + "me?$select=displayName": "https://graph.microsoft.com/v1.0/me?$select=displayName", + "me?select=displayName": "https://graph.microsoft.com/v1.0/me?select=displayName", + "https://graph.microsoft.com/beta/me?select=displayName": "https://graph.microsoft.com/beta/me?select=displayName", + // test for nested query parameters + "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/?$expand=accessPackageAssignmentPolicies,accessPackageResourceRoleScopes($expand=accessPackageResourceRole,accessPackageResourceScope)": "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/?$expand=accessPackageAssignmentPolicies,accessPackageResourceRoleScopes($expand=accessPackageResourceRole,accessPackageResourceScope)", + "me?$select=displayName&$select=id": "https://graph.microsoft.com/v1.0/me?$select=displayName,id", + "/me?$filter=b&$filter=a": "https://graph.microsoft.com/v1.0/me?$filter=a", + "https://graph.microsoft.com/v1.0/me?$top=4&$expand=4&$iscount=true&$top=2": "https://graph.microsoft.com/v1.0/me?$top=2&$expand=4&$iscount=true", + "/items?$expand=fields($select=Title)&$expand=name($select=firstName)": "https://graph.microsoft.com/v1.0/items?$expand=fields($select=Title),name($select=firstName)", + // Passing invalid parameters + "/me?test&123": "https://graph.microsoft.com/v1.0/me?test&123", + "/me?$select($select=name)": "https://graph.microsoft.com/v1.0/me?$select($select=name)", + "/me/?$filter=any(Actors, Name eq 'John Belushi')": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors, Name eq 'John Belushi')", + "/me/$filter=any(Actors, it/ID eq Director/ID)": "https://graph.microsoft.com/v1.0/me/$filter=any(Actors, it/ID eq Director/ID)", + "/me?$whatif": "https://graph.microsoft.com/v1.0/me?$whatif", + "/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))", +}; +describe("urlParsing.ts", () => { + /* tslint:disable: no-string-literal */ + describe("parsePath", () => { + for (const path in testCases) { + if (testCases.hasOwnProperty(path)) { + it("should correctly parse " + path, () => { + const request = client.api(path); + assert.equal(request["buildFullUrl"](), testCases[path]); + }); + } + } + }); +}); +/* tslint:enable: no-string-literal */ +//# sourceMappingURL=urlParsing.js.map diff --git a/test/dist/es/test/common/core/urlParsing.js.map b/test/dist/es/test/common/core/urlParsing.js.map new file mode 100644 index 000000000..9057611ab --- /dev/null +++ b/test/dist/es/test/common/core/urlParsing.js.map @@ -0,0 +1 @@ +{"version":3,"file":"urlParsing.js","sourceRoot":"","sources":["../../../../../common/core/urlParsing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,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CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;aACH;SACD;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,sCAAsC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts b/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.js b/test/dist/es/test/common/middleware/AuthenticationHandler.js new file mode 100644 index 000000000..7c8a39c04 --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandler.js @@ -0,0 +1,24 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; +import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +const dummyAuthProvider = new DummyAuthenticationProvider(); +const authHandler = new AuthenticationHandler(dummyAuthProvider); +describe("AuthenticationHandler.ts", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + /* tslint:disable: no-string-literal */ + describe("Constructor", () => { + it("Should return an AuthenticationHandler for given AuthenticationProvider", () => { + assert.isTrue(authHandler instanceof AuthenticationHandler); + assert.equal(authHandler["authenticationProvider"], dummyAuthProvider); + }); + }); + /* tslint:enable: no-string-literal */ + })); +//# sourceMappingURL=AuthenticationHandler.js.map diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.js.map b/test/dist/es/test/common/middleware/AuthenticationHandler.js.map new file mode 100644 index 000000000..4db14f5d4 --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthenticationHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/AuthenticationHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;AAC5D,MAAM,WAAW,GAAG,IAAI,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;AAEjE,QAAQ,CAAC,0BAA0B,EAAE,GAAS,EAAE;IAC/C,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;YAClF,MAAM,CAAC,MAAM,CAAC,WAAW,YAAY,qBAAqB,CAAC,CAAC;YAC5D,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAA,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js new file mode 100644 index 000000000..5a8cf462e --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js @@ -0,0 +1,25 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { AuthenticationHandlerOptions } from "../../../src/middleware/options/AuthenticationHandlerOptions"; +import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; +import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +describe("AuthenticationHandlerOptions.ts", () => { + const dummyAuthProvider = new DummyAuthenticationProvider(); + const msalAuthProviderOptions = new MSALAuthenticationProviderOptions([]); + it("Should create an instance with all the given options", () => { + const options = new AuthenticationHandlerOptions(dummyAuthProvider, msalAuthProviderOptions); + assert.equal(options.authenticationProvider, dummyAuthProvider); + assert.equal(options.authenticationProviderOptions, msalAuthProviderOptions); + }); + it("Should be undefined value if no value is passed", () => { + const options = new AuthenticationHandlerOptions(undefined, msalAuthProviderOptions); + assert.isUndefined(options.authenticationProvider); + assert.equal(options.authenticationProviderOptions, msalAuthProviderOptions); + }); +}); +//# sourceMappingURL=AuthenticationHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map new file mode 100644 index 000000000..3bc02302e --- /dev/null +++ b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthenticationHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/AuthenticationHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAC;AAC5G,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAChD,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;IAC5D,MAAM,uBAAuB,GAAG,IAAI,iCAAiC,CAAC,EAAE,CAAC,CAAC;IAC1E,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC;QAC7F,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,iBAAiB,CAAC,CAAC;QAChE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC1D,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACrF,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/ChaosHandler.d.ts b/test/dist/es/test/common/middleware/ChaosHandler.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/test/dist/es/test/common/middleware/ChaosHandler.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/dist/es/test/common/middleware/ChaosHandler.js b/test/dist/es/test/common/middleware/ChaosHandler.js new file mode 100644 index 000000000..936c04971 --- /dev/null +++ b/test/dist/es/test/common/middleware/ChaosHandler.js @@ -0,0 +1,225 @@ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; +import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; +import { RequestMethod } from "../../../src/RequestMethod"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +const chaosHandlerOptions = new ChaosHandlerOptions(); +const chaosHandler = new ChaosHandler(); +describe("ChaosHandler.ts", () => { + /* tslint:disable: no-string-literal */ + describe("constructor", () => { + it("Should create an instance with given options", () => { + const handler = new ChaosHandler(chaosHandlerOptions); + assert.isDefined(handler["options"]); + }); + it("Should create an instance with default set of options", () => { + const handler = new ChaosHandler(); + assert.isDefined(handler["options"]); + }); + }); + describe("createResponseHeaders", () => { + it("Should have request-id for every random statusCode", () => { + const responseHeader = chaosHandler["createResponseHeaders"](204, "xxxxxxxxxxxxxxxx", new Date().toString()); + assert.isDefined(responseHeader.get("request-id")); + }); + it("Should have retry-after for 429 case", () => { + const responseHeader = chaosHandler["createResponseHeaders"](429, "xxxxxxxxxxxxxxxx", new Date().toString()); + assert.isDefined(responseHeader.get("retry-after")); + }); + }); + describe("createResponseBody", () => { + it("Should return error in response body for error scenarios", () => { + const responseBody = chaosHandler["createResponseBody"](404, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); + assert.isDefined(responseBody["error"]); + }); + it("Should return empty response body for success scenarios", () => { + const responseBody = chaosHandler["createResponseBody"](200, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); + assert.equal(Object.keys(responseBody).length, 0); + }); + }); + describe("createResponse", () => { + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + }; + it("Should return a valid response object for MANUAL case", () => { + chaosHandler["createResponse"](new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Manual response", 404), cxt); + assert.isDefined(cxt.response); + }); + it("Should return a valid response object for RANDOM case", () => { + chaosHandler["createResponse"](new ChaosHandlerOptions(ChaosStrategy.RANDOM), cxt); + assert.isDefined(cxt.response); + }); + }); + describe("sendRequest", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + }; + const manualMap = new Map([["/me", new Map([["GET", 500]])]]); + const tempManualOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL); + const tempChaosHandler = new ChaosHandler(tempManualOptions, manualMap); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + const handler = new ChaosHandler(); + handler.setNext(dummyHTTPHandler); + it("Should return a response after creating it", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + tempChaosHandler["sendRequest"](tempManualOptions, cxt); + assert.isDefined(cxt.response); + })); + it("Should send the request to the graph", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + handler["sendRequest"](new ChaosHandlerOptions(ChaosStrategy.RANDOM, "I generated the error", undefined, 100), cxt); + assert.isDefined(cxt.response); + })); + })); + describe("getRandomStatusCode", () => { + it("Should return a status code for GET method", () => { + assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.GET)); + }); + it("Should return a status code for POST method", () => { + assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.POST)); + }); + it("Should return a status code for PUT method", () => { + assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.PUT)); + }); + it("Should return a status code for PATCH method", () => { + assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.PATCH)); + }); + it("Should return a status code for DELETE method", () => { + assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.DELETE)); + }); + }); + describe("getRelativeURL", () => { + it("Should return a relative URL for the complete URL", () => { + assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me"), "/me"); + }); + it("Should return a relative URL for the complete URL with filter", () => { + assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me/messages?filter=emailAddress eq 'jon@contoso.com'"), "/me/messages"); + }); + it("Should return a relative URL for the complete URL with ids", () => { + assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me/messages/q1abcxx-xxxxxx-xxxxabc"), "/me/messages/q1abcxx-xxxxxx-xxxxabc"); + }); + it("Should return a relative URL for the complete URL in case of beta", () => { + assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/beta/me/messages"), "/me/messages"); + }); + }); + describe("setStatusCode", () => { + const manualMap = new Map([["/me/messages/.*", new Map([["GET", 500], ["PATCH", 201]])], ["/me", new Map([["GET", 500], ["PATCH", 201]])]]); + const tempManualOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL); + const tempManualOptionsRegex = new ChaosHandlerOptions(ChaosStrategy.MANUAL); + const tempChaosHandlerManual = new ChaosHandler(tempManualOptions, manualMap); + const tempChaosHandlerManualRegex = new ChaosHandler(tempManualOptionsRegex, manualMap); + it("Should set a statusCode for MANUAL mode", () => { + const tempOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Set status code", 404); + chaosHandler["setStatusCode"](tempOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.GET); + assert.isDefined(tempOptions.statusCode); + }); + it("Should set a statusCode for RANDOM mode", () => { + const tempOptions = new ChaosHandlerOptions(ChaosStrategy.RANDOM, "I generated the error", undefined, 100); + chaosHandler["setStatusCode"](tempOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.POST); + assert.isDefined(tempOptions.statusCode); + }); + it("Should set a statusCode for MANUAL mode with manualMap", () => { + tempChaosHandlerManual["setStatusCode"](tempManualOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.PATCH); + assert.equal(tempManualOptions.statusCode, 201); + }); + it("Should set a statusCode for MANUAL mode with manualMap matching regex", () => { + tempChaosHandlerManualRegex["setStatusCode"](tempManualOptionsRegex, "https://graph.microsoft.com/v1.0/me/messages/abc123-xxxxx-xxxxx", RequestMethod.GET); + assert.equal(tempManualOptionsRegex.statusCode, 500); + }); + }); + describe("getOptions", () => { + it("Should return the options in the context object", () => { + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Get options", 405); + const cxt = { + request: "url", + middlewareControl: new MiddlewareControl([options]), + }; + const o = chaosHandler["getOptions"](cxt); + assert.equal(o.chaosStrategy, ChaosStrategy.MANUAL); + assert.equal(o.statusCode, 405); + }); + it("Should return the default set of options with RANDOM in the middleware", () => { + const cxt = { + request: "url", + }; + const o = chaosHandler["getOptions"](cxt); + assert.equal(o.chaosStrategy, ChaosStrategy.RANDOM); + assert.equal(o.statusCode, undefined); + }); + it("Should return the default set of options with DEFAULT in the middleware", () => { + const tempChaosHandler = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.MANUAL)); + const cxt = { + request: "url", + }; + const o = tempChaosHandler["getOptions"](cxt); + assert.equal(o.chaosStrategy, ChaosStrategy.MANUAL); + assert.equal(o.statusCode, undefined); + }); + }); + describe("execute", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const manualMap = new Map([["/me", new Map([["GET", 500], ["PATCH", 201]])]]); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + const tempChaosHandlerDefault = new ChaosHandler(new ChaosHandlerOptions()); + const tempChaosHandlerRandom = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.RANDOM)); + const tempChaosHandlerManual = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.MANUAL), manualMap); + tempChaosHandlerDefault.setNext(dummyHTTPHandler); + tempChaosHandlerRandom.setNext(dummyHTTPHandler); + tempChaosHandlerManual.setNext(dummyHTTPHandler); + it("Should return response for Default Case", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new ChaosHandlerOptions(ChaosStrategy.RANDOM); + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + middlewareControl: new MiddlewareControl([options]), + }; + assert.isDefined(tempChaosHandlerDefault["execute"](cxt)); + })); + it("Should return response for Random case", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + }; + assert.isDefined(tempChaosHandlerRandom["execute"](cxt)); + })); + it("Should return response for Manual Global case", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + }; + assert.isDefined(tempChaosHandlerManual["execute"](cxt)); + })); + it("Should return response for Manual Request Level case", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Manual Request level case", 200); + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "GET", + }, + middlewareControl: new MiddlewareControl([options]), + }; + assert.isDefined(tempChaosHandlerManual["execute"](cxt)); + })); + })); +}); +//# sourceMappingURL=ChaosHandler.js.map diff --git a/test/dist/es/test/common/middleware/ChaosHandler.js.map b/test/dist/es/test/common/middleware/ChaosHandler.js.map new file mode 100644 index 000000000..35318728c --- /dev/null +++ b/test/dist/es/test/common/middleware/ChaosHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ChaosHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/ChaosHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;AACtD,MAAM,YAAY,GAAG,I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EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;YAC9D,MAAM,GAAG,GAAY;gBACpB,OAAO,EAAE,qCAAqC;gBAC9C,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,GAAS,EAAE;YACrE,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,aAAa,CAAC,MAAM,EAAE,2BAA2B,EAAE,GAAG,CAAC,CAAC;YAChG,MAAM,GAAG,GAAY;gBACpB,OAAO,EAAE,qCAAqC;gBAC9C,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;gBACD,iBAAiB,EAAE,IAAI,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;aACnD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js new file mode 100644 index 000000000..11a4f83b0 --- /dev/null +++ b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js @@ -0,0 +1,17 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; +describe("MSALAuthenticationProviderOptions.ts", () => { + it("Should create an instance with all the given options", () => { + const scopes = ["dummy.scope"]; + const options = new MSALAuthenticationProviderOptions(scopes); + assert.isDefined(options.scopes); + assert.equal(options.scopes, scopes); + }); +}); +//# sourceMappingURL=MSALAuthenticationProviderOptions.js.map diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map new file mode 100644 index 000000000..fd972ff71 --- /dev/null +++ b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MSALAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/MSALAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAEnG,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.d.ts b/test/dist/es/test/common/middleware/MiddlewareControl.d.ts new file mode 100644 index 000000000..ac7981909 --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareControl.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.js b/test/dist/es/test/common/middleware/MiddlewareControl.js new file mode 100644 index 000000000..a00294496 --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareControl.js @@ -0,0 +1,44 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/** + * @module MiddlewareControl + */ +import { assert } from "chai"; +import "isomorphic-fetch"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { DummyHandlerOptions } from "../DummyHandlerOptions"; +describe("MiddlewareControl.ts", () => { + const dummyHandlerOption = new DummyHandlerOptions(); + /* tslint:disable: no-string-literal */ + describe("constructor", () => { + it("Should populate its middleware options map", () => { + const middlewareControl = new MiddlewareControl([dummyHandlerOption]); + assert.isDefined(middlewareControl["middlewareOptions"]); + assert.equal(middlewareControl["middlewareOptions"].size, 1); + }); + it("Should create empty middleware options map by default", () => { + const middlewareControl = new MiddlewareControl(); + assert.isDefined(middlewareControl["middlewareOptions"]); + assert.equal(middlewareControl["middlewareOptions"].size, 0); + }); + }); + /* tslint:enable: no-string-literal */ + describe("getMiddlewareOption", () => { + it("Should return the middleware option for a given class name", () => { + const middlewareControl = new MiddlewareControl([dummyHandlerOption]); + const retryOptions = middlewareControl.getMiddlewareOptions(dummyHandlerOption.constructor); + assert.isDefined(retryOptions); + assert.equal(dummyHandlerOption, retryOptions); + }); + it("Should return undefined for unknown class name", () => { + const middlewareControl = new MiddlewareControl([dummyHandlerOption]); + const retryOptions = middlewareControl.getMiddlewareOptions(() => "NotAvailableHandlerOption"); + assert.isUndefined(retryOptions); + }); + }); +}); +//# sourceMappingURL=MiddlewareControl.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.js.map b/test/dist/es/test/common/middleware/MiddlewareControl.js.map new file mode 100644 index 000000000..90ccf6c7b --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareControl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MiddlewareControl.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,MAAM,kBAAkB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACrD,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACrD,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;YACtE,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACzD,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;YACjE,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;YAClD,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACzD,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;IAEtC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;YACrE,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;YACtE,MAAM,YAAY,GAAwB,iBAAiB,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,WAAwB,CAAwB,CAAC;YACrJ,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC/B,MAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACzD,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;YACtE,MAAM,YAAY,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,CAAC;YAC/F,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts b/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.js b/test/dist/es/test/common/middleware/MiddlewareFactory.js new file mode 100644 index 000000000..f9e1bb694 --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareFactory.js @@ -0,0 +1,23 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { AuthenticationHandler, CustomAuthenticationProvider, HTTPMessageHandler, RedirectHandler, RetryHandler, TelemetryHandler } from "../../../src"; +import { MiddlewareFactory } from "../../../src/middleware/MiddlewareFactory"; +describe("MiddlewareFactory", () => { + it("Should return the default pipeline", () => { + const provider = (done) => { + done(null, "dummy_token"); + }; + const defaultMiddleWareArray = MiddlewareFactory.getDefaultMiddlewareChain(new CustomAuthenticationProvider(provider)); + assert.isTrue(defaultMiddleWareArray[0] instanceof AuthenticationHandler); + assert.isTrue(defaultMiddleWareArray[1] instanceof RetryHandler); + assert.isTrue(defaultMiddleWareArray[2] instanceof RedirectHandler); + assert.isTrue(defaultMiddleWareArray[3] instanceof TelemetryHandler); + assert.isTrue(defaultMiddleWareArray[4] instanceof HTTPMessageHandler); + }); +}); +//# sourceMappingURL=MiddlewareFactory.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.js.map b/test/dist/es/test/common/middleware/MiddlewareFactory.js.map new file mode 100644 index 000000000..4a3b2866e --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareFactory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MiddlewareFactory.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC7C,MAAM,QAAQ,GAAiB,CAAC,IAAI,EAAE,EAAE;YACvC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEvH,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,qBAAqB,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,YAAY,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,eAAe,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,gBAAgB,CAAC,CAAC;QACrE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,kBAAkB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.d.ts b/test/dist/es/test/common/middleware/MiddlewareUtil.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.js b/test/dist/es/test/common/middleware/MiddlewareUtil.js new file mode 100644 index 000000000..b02f84ac6 --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareUtil.js @@ -0,0 +1,306 @@ +// /** +// * ------------------------------------------------------------------------------------------- +// * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. +// * See License in the project root for license information. +// * ------------------------------------------------------------------------------------------- +// */ +// import { assert } from "chai"; +// import { NFHeaders } from "node-fetch"; +// import { FetchOptions } from "../../src/IFetchOptions"; +// import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../src/middleware/MiddlewareUtil"; +// describe("MiddlewareUtil.ts", async () => { +// describe("getRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const url = "dummy_url"; +// it("Should get header from request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// const headerValue: string = getRequestHeader(request, undefined, key); +// assert.equal(headerValue, value); +// }); +// it("Should get header from headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); +// it("Should get header from Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ +// version: "version", +// [key]: value, +// }), +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); +// it("Should get header from array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"], [key, value]], +// }; +// const headerValue: string = getRequestHeader(url, options, key); +// assert.equal(headerValue, value); +// }); +// }); +// describe("setRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const url = "dummy_url"; +// it("Should set header in request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// }, +// }); +// setRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); +// it("Should replace header in request object if the header is already present", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// setRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); +// it("Should set header for empty headers", () => { +// const options: FetchOptions = { +// method: "test", +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); +// it("Should set header in headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// }, +// }; +// setRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); +// it("Should replace header in headers object if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// setRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); +// it("Should set header in Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version" }), +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); +// it("Should replace header in Headers instance if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: value }), +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); +// it("Should set header in array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"]], +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal(options.headers[1][1], value); +// }); +// it("Should replace header in array of headers if header is already present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, "dummy/type"]], +// }; +// setRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 1); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], value); +// }); +// }); +// describe("appendRequestHeader", () => { +// const key: string = "Content-Type"; +// const value: string = "application/json"; +// const firstValue: string = "text/html"; +// const url = "dummy_url"; +// it("Should set header in request object if the header is not present", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// assert.equal(request.headers.get(key), value); +// }); +// it("Should append header in request object", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: firstValue, +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// const values = (request.headers as NFHeaders).getAll(key); +// assert.equal(values[0], firstValue); +// assert.equal(values[1], value); +// }); +// it("Should append header in request object even if the value is duplicate", () => { +// const request: Request = new Request(url, { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }); +// appendRequestHeader(request, undefined, key, value); +// const values = (request.headers as NFHeaders).getAll(key); +// assert.equal(values[0], value); +// assert.equal(values[1], value); +// }); +// it("Should set header for empty headers", () => { +// const options: FetchOptions = { +// method: "test", +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as NFHeaders).get(key), value); +// }); +// it("Should set header in headers object if header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], value); +// }); +// it("Should append header in headers object", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: firstValue, +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], `${firstValue}, ${value}`); +// }); +// it("Should append header in headers object even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: { +// version: "version", +// [key]: value, +// }, +// }; +// appendRequestHeader(url, options, key, value); +// assert.equal(options.headers[key], `${value}, ${value}`); +// }); +// it("Should set header in Headers instance if header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version" }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as Headers).get(key), value); +// }); +// it("Should append header in Headers instance", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: firstValue }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// const values = (options.headers as NFHeaders).getAll(key); +// assert.equal(values[0], firstValue); +// assert.equal(values[1], value); +// }); +// it("Should append header in Headers instance even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: new Headers({ version: "version", [key]: value }), +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// const values = (options.headers as NFHeaders).getAll(key); +// assert.equal(values[0], value); +// assert.equal(values[1], value); +// }); +// it("Should set header in array of headers if the header is not present", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [["version", "version"]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal(options.headers[1][1], value); +// }); +// it("Should append header in array of headers", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, firstValue]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 2); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], firstValue); +// assert.equal(options.headers[1][0], key); +// assert.equal(options.headers[1][1], value); +// }); +// it("Should append header in array of headers even if the value is duplicate", () => { +// const options: FetchOptions = { +// method: "test", +// headers: [[key, value]], +// }; +// appendRequestHeader(url, options, key, value); +// assert.isDefined(options.headers); +// assert.equal((options.headers as string[][]).length, 2); +// assert.equal(options.headers[0][0], key); +// assert.equal(options.headers[0][1], value); +// assert.equal(options.headers[1][0], key); +// assert.equal(options.headers[1][1], value); +// }); +// }); +// describe("generateUUID", () => { +// it("Should return the unique uuid", () => { +// const uuid = generateUUID(); +// assert.equal(uuid.length, 36); +// }); +// }); +// }); +//# sourceMappingURL=MiddlewareUtil.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.js.map b/test/dist/es/test/common/middleware/MiddlewareUtil.js.map new file mode 100644 index 000000000..fb5231efd --- /dev/null +++ b/test/dist/es/test/common/middleware/MiddlewareUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MiddlewareUtil.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareUtil.ts"],"names":[],"mappings":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sBAAsB;AACtB,yCAAyC;AACzC,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,iDAAiD;AACjD,QAAQ;AAER,2DAA2D;AAC3D,qCAAqC;AACrC,sBAAsB;AACtB,oCAAoC;AACpC,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,8DAA8D;AAC9D,+CAA+C;AAC/C,sDAAsD;AACtD,+CAA+C;AAC/C,iDAAiD;AACjD,QAAQ;AAER,0FAA0F;AAC1F,qCAAqC;AACrC,sBAAsB;AACtB,+BAA+B;AAC/B,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,8DAA8D;AAC9D,+CAA+C;AAC/C,iDAAiD;AACjD,+CAA+C;AAC/C,iDAAiD;AACjD,QAAQ;AACR,OAAO;AAEP,oCAAoC;AACpC,gDAAgD;AAChD,kCAAkC;AAClC,oCAAoC;AACpC,QAAQ;AACR,OAAO;AACP,MAAM"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RedirectHandler.d.ts b/test/dist/es/test/common/middleware/RedirectHandler.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/RedirectHandler.js b/test/dist/es/test/common/middleware/RedirectHandler.js new file mode 100644 index 000000000..73f01b226 --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandler.js @@ -0,0 +1,323 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; +import { RedirectHandler } from "../../../src/middleware/RedirectHandler"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +const redirectHandlerOptions = new RedirectHandlerOptions(); +const redirectHandler = new RedirectHandler(); +describe("RedirectHandler.ts", () => { + /* tslint:disable: no-string-literal */ + describe("constructor", () => { + it("Should create an instance with given options", () => { + const handler = new RedirectHandler(redirectHandlerOptions); + assert.isDefined(handler["options"]); + }); + it("Should create an instance with default set of options", () => { + const handler = new RedirectHandler(); + assert.isDefined(handler["options"]); + }); + }); + describe("isRedirect", () => { + it("Should return true for response having 301 status code", () => { + const response = new Response("Dummy", { + status: 301, + }); + assert.isTrue(redirectHandler["isRedirect"](response)); + }); + it("Should return true for response having 302 status code", () => { + const response = new Response("Dummy", { + status: 302, + }); + assert.isTrue(redirectHandler["isRedirect"](response)); + }); + it("Should return true for response having 303 status code", () => { + const response = new Response("Dummy", { + status: 303, + }); + assert.isTrue(redirectHandler["isRedirect"](response)); + }); + it("Should return true for response having 307 status code", () => { + const response = new Response("Dummy", { + status: 307, + }); + assert.isTrue(redirectHandler["isRedirect"](response)); + }); + it("Should return true for response having 308 status code", () => { + const response = new Response("Dummy", { + status: 308, + }); + assert.isTrue(redirectHandler["isRedirect"](response)); + }); + it("Should return false for non redirect status codes", () => { + const response = new Response("Dummy", { + status: 200, + }); + assert.isFalse(redirectHandler["isRedirect"](response)); + }); + }); + describe("hasLocationHeader", () => { + it("Should return true for response with location header", () => { + const res = new Response("Dummy", { + status: 301, + headers: { + location: "https://dummylocation.microsoft.com", + }, + }); + assert.isTrue(redirectHandler["hasLocationHeader"](res)); + }); + it("Should return false for response without location header", () => { + const res = new Response("Dummy", { + status: 301, + }); + assert.isFalse(redirectHandler["hasLocationHeader"](res)); + }); + }); + describe("getLocationHeader", () => { + it("Should return location from response", () => { + const location = "https://dummylocation.microsoft.com"; + const res = new Response("Dummy", { + status: 301, + headers: { + location, + }, + }); + assert.equal(redirectHandler["getLocationHeader"](res), location); + }); + it("Should return null for response without location header", () => { + const res = new Response("Dummy", { + status: 301, + }); + assert.equal(redirectHandler["getLocationHeader"](res), null); + }); + }); + describe("isRelativeURL", () => { + it("Should return true for a relative url", () => { + const url = "/graphproxy/me"; + assert.isTrue(redirectHandler["isRelativeURL"](url)); + }); + it("Should return false for a absolute url", () => { + const url = "https://graph.microsoft.com/v1.0/graphproxy/me"; + assert.isFalse(redirectHandler["isRelativeURL"](url)); + }); + }); + describe("shouldDropAuthorizationHeader", () => { + it("Should return true for urls with different domain", () => { + const requestUrl = "https://graph.microsoft.com/v1.0/me"; + const redirectedUrl = "https://graphredirection.microsoft.com/v1.0/me"; + assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + it("Should return true for urls with different domain and one without path", () => { + const requestUrl = "https://graph.microsoft.com/v1.0/me"; + const redirectedUrl = "https://graphredirection.microsoft.com/"; + assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + it("Should return true for urls with different domain without path", () => { + const requestUrl = "https://graph.microsoft.com/"; + const redirectedUrl = "https://graphredirection.microsoft.com"; + assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + it("Should return false relative urls", () => { + const requestUrl = "/graph/me/"; + const redirectedUrl = "/graphRedirection/me"; + assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + it("Should return false redirect url is relative", () => { + const requestUrl = "https://graph.microsoft.com/v1.0/me"; + const redirectedUrl = "/graphRedirection"; + assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + it("Should return false for urls with same domain", () => { + const requestUrl = "https://graph.microsoft.com/v1.0/me"; + const redirectedUrl = "https://graph.microsoft.com/v2.0/me"; + assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); + }); + }); + describe("getOptions", () => { + it("Should return the options in the context object", () => { + const maxRedirects = 10; + const shouldRedirect = () => false; + const options = new RedirectHandlerOptions(maxRedirects, shouldRedirect); + const cxt = { + request: "url", + middlewareControl: new MiddlewareControl([options]), + }; + const o = redirectHandler["getOptions"](cxt); + assert.equal(o.maxRedirects, maxRedirects); + assert.equal(o.shouldRedirect, shouldRedirect); + }); + it("Should return the default set of options in the middleware", () => { + const cxt = { + request: "url", + }; + const o = redirectHandler["getOptions"](cxt); + assert.equal(o.maxRedirects, redirectHandler["options"].maxRedirects); + assert.equal(o.shouldRedirect, redirectHandler["options"].shouldRedirect); + }); + }); + describe("executeWithRedirect", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const context = { + request: "/me", + options: { + method: "GET", + }, + }; + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + const handler = new RedirectHandler(); + handler.setNext(dummyHTTPHandler); + it("Should not redirect for the redirect count equal to maxRedirects", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const maxRedirect = 1; + const options = new RedirectHandlerOptions(maxRedirect); + dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRedirect"](context, maxRedirect, options); + assert.equal(context.response.status, 301); + })); + it("Should not redirect for the non redirect response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + dummyHTTPHandler.setResponses([new Response("", { status: 200 })]); + yield handler["executeWithRedirect"](context, 0, options); + assert.equal(context.response.status, 200); + })); + it("Should not redirect for the redirect response without location header", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRedirect"](context, 0, options); + assert.equal(context.response.status, 301); + })); + it("Should not redirect for shouldRedirect callback returning false", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(undefined, () => false); + dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRedirect"](context, 0, options); + assert.equal(context.response.status, 301); + })); + it("Should drop body and change method to get for SEE_OTHER status code", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + const cxt = { + request: "/me", + options: { + method: "POST", + body: "dummy body", + }, + }; + dummyHTTPHandler.setResponses([ + new Response("", { + status: 303, + headers: { + [RedirectHandler["LOCATION_HEADER"]]: "/location", + }, + }), + new Response("ok", { status: 200 }), + ]); + yield handler["executeWithRedirect"](context, 0, options); + assert.isUndefined(context.options.body); + assert.equal(context.options.method, "GET"); + assert.equal(context.response.status, 200); + })); + it("Should not drop Authorization header for relative url redirect", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + const cxt = { + request: "/me", + options: { + method: "POST", + body: "dummy body", + headers: { + [RedirectHandler["AUTHORIZATION_HEADER"]]: "Bearer TEST", + }, + }, + }; + dummyHTTPHandler.setResponses([ + new Response("", { + status: 301, + headers: { + [RedirectHandler["LOCATION_HEADER"]]: "/location", + }, + }), + new Response("ok", { status: 200 }), + ]); + yield handler["executeWithRedirect"](cxt, 0, options); + assert.isDefined(cxt.options.headers[RedirectHandler["AUTHORIZATION_HEADER"]]); + assert.equal(cxt.response.status, 200); + })); + it("Should not drop Authorization header for same authority redirect url", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "POST", + body: "dummy body", + headers: { + [RedirectHandler["AUTHORIZATION_HEADER"]]: "Bearer TEST", + }, + }, + }; + dummyHTTPHandler.setResponses([ + new Response("", { + status: 301, + headers: { + [RedirectHandler["LOCATION_HEADER"]]: "https://graph.microsoft.com/v2.0/me", + }, + }), + new Response("ok", { status: 200 }), + ]); + yield handler["executeWithRedirect"](cxt, 0, options); + assert.isDefined(cxt.options.headers[RedirectHandler["AUTHORIZATION_HEADER"]]); + assert.equal(cxt.response.status, 200); + })); + it("Should return success response after successful redirect", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RedirectHandlerOptions(); + const cxt = { + request: "https://graph.microsoft.com/v1.0/me", + options: { + method: "POST", + body: "dummy body", + }, + }; + dummyHTTPHandler.setResponses([ + new Response(null, { + status: 301, + headers: { + [RedirectHandler["LOCATION_HEADER"]]: "https://graphredirect.microsoft.com/v1.0/me", + }, + }), + new Response("ok", { status: 200 }), + ]); + yield handler["executeWithRedirect"](cxt, 0, options); + assert.equal(cxt.response.status, 200); + })); + })); + describe("execute", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + it("Should set the redirect value in options to manual", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const context = { + request: "/me", + options: { + method: "GET", + }, + }; + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + const handler = new RedirectHandler(); + handler.setNext(dummyHTTPHandler); + dummyHTTPHandler.setResponses([new Response("", { status: 200 })]); + yield handler.execute(context); + assert.equal(context.options.redirect, RedirectHandler["MANUAL_REDIRECT"]); + })); + })); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=RedirectHandler.js.map diff --git a/test/dist/es/test/common/middleware/RedirectHandler.js.map b/test/dist/es/test/common/middleware/RedirectHandler.js.map new file mode 100644 index 000000000..4bc78ef8d --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RedirectHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/RedirectHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE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,SAAS,EAAE,GAAS,EAAE;QAC9B,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;YACnE,MAAM,OAAO,GAAY;gBACxB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACvD,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;YACtC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAClC,gBAAgB,CAAC,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACnE,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts b/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js new file mode 100644 index 000000000..322c76c45 --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js @@ -0,0 +1,48 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; +describe("RedirectHandlerOptions.ts", () => { + describe("constructor", () => { + it("Should initialize the instance with given options", () => { + const shouldRedirect = (response) => { + if (response.status === 301) { + return true; + } + return false; + }; + const maxRedirects = 5; + const options = new RedirectHandlerOptions(maxRedirects, shouldRedirect); + assert.equal(options.maxRedirects, maxRedirects); + assert.equal(options.shouldRedirect, shouldRedirect); + }); + it("Should throw error for setting max redirects more than allowed", () => { + try { + const options = new RedirectHandlerOptions(100); + throw new Error("Something wrong with the max redirects value redirection"); + } catch (error) { + assert.equal(error.name, "MaxLimitExceeded"); + } + }); + it("Should throw error for setting max redirects to negative", () => { + try { + const options = new RedirectHandlerOptions(-10); + throw new Error("Something wrong with the max redirects value redirection"); + } catch (error) { + assert.equal(error.name, "MinExpectationNotMet"); + } + }); + /* tslint:disable: no-string-literal */ + it("Should initialize instance with default options", () => { + const options = new RedirectHandlerOptions(); + assert.equal(options.maxRedirects, RedirectHandlerOptions["DEFAULT_MAX_REDIRECTS"]); + assert.equal(options.shouldRedirect, RedirectHandlerOptions["DEFAULT_SHOULD_RETRY"]); + }); + /* tslint:enable: no-string-literal */ + }); +}); +//# sourceMappingURL=RedirectHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map new file mode 100644 index 000000000..f8ac5444e --- /dev/null +++ b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RedirectHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/RedirectHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MA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,uCAAuC;QACvC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YAC1D,MAAM,OAAO,GAAG,IAAI,sBAAsB,EAAE,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,CAAC,CAAC;YACpF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAC,CAAC;QACtF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RetryHandler.d.ts b/test/dist/es/test/common/middleware/RetryHandler.d.ts new file mode 100644 index 000000000..ac7981909 --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/middleware/RetryHandler.js b/test/dist/es/test/common/middleware/RetryHandler.js new file mode 100644 index 000000000..ef889693d --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandler.js @@ -0,0 +1,221 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import "isomorphic-fetch"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { RetryHandlerOptions } from "../../../src/middleware/options/RetryHandlerOptions"; +import { RetryHandler } from "../../../src/middleware/RetryHandler"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +describe("RetryHandler.ts", function() { + this.timeout(20 * 1000); + const retryHandler = new RetryHandler(); + const retryHandlerOptions = new RetryHandlerOptions(); + const tooManyRequestsResponseWithRetryAfterDelay = new Response("", { + status: 429, + statusText: "TooManyRequests", + headers: { + "Retry-After": "10", + }, + }); + const tooManyRequestsResponseWithRetyAfterDate = new Response("", { + status: 429, + statusText: "TooManyRequests", + headers: { + "Retry-After": new Date(Date.now() + 10000).toUTCString(), + }, + }); + const serviceUnavailableResponse = new Response("", { + status: 503, + statusText: "ServiceUnavailable", + }); + const gatewayTimeoutResponse = new Response("", { + status: 504, + statusText: "GatewayTimeout", + }); + const nonRetryResponse = new Response("", { + status: 200, + statusText: "OK", + }); + /* tslint:disable: no-string-literal */ + describe("constructor", () => { + it("Should set the option member with retryHanderOptions", () => { + const handler = new RetryHandler(retryHandlerOptions); + assert.isDefined(handler["options"]); + }); + it("Should create retryHandler instance with default retryHandlerOptions", () => { + const handler = new RetryHandler(); + assert.isDefined(handler["options"]); + }); + }); + describe("isRetry", () => { + it("Should return true for 429 response", () => { + assert.isTrue(retryHandler["isRetry"](tooManyRequestsResponseWithRetryAfterDelay)); + }); + it("Should return true for 503 response", () => { + assert.isTrue(retryHandler["isRetry"](serviceUnavailableResponse)); + }); + it("Should return true for 504 response", () => { + assert.isTrue(retryHandler["isRetry"](gatewayTimeoutResponse)); + }); + it("Should return false for non retry response", () => { + assert.isFalse(retryHandler["isRetry"](nonRetryResponse)); + }); + }); + describe("isBuffered", () => { + const url = "dummy_url"; + it("Should succeed for non post, patch, put requests", () => { + const options = { + method: "GET", + }; + assert.isTrue(retryHandler["isBuffered"](url, options)); + }); + it("Should succeed for post request with non stream request", () => { + const options = { + method: "POST", + body: "test", + }; + assert.isTrue(retryHandler["isBuffered"](url, options)); + }); + it("Should fail for stream request", () => { + const options = { + method: "PUT", + headers: { + "Content-Type": "application/octet-stream", + }, + }; + assert.isFalse(retryHandler["isBuffered"](url, options)); + }); + }); + describe("getDelay", () => { + it("Should return retry delay from the response header", () => { + const delay = retryHandler["getDelay"](tooManyRequestsResponseWithRetryAfterDelay, 1, 5); + assert.equal(delay, 10); + }); + it("Should return retry delay from the response header mentioning delay time", () => { + const delay = retryHandler["getDelay"](tooManyRequestsResponseWithRetyAfterDate, 1, 5); + assert.isDefined(delay); + }); + it("Should return delay without exponential backoff", () => { + const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 1, 10); + assert.isAbove(delay, 10); + assert.isBelow(delay, 11); + }); + it("Should return delay with exponential backoff", () => { + const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 2, 10); + assert.isAbove(delay, 12); + assert.isBelow(delay, 13); + }); + it("Should return max delay for if the calculated delay is more", () => { + const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 10, 100); + assert.isAbove(delay, 180); + assert.isBelow(delay, 181); + }); + }); + describe("getExponentialBackOffTime", () => { + it("Should return 0 delay for 0th attempt i.e for a fresh request", () => { + const time = retryHandler["getExponentialBackOffTime"](0); + assert.equal(time, 0); + }); + it("Should return attempt time", () => { + const time = retryHandler["getExponentialBackOffTime"](1); + assert.equal(time, 1); + }); + }); + describe("sleep", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + it("Should run the sleep method for 1 second", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + yield retryHandler["sleep"](1); + } catch (error) { + throw error; + } + })); + })); + describe("getOptions", () => { + it("Should return the options in the context object", () => { + const delay = 10; + const maxRetries = 8; + const shouldRetry = () => false; + const options = new RetryHandlerOptions(delay, maxRetries, shouldRetry); + const cxt = { + request: "url", + middlewareControl: new MiddlewareControl([options]), + }; + const o = retryHandler["getOptions"](cxt); + assert.equal(o.delay, delay); + assert.equal(o.maxRetries, maxRetries); + assert.equal(o.shouldRetry, shouldRetry); + }); + it("Should return the default set of options in the middleware", () => { + const cxt = { + request: "url", + }; + const o = retryHandler["getOptions"](cxt); + assert.equal(o.delay, retryHandler["options"].delay); + assert.equal(o.maxRetries, retryHandler["options"].maxRetries); + assert.equal(o.shouldRetry, retryHandler["options"].shouldRetry); + }); + }); + describe("executeWithRetry", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const options = new RetryHandlerOptions(); + const handler = new RetryHandler(options); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + handler.setNext(dummyHTTPHandler); + const cxt = { + request: "url", + options: { + method: "GET", + }, + }; + it("Should return non retried response incase of maxRetries busted out", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRetry"](cxt, RetryHandlerOptions["MAX_MAX_RETRIES"], options); + assert.equal(cxt.response.status, 429); + })); + it("Should return succeeded response for non retry response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + dummyHTTPHandler.setResponses([new Response("ok", { status: 200 })]); + yield handler["executeWithRetry"](cxt, 0, options); + assert.equal(cxt.response.status, 200); + })); + it("Should return non retried response for streaming request", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const c = { + request: "url", + options: { + method: "POST", + headers: { + "Content-Type": "application/octet-stream", + }, + }, + }; + dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRetry"](c, 0, options); + assert.equal(c.response.status, 429); + })); + it("Should successfully retry and return ok response", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const opts = new RetryHandlerOptions(1); + dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRetry"](cxt, 0, options); + assert.equal(cxt.response.status, 200); + })); + it("Should fail by exceeding max retries", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const opts = new RetryHandlerOptions(1, 2); + dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); + yield handler["executeWithRetry"](cxt, 0, opts); + assert.equal(cxt.response.status, 429); + })); + })); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=RetryHandler.js.map diff --git a/test/dist/es/test/common/middleware/RetryHandler.js.map b/test/dist/es/test/common/middleware/RetryHandler.js.map new file mode 100644 index 000000000..03780a671 --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RetryHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/RetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAe,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,iBAAiB,EAAE;IAC3B,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACxB,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IACxC,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,MAAM,0CAA0C,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;QACnE,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,iBAAiB;QAC7B,OAAO,EAAE;YACR,aAAa,EAAE,IAAI;SACnB;KACD,CAAC,CAAC;IACH,MAAM,wCAAwC,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;QACjE,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,iBAAiB;QAC7B,OAAO,EAAE;YACR,aAAa,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,WAAW,EAAE;SACzD;KACD,CAAC,CAAC;IACH,MAAM,0BAA0B,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;QACnD,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,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,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts b/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.js b/test/dist/es/test/common/middleware/RetryHandlerOptions.js new file mode 100644 index 000000000..d5a59d8c6 --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandlerOptions.js @@ -0,0 +1,94 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { RetryHandlerOptions } from "../../../src/middleware/options/RetryHandlerOptions"; +describe("RetryHandlerOptions.ts", () => { + /* tslint:disable: no-string-literal */ + describe("Constructor", () => { + it("Should use default values if not given", () => { + try { + const options = new RetryHandlerOptions(); + assert.equal(options["delay"], RetryHandlerOptions["DEFAULT_DELAY"]); + assert.equal(options["maxRetries"], RetryHandlerOptions["DEFAULT_MAX_RETRIES"]); + assert.equal(options["shouldRetry"], RetryHandlerOptions["DEFAULT_SHOULD_RETRY"]); + } catch (error) { + throw error; + } + }); + it("Should throw error for both delay and maxRetries are higher than the limit", () => { + try { + const options = new RetryHandlerOptions(1000, 1000); + throw new Error("Something wrong with the delay and maxRetries max limit validation"); + } catch (error) { + assert.equal(error.name, "MaxLimitExceeded"); + } + }); + it("Should throw error for delay is higher than the limit", () => { + try { + const options = new RetryHandlerOptions(1000, 2); + throw new Error("Something wrong with the delay max limit validation"); + } catch (error) { + assert.equal(error.name, "MaxLimitExceeded"); + } + }); + it("Should throw error for maxRetries is higher than the limit", () => { + try { + const options = new RetryHandlerOptions(1, 2000); + throw new Error("Something wrong with the maxRetries max limit validation"); + } catch (error) { + assert.equal(error.name, "MaxLimitExceeded"); + } + }); + it("Should throw error for both delay and maxRetries are negative", () => { + try { + const options = new RetryHandlerOptions(-1, -100); + throw new Error("Something wrong with the delay and maxRetries max limit validation"); + } catch (error) { + assert.equal(error.name, "MinExpectationNotMet"); + } + }); + it("Should throw error for delay is negative", () => { + try { + const options = new RetryHandlerOptions(-5, 2); + throw new Error("Something wrong with the delay max limit validation"); + } catch (error) { + assert.equal(error.name, "MinExpectationNotMet"); + } + }); + it("Should throw error for maxRetries is negative", () => { + try { + const options = new RetryHandlerOptions(1, -10); + throw new Error("Something wrong with the maxRetries max limit validation"); + } catch (error) { + assert.equal(error.name, "MinExpectationNotMet"); + } + }); + it("Should accept all the given values", () => { + try { + const delay = 1; + const maxRetries = 3; + const shouldRetry = (d, a, req, o, res) => { + return false; + }; + const options = new RetryHandlerOptions(delay, maxRetries, shouldRetry); + assert.equal(options.delay, delay); + assert.equal(options.maxRetries, maxRetries); + assert.equal(options.shouldRetry, shouldRetry); + } catch (error) { + throw error; + } + }); + }); + describe("getMaxDelay", () => { + it("Should return the max delay value", () => { + const options = new RetryHandlerOptions(); + assert.equal(options.getMaxDelay(), RetryHandlerOptions["MAX_DELAY"]); + }); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=RetryHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map b/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map new file mode 100644 index 000000000..93fa877e3 --- /dev/null +++ b/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RetryHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/RetryHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAe,MAAM,qDAAqD,CAAC;AAEvG,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YACjD,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;gBACrE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAAC;gBAChF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CAAC;aAClF;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;YACrF,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;aACtF;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;aAC7C;QACF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAChE,IAAI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WAAW,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.d.ts b/test/dist/es/test/common/middleware/TelemetryHandler.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandler.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.js b/test/dist/es/test/common/middleware/TelemetryHandler.js new file mode 100644 index 000000000..88ff009f3 --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandler.js @@ -0,0 +1,104 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; +import { TelemetryHandler } from "../../../src/middleware/TelemetryHandler"; +import { PACKAGE_VERSION } from "../../../src/Version"; +import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +describe("TelemetryHandler.ts", () => { + /* tslint:disable: no-string-literal */ + describe("execute", function() { + this.timeout(20 * 1000); + const telemetryHandler = new TelemetryHandler(); + const dummyHTTPHandler = new DummyHTTPMessageHandler(); + telemetryHandler.setNext(dummyHTTPHandler); + const okayResponse = new Response("", { + status: 200, + statusText: "OK", + }); + it("Should not disturb client-request-id in the header", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const uuid = "dummy_uuid"; + const context = { + request: "url", + options: { + headers: { + "client-request-id": uuid, + }, + }, + }; + dummyHTTPHandler.setResponses([okayResponse]); + yield telemetryHandler.execute(context); + assert.equal(context.options.headers["client-request-id"], uuid); + } catch (error) { + throw error; + } + })); + it("Should create client-request-id if one is not present in the request header", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const context = { + request: "url", + options: { + headers: { + method: "GET", + }, + }, + }; + dummyHTTPHandler.setResponses([okayResponse]); + yield telemetryHandler.execute(context); + assert.isDefined(context.options.headers["client-request-id"]); + } catch (error) { + throw error; + } + })); + it("Should set sdk version header without feature flag usage if telemetry options is not present", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const context = { + request: "url", + options: { + headers: { + method: "GET", + }, + }, + }; + dummyHTTPHandler.setResponses([okayResponse]); + yield telemetryHandler.execute(context); + assert.equal(context.options.headers["SdkVersion"], `graph-js/${PACKAGE_VERSION}`); + } catch (error) { + throw error; + } + })); + it("Should set sdk version header with feature flag", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + try { + const telemetryOptions = new TelemetryHandlerOptions(); + telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + const context = { + request: "url", + options: { + headers: { + method: "GET", + }, + }, + middlewareControl: new MiddlewareControl([telemetryOptions]), + }; + dummyHTTPHandler.setResponses([okayResponse]); + yield telemetryHandler.execute(context); + assert.equal(context.options.headers["SdkVersion"], `graph-js/${PACKAGE_VERSION} (featureUsage=${FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED.toString(16)})`); + } catch (error) { + throw error; + } + })); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=TelemetryHandler.js.map diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.js.map b/test/dist/es/test/common/middleware/TelemetryHandler.js.map new file mode 100644 index 000000000..a3f763407 --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TelemetryHandler.js","source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BAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;gBACvD,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACrF,MAAM,OAAO,GAAY;oBACxB,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE;wBACR,OAAO,EAAE;4BACR,MAAM,EAAE,KAAK;yBACb;qBACD;oBACD,iBAAiB,EAAE,IAAI,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAC;iBAC5D,CAAC;gBACF,gBAAgB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9C,MAAM,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,YAAY,eAAe,kBAAkB,gBAAgB,CAAC,8BAA8B,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;aAClK;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js new file mode 100644 index 000000000..36d04deeb --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js @@ -0,0 +1,67 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; +import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; +describe("TelemetryHandlerOptions.ts", () => { + /* tslint:disable: no-string-literal no-bitwise */ + describe("constructor", () => { + it("Should initialize the feature usage flag with NONE flag", () => { + const telemetryOptions = new TelemetryHandlerOptions(); + assert.equal(telemetryOptions["featureUsage"], FeatureUsageFlag.NONE); + }); + }); + describe("updateFeatureUsageFlag", () => { + it("Should update feature usage flag for middleware control without telemetry handler option", () => { + const context = { + request: "url", + middlewareControl: new MiddlewareControl(), + }; + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); + assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + }); + it("Should update feature usage flag for middleware control with telemetry handler option", () => { + const context = { + request: "url", + middlewareControl: new MiddlewareControl([new TelemetryHandlerOptions()]), + }; + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); + assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + }); + it("Should update feature usage flag for context object without middleware control object", () => { + const context = { + request: "url", + }; + TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); + assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + }); + }); + describe("setFeatureUsage", () => { + it("Should set a given flags", () => { + const telemetryOptions = new TelemetryHandlerOptions(); + telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + telemetryOptions["setFeatureUsage"](FeatureUsageFlag.RETRY_HANDLER_ENABLED); + assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.RETRY_HANDLER_ENABLED, FeatureUsageFlag.RETRY_HANDLER_ENABLED); + assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.REDIRECT_HANDLER_ENABLED, FeatureUsageFlag.NONE); + }); + }); + describe("getFeatureUsage", () => { + it("Should return the feature usage in hexadecimal string", () => { + const telemetryOptions = new TelemetryHandlerOptions(); + telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); + telemetryOptions["setFeatureUsage"](FeatureUsageFlag.RETRY_HANDLER_ENABLED); + const usageFlag = telemetryOptions.getFeatureUsage(); + assert.equal(usageFlag, "6"); + }); + }); + /* tslint:enable: no-string-literal no-bitwise*/ +}); +//# sourceMappingURL=TelemetryHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map new file mode 100644 index 000000000..790a61a04 --- /dev/null +++ b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TelemetryHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/TelemetryHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE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;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAChE,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACvD,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;YACrF,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YAC5E,MAAM,SAAS,GAAG,gBAAgB,CAAC,eAAe,EAAE,CAAC;YACrD,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,gDAAgD;AACjD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts b/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.js b/test/dist/es/test/common/tasks/LargeFileUploadTask.js new file mode 100644 index 000000000..6be6f5277 --- /dev/null +++ b/test/dist/es/test/common/tasks/LargeFileUploadTask.js @@ -0,0 +1,171 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { LargeFileUploadTask } from "../../../src/tasks/LargeFileUploadTask"; +import { getClient } from "../test-helper"; +describe("LargeFileUploadTask.ts", () => { + /* tslint:disable: no-string-literal */ + describe("Parsing Range", () => { + const name = "sample_image.jpg"; + const arrayBuffer = new ArrayBuffer(80000); + const size = 100000; + const fileObj = { + content: arrayBuffer, + name, + size, + }; + const uploadSession = { + url: "test url", + expiry: new Date(), + }; + const options = {}; + const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); + it("Should return default range for given undefined range", (done) => { + const range = uploadTask["parseRange"]([]); + assert.equal(range.minValue, -1); + assert.equal(range.maxValue, -1); + done(); + }); + it("Should return default range for given empty range", (done) => { + const range = uploadTask["parseRange"]([""]); + assert.equal(range.minValue, -1); + assert.equal(range.maxValue, -1); + done(); + }); + it("Should return valid range for given range with from and to values", (done) => { + const range = uploadTask["parseRange"](["100-200"]); + assert.equal(range.minValue, 100); + assert.equal(range.maxValue, 200); + done(); + }); + it("Should return valid range for given range without to value", (done) => { + const range = uploadTask["parseRange"](["0-"]); + assert.equal(range.minValue, 0); + assert.equal(range.maxValue, 99999); + done(); + }); + }); + describe("Update Task Status", () => { + const name = "sample_image.jpg"; + const arrayBuffer = new ArrayBuffer(80000); + const size = 100000; + const fileObj = { + content: arrayBuffer, + name, + size, + }; + const uploadSession = { + url: "test url", + expiry: new Date(), + }; + const options = {}; + const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); + it("Should update status with expiration date and next expected ranges as given", (done) => { + const statusResponse = { + expirationDateTime: "2018-08-06T09:05:45.195Z", + nextExpectedRanges: ["100-2000"], + }; + uploadTask["updateTaskStatus"](statusResponse); + assert.equal(uploadTask["nextRange"].minValue, 100); + assert.equal(uploadTask["nextRange"].maxValue, 2000); + done(); + }); + it("Should update status with given expiration date and (fileSize - 1) for next expected range maxValue", (done) => { + const statusResponse = { + expirationDateTime: "2018-08-06T09:05:45.195Z", + nextExpectedRanges: ["100-"], + }; + uploadTask["updateTaskStatus"](statusResponse); + assert.equal(uploadTask["nextRange"].minValue, 100); + assert.equal(uploadTask["nextRange"].maxValue, 99999); + done(); + }); + }); + describe("GetNextRange", () => { + const name = "sample_image.jpg"; + const arrayBuffer = new ArrayBuffer(80000); + const size = 328680; + const fileObj = { + content: arrayBuffer, + name, + size, + }; + const uploadSession = { + url: "test url", + expiry: new Date(), + }; + const options = { + rangeSize: 327680, + }; + const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); + it("Should return proper next range well within the file size", (done) => { + const nextRange = uploadTask.getNextRange(); + assert.equal(nextRange.minValue, 0); + assert.equal(nextRange.maxValue, 327679); + done(); + }); + it("Should return next range maxValue equal to the file size", (done) => { + const statusResponse = { + expirationDateTime: "2018-08-06T09:05:45.195Z", + nextExpectedRanges: ["327680-"], + }; + uploadTask["updateTaskStatus"](statusResponse); + const nextRange = uploadTask.getNextRange(); + assert.equal(nextRange.minValue, 327680); + assert.equal(nextRange.maxValue, 328679); + done(); + }); + it("Should return next range as default(empty) range, this is for the upload task completed", (done) => { + const statusResponse = { + expirationDateTime: "2018-08-06T09:05:45.195Z", + nextExpectedRanges: [], + }; + uploadTask["updateTaskStatus"](statusResponse); + const nextRange = uploadTask.getNextRange(); + assert.equal(nextRange.minValue, -1); + assert.equal(nextRange.maxValue, -1); + done(); + }); + }); + describe("Upload File", () => { + const name = "sample_image.jpg"; + const arrayBuffer = new ArrayBuffer(80000); + const size = 328680; + const fileObj = { + content: arrayBuffer, + name, + size, + }; + const uploadSession = { + url: "test url", + expiry: new Date(), + }; + const options = { + rangeSize: 327680, + }; + const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); + it("Should return an exception while trying to upload the file upload completed task", (done) => { + const statusResponse = { + expirationDateTime: "2018-08-06T09:05:45.195Z", + nextExpectedRanges: [], + }; + uploadTask["updateTaskStatus"](statusResponse); + uploadTask + .upload() + .then((res) => { + throw new Error("Upload is working for upload completed task"); + }) + .catch((err) => { + assert.equal(err.name, "Invalid Session"); + assert.equal(err.message, "Task with which you are trying to upload is already completed, Please check for your uploaded file"); + done(); + }); + }); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=LargeFileUploadTask.js.map diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map b/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map new file mode 100644 index 000000000..cb89b2ac1 --- /dev/null +++ b/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../common/tasks/LargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,uCAAuC;IACvC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAChC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,CAAC;QACpB,MAAM,OAAO,GAAG;YACf,OAAO,EAAE,WAAW;YACpB,IAAI;YACJ,IAAI;SACJ,CAAC;QACF,MAAM,aAAa,GAAG;YACrB,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,IAAI,IAAI,EAAE;SAClB,CAAC;QACF,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;QACzF,EAAE,CAAC,uDAAuD,EAAE,CAAC,IAAI,EAAE,EAAE;YACpE,MAAM,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,KAAK,CAAC,KAAK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AAM,cAAc,GAAG;gBACtB,kBAAkB,EAAE,0BAA0B;gBAC9C,kBAAkB,EAAE,EAAE;aACtB,CAAC;YACF,UAAU,CAAC,kBAAkB,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/C,UAAU;iBACR,MAAM,EAAE;iBACR,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAChE,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,oGAAoG,CAAC,CAAC;gBAChI,IAAI,EAAE,CAAC;YACR,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js new file mode 100644 index 000000000..ace71a6ed --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js @@ -0,0 +1,40 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { OneDriveLargeFileUploadTask } from "../../../src/tasks/OneDriveLargeFileUploadTask"; +describe("OneDriveLargeFileUploadTask.ts", () => { + describe("constructCreateSessionUrl", () => { + const spaceFileName = " test.png "; + const fileName = "test.png"; + const specialFileName = "test file.png"; + const encodedFileName = "test%20file.png"; + /* tslint:disable: no-string-literal */ + it("Should trim the extra spaces in the filename", () => { + assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](spaceFileName)); + }); + it("Should encode space in the filename", () => { + assert.equal(`/me/drive/root:/${encodedFileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](specialFileName)); + }); + it("Should return url with default root value", () => { + assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName)); + }); + it("Should return url with default root value for an empty path string", () => { + assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "")); + }); + it("Should add / in front of the path", () => { + assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "Documents/")); + }); + it("Should add / in back of the path", () => { + assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "/Documents")); + }); + it("Should trim the extra spaces in the path", () => { + assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, " /Documents/ ")); + }); + /* tslint:enable: no-string-literal */ + }); +}); +//# sourceMappingURL=OneDriveLargeFileUploadTask.js.map diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map new file mode 100644 index 000000000..cd3af19d3 --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLarge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AAE,CAAC,CAAC,CAAC;QAC1I,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC5C,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9J,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC3C,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9J,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YACnD,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;QACjK,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js new file mode 100644 index 000000000..4a7e1ccb0 --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js @@ -0,0 +1,29 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import * as OneDriveLargeFileUploadTaskUtil from "../../../src/tasks/OneDriveLargeFileUploadTaskUtil"; +describe("OneDriveLargeFileUploadTaskUtil", () => { + describe("getValidRangeSize", () => { + it("Should return size in multiple of 320KB for the size not a multiple of 320KB", (done) => { + assert.equal(327680, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(327685)); + done(); + }); + it("Should return same size for the size less than 320 KB", (done) => { + assert.equal(100, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(100)); + done(); + }); + it("Should return size in multiple of 320KB with max range of 60 MB for file size more than 60 MB", (done) => { + assert.equal(62914560, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(104857600)); + done(); + }); + it("Should return size in multiple of 320KB for the size multiple of 320 KB", (done) => { + assert.equal(1638400, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(1638400)); + done(); + }); + }); +}); +//# sourceMappingURL=OneDriveLargeFileUploadTaskUtil.js.map diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map new file mode 100644 index 000000000..64dc5a433 --- /dev/null +++ b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OneDriveLargeFileUploadTaskUtil.js","sourceRoot":"","sources":["../../../../../common/tasks/OneDriveLargeFileUploadTaskUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,KAAK,+BAA+B,MAAM,oDAAoD,CAAC;AAEtG,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,8EAA8E,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3F,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;YAChF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uDAAuD,EAAE,CAAC,IAAI,EAAE,EAAE;YACpE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1E,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,+FAA+F,EAAE,CAAC,IAAI,EAAE,EAAE;YAC5G,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;YACrF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,yEAAyE,EAAE,CAAC,IAAI,EAAE,EAAE;YACtF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;YAClF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/PageIterator.d.ts b/test/dist/es/test/common/tasks/PageIterator.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/common/tasks/PageIterator.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/common/tasks/PageIterator.js b/test/dist/es/test/common/tasks/PageIterator.js new file mode 100644 index 000000000..ce9114e85 --- /dev/null +++ b/test/dist/es/test/common/tasks/PageIterator.js @@ -0,0 +1,146 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import { PageIterator } from "../../../src/tasks/PageIterator"; +import { getClient } from "../test-helper"; +const client = getClient(); +const value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +const getPageCollection = () => { + return { + value: [...value], + additionalContent: "additional content", + }; +}; +const getPageCollectionWithNext = () => { + return { + value: [...value], + "@odata.nextLink": "nextURL", + additionalContent: "additional content", + }; +}; +const getEmptyPageCollection = () => { + return { + value: [], + }; +}; +const getEmptyPageCollectionWithNext = () => { + return { + value: [], + "@odata.nextLink": "nextURL", + }; +}; +const truthyCallback = (data) => { + return true; +}; +let halfWayCallbackCounter = 5; +const halfWayCallback = (data) => { + halfWayCallbackCounter--; + if (halfWayCallbackCounter === 0) { + return false; + } else { + return true; + } +}; +describe("PageIterator.ts", () => { + describe("Constructor", () => { + it("Should create instance without nextLink", () => { + const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); + assert(pageIterator instanceof PageIterator); + }); + it("Should create instance with nextLink", () => { + const pageIterator = new PageIterator(client, getPageCollectionWithNext(), truthyCallback); + assert(pageIterator instanceof PageIterator); + }); + }); + describe("iterate", () => { + it("Should iterate over a complete collection without nextLink", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); + try { + yield pageIterator.iterate(); + assert.isTrue(pageIterator.isComplete()); + } catch (error) { + throw error; + } + })); + it("Should not iterate over an empty collection", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getEmptyPageCollection(), truthyCallback); + halfWayCallbackCounter = 1; + try { + yield pageIterator.iterate(); + assert.equal(halfWayCallbackCounter, 1); + } catch (error) { + throw error; + } + })); + it("Should break in the middle way", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); + halfWayCallbackCounter = 5; + try { + yield pageIterator.iterate(); + assert.isFalse(pageIterator.isComplete()); + } catch (error) { + throw error; + } + })); + }); + /* tslint:disable: no-string-literal */ + describe("iterationHelper", () => { + it("Should return true for empty collection with next link", () => { + const pageIterator = new PageIterator(client, getEmptyPageCollectionWithNext(), truthyCallback); + try { + const advance = pageIterator["iterationHelper"](); + assert.isTrue(advance); + } catch (error) { + throw error; + } + }); + }); + describe("resume", () => { + it("Should start from the place where it left the iteration", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); + halfWayCallbackCounter = 5; + try { + yield pageIterator.iterate(); + assert.isFalse(pageIterator.isComplete()); + yield pageIterator.resume(); + assert.isTrue(pageIterator.isComplete()); + } catch (error) { + throw error; + } + })); + }); + describe("isComplete", () => { + it("Should return false for incomplete iteration", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); + halfWayCallbackCounter = 5; + try { + yield pageIterator.iterate(); + assert.isFalse(pageIterator.isComplete()); + } catch (error) { + throw error; + } + })); + it("Should return true for complete iteration", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); + try { + yield pageIterator.iterate(); + assert.isTrue(pageIterator.isComplete()); + } catch (error) { + throw error; + } + })); + }); + /* tslint:enable: no-string-literal */ +}); +//# sourceMappingURL=PageIterator.js.map diff --git a/test/dist/es/test/common/tasks/PageIterator.js.map b/test/dist/es/test/common/tasks/PageIterator.js.map new file mode 100644 index 000000000..3788d26ae --- /dev/null +++ b/test/dist/es/test/common/tasks/PageIterator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PageIterator.js","sourceRoot":"","sources":["../../../../../common/tasks/PageIterator.ts"],"names":[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CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC1C,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC5B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,8CAA8C,EAAE,GAAS,EAAE;YAC7D,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,eAAe,CAAC,CAAC;YACpF,sBAAsB,GAAG,CAAC,CAAC;YAC3B,IAAI;gBACH,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC7B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;aAC1C;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAS,EAAE;YAC1D,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,cAAc,CAAC,CAAC;YACnF,IAAI;gBACH,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/test-helper.d.ts b/test/dist/es/test/common/test-helper.d.ts new file mode 100644 index 000000000..386620072 --- /dev/null +++ b/test/dist/es/test/common/test-helper.d.ts @@ -0,0 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; +import { Client } from "../../src/index"; +export declare function getClient(): Client; +export declare function randomString(): string; diff --git a/test/dist/es/test/common/test-helper.js b/test/dist/es/test/common/test-helper.js new file mode 100644 index 000000000..9aef28974 --- /dev/null +++ b/test/dist/es/test/common/test-helper.js @@ -0,0 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; +import { Client } from "../../src/index"; +import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; +export function getClient() { + return Client.initWithMiddleware({ + authProvider: new DummyAuthenticationProvider(), + }); +} +export function randomString() { + return Math.random() + .toString(36) + .substring(7); +} +//# sourceMappingURL=test-helper.js.map diff --git a/test/dist/es/test/common/test-helper.js.map b/test/dist/es/test/common/test-helper.js.map new file mode 100644 index 000000000..b59cfca4a --- /dev/null +++ b/test/dist/es/test/common/test-helper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../../common/test-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,UAAU,SAAS;IACxB,OAAO,MAAM,CAAC,kBAAkB,CAAC;QAChC,YAAY,EAAE,IAAI,2BAA2B,EAAE;KAC/C,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC3B,OAAO,IAAI,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,EAAE,CAAC;SACZ,SAAS,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/node/content/BatchRequestContent.d.ts b/test/dist/es/test/node/content/BatchRequestContent.d.ts new file mode 100644 index 000000000..ac7981909 --- /dev/null +++ b/test/dist/es/test/node/content/BatchRequestContent.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; diff --git a/test/dist/es/test/node/content/BatchRequestContent.js b/test/dist/es/test/node/content/BatchRequestContent.js new file mode 100644 index 000000000..7eb34e72c --- /dev/null +++ b/test/dist/es/test/node/content/BatchRequestContent.js @@ -0,0 +1,601 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import * as tslib_1 from "tslib"; +import { assert } from "chai"; +import * as fs from "fs"; +import "isomorphic-fetch"; +import { BatchRequestContent } from "../../../src/content/BatchRequestContent"; +import { randomString } from "../../test-helper"; +const folderName = randomString(); +const folderDetails = { + name: folderName, + folder: {}, +}; +const createFolderRequest = new Request("/me/drive/root/children", { + method: "POST", + headers: { + "Content-type": "application/json", + }, + body: JSON.stringify(folderDetails), +}); +const getCreateFolderRequestCopy = () => { + return { + id: "1", + request: createFolderRequest, + }; +}; +const getCreateFolderRequestWithDependsOnCopy = () => { + const data = { + id: "1", + request: createFolderRequest, + dependsOn: undefined, + }; + data.dependsOn = []; + return data; +}; +describe("BatchRequestContent.ts", () => { + describe("Create", function() { + this.timeout(20 * 1000); + it("Should Create BatchRequestContent instance with no requests", (done) => { + const batchReq = new BatchRequestContent(); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + it("Should create BatchRequestContent instance with empty array", (done) => { + const batchReq = new BatchRequestContent([]); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + it("Should create BatchRequestContent instance with requests", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + const createFolderDuplicate2 = getCreateFolderRequestCopy(); + createFolderDuplicate2.id = "2"; + const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); + assert.equal(batchReq.requests.size, 2); + done(); + }); + it("Should throw error for empty request id", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + createFolderDuplicate1.id = ""; + try { + const batchReq = new BatchRequestContent([createFolderDuplicate1]); + throw new Error("Something wrong with the empty id check"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + } + done(); + }); + it("Should return error incase of number of requests limit exceeding", (done) => { + const requests = []; + for (let i = 0; i < 25; i++) { + const req = getCreateFolderRequestCopy(); + req.id = "" + i; + requests.push(req); + } + try { + const batchReq = new BatchRequestContent(requests); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + }); + describe("addRequest", function() { + this.timeout(20 * 1000); + it("Should emit size exceed error", (done) => { + const requests = []; + for (let i = 0; i < 20; i++) { + const r = getCreateFolderRequestCopy(); + r.id = "" + i; + requests.push(r); + } + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(requests); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + it("Should add Request JSON to the BatchRequestContent instance", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(); + const id = batchReq.addRequest(req); + assert.equal(req.id, id); + done(); + }); + it("Should throw duplicate id error", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addRequest(req2); + throw new Error("Something wrong with duplicate id validation"); + } catch (error) { + assert.equal(error.name, "Duplicate RequestId Error"); + done(); + } + }); + it("Should throw duplicate id error", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = ""; + const batchReq = new BatchRequestContent(); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with empty id validation"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + done(); + } + }); + }); + describe("removeRequest", () => { + it("Should delete the request present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, batchReq.removeRequest(req.id)); + done(); + }); + it("Should return false for the request that is not present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(false, batchReq.removeRequest("1000")); + done(); + }); + it("Should remove dependencies in case dependencies present", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + const req4 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + batchReq.addDependency("2", "1"); + batchReq.addDependency("3", "2"); + batchReq.addDependency("4", "1"); + batchReq.addDependency("4", "2"); + batchReq.addDependency("4", "3"); + batchReq.removeRequest("2"); + assert.isUndefined(batchReq.requests.get("1").dependsOn); + assert.isUndefined(batchReq.requests.get("3").dependsOn); + assert.equal(batchReq.requests.get("4").dependsOn.length, 2); + done(); + }); + }); + describe("addDependency", function() { + this.timeout(20 * 1000); + it("Should return error for request with dependent id not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1"); + throw new Error("Dependent validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency Addition"); + done(); + } + }); + it("Should return error for the request with given dependency id is not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1", "100"); + throw new Error("Dependency validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency"); + done(); + } + }); + it("Should add dependency for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2", "1"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("2", "3"); + assert.equal(batchReq.requests.get("2").dependsOn.length, 2); + done(); + }); + it("Should return error for adding duplicate dependency", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2", "1"); + try { + batchReq.addDependency("2", "1"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + it("Should add dependency for dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("3"); + assert.isDefined(batchReq.requests.get("3").dependsOn); + done(); + }); + it("Should return error for adding duplicate dependency when dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + try { + batchReq.addDependency("2"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addDependency("1"); + } catch (e) { + assert.equal(e.name, "Invalid Dependency Addition"); + done(); + } + }); + }); + describe("getContent", () => { + it("Should return error for empty requests", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const batchReq = new BatchRequestContent(); + try { + const content = yield batchReq.getContent(); + throw new Error("Something wrong with the empty requests validation"); + } catch (error) { + assert.equal(error.name, "Empty Payload"); + } + })); + it("Should return json content", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + const content = yield batchReq.getContent(); + assert.isDefined(content.requests[0].body); + assert.equal(typeof content.requests[0].body, "object"); + } catch (error) { + throw error; + } + })); + it("Should return image's base64 string", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const fileName = "sample_image.jpg"; + fs.readFile(`./spec/sample_files/${fileName}`, {}, (err, file) => + tslib_1.__awaiter(this, void 0, void 0, function*() { + if (err) { + throw err; + } + const uploadOneDriveFile = { + id: "1", + request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { + method: "PUT", + headers: { + "Content-type": "image/jpg", + }, + body: file, + }), + }; + const batchReq = new BatchRequestContent([uploadOneDriveFile]); + try { + const content = yield batchReq.getContent(); + assert.isDefined(content.requests[0].body); + } catch (error) { + throw error; + } + }), + ); + })); + it("Should throw error for request does not have content-type header if it does have a body", () => + tslib_1.__awaiter(this, void 0, void 0, function*() { + const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { + method: "POST", + body: JSON.stringify(folderDetails), + }); + const batchReq = new BatchRequestContent([ + { + id: "1", + request: createFolderReqWithoutHeader, + }, + ]); + try { + const content = yield batchReq.getContent(); + throw new Error("Something wrong with the header checking"); + } catch (error) { + assert.equal(error.name, "Invalid Content-type header"); + } + })); + }); + describe("removeDependency", function() { + this.timeout(20 * 1000); + it("Should return false for dependent not present", (done) => { + const batchReq = new BatchRequestContent(); + assert.equal(false, batchReq.removeDependency("1")); + done(); + }); + it("Should return false for dependency array not present in the request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(false, batchReq.removeDependency("2")); + done(); + }); + it("Should return false for given dependency id is not present in the dependent request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(false, batchReq.removeDependency("2", "5")); + done(); + }); + it("Should delete the given dependency and dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(true, batchReq.removeDependency("2", "1")); + done(); + }); + it("Should delete all dependencies for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("3", "1"); + batchReq.addDependency("3", "2"); + assert.equal(true, batchReq.removeDependency("3")); + done(); + }); + }); + describe("validateDependencies", () => { + /* tslint:disable: no-string-literal */ + it("Should throw error for empty request object", (done) => { + try { + BatchRequestContent["validateDependencies"](new Map()); + throw new Error("Something wrong with the empty requests check"); + } catch (error) { + assert.equal(error.name, "Empty Requests Error"); + done(); + } + }); + it("isParallel - Should validate for single request", () => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for multiple requests", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for requests with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isParallel - Should validate for requests with empty dependsOn array", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for first request having dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = undefined; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for a request does not depend on anything", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for a request does not depend on previous request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["4"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should not validate for requests having more than one dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["2", "3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSerial - Should validate for proper serial dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for first request having dependency on itself", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["1"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for first request having dependency on non existing request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["10"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["10"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["10"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should validate for requests dependsOn some middle order request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request with empty dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["2"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + /* tslint:enable: no-string-literal */ + }); +}); +//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/test/node/content/BatchRequestContent.js.map b/test/dist/es/test/node/content/BatchRequestContent.js.map new file mode 100644 index 000000000..f85143eeb --- /dev/null +++ b/test/dist/es/test/node/content/BatchRequestContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchRequestContent.js","sourceRoot":"","sources":["../../../../../node/content/BatchRequestContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAE1B,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,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uHAAuH,EAAE,GAAG,EAAE;YAChI,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/node/content/BatchResponseContent.d.ts b/test/dist/es/test/node/content/BatchResponseContent.d.ts new file mode 100644 index 000000000..6596c6394 --- /dev/null +++ b/test/dist/es/test/node/content/BatchResponseContent.d.ts @@ -0,0 +1,7 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +export {}; diff --git a/test/dist/es/test/node/content/BatchResponseContent.js b/test/dist/es/test/node/content/BatchResponseContent.js new file mode 100644 index 000000000..78f9dc62f --- /dev/null +++ b/test/dist/es/test/node/content/BatchResponseContent.js @@ -0,0 +1,114 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import { assert } from "chai"; +import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; +const redirect = { + id: "1", + status: 302, + headers: { + location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", + }, +}; +const forbidden = { + id: "3", + status: 401, + body: { + error: { + code: "Forbidden", + message: "...", + }, + }, +}; +const okWithBody = { + id: "2", + status: 200, + body: { + "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", + value: [], + }, +}; +const okWithoutBody = { + id: "4", + status: 204, + body: null, +}; +describe("BatchResponseContent.ts", () => { + describe("update", function() { + this.timeout(20 * 1000); + it("Should update instance with nextLink responses", (done) => { + const responses = [redirect, forbidden]; + const batchRes = new BatchResponseContent({ + responses, + "@odata.nextLink": "dummy nextlink", + }); + batchRes.update({ + responses: [okWithoutBody, okWithBody], + }); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + describe("createResponseObject", function() { + this.timeout(20 * 1000); + it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + assert.isDefined(batchRes.getResponseById("1")); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("3")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + describe("getResponseById", function() { + this.timeout(20 * 1000); + it("Should return response object for given id", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponseById("1")); + done(); + }); + it("Should return undefined for given id for which the response is not present", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isUndefined(batchRes.getResponseById("100")); + done(); + }); + }); + describe("getResponses", function() { + this.timeout(20 * 1000); + it("Should return responses map", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponses()); + done(); + }); + }); + describe("getResponsesIterator", function() { + this.timeout(20 * 1000); + it("Should return iterator", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + let count = 0; + const iterator = batchRes.getResponsesIterator(); + let data = iterator.next(); + while (!data.done) { + data = iterator.next(); + count++; + } + assert.equal(count, 4); + done(); + }); + }); +}); +//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/test/node/content/BatchResponseContent.js.map b/test/dist/es/test/node/content/BatchResponseContent.js.map new file mode 100644 index 000000000..cdeeabe03 --- /dev/null +++ b/test/dist/es/test/node/content/BatchResponseContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../node/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,QAAQ,GAAG;IAChB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,OAAO,EAAE;QACR,QAAQ,EAAE,uEAAuE;KACjF;CACD,CAAC;AACF,MAAM,SAAS,GAAG;IACjB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,KAAK,EAAE;YACN,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,KAAK;SACd;KACD;CACD,CAAC;AACF,MAAM,UAAU,GAAG;IAClB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,gBAAgB,EAAE,oFAAoF;QACtG,KAAK,EAAE,EAAE;KACT;CACD,CAAC;AACF,MAAM,aAAa,GAAG;IACrB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,IAAI;CACV,CAAC;AAEF,QAAQ,CAAC,yBAAyB,EAAE,GAAG,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AC,EAAE,GAAG,IAAI,CAAC,CAAC;QAExB,EAAE,CAAC,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;YACrC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACzC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC;aAC3D,CAAC,CAAC;YACH,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,QAAQ,GAAG,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YACjD,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBAClB,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACvB,KAAK,EAAE,CAAC;aACR;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/test-helper.d.ts b/test/dist/es/test/test-helper.d.ts new file mode 100644 index 000000000..060efc0a1 --- /dev/null +++ b/test/dist/es/test/test-helper.d.ts @@ -0,0 +1,10 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; +import { Client } from "../src/index"; +export declare function getClient(): Client; +export declare function randomString(): string; diff --git a/test/dist/es/test/test-helper.js b/test/dist/es/test/test-helper.js new file mode 100644 index 000000000..b1b7a6c35 --- /dev/null +++ b/test/dist/es/test/test-helper.js @@ -0,0 +1,20 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +import "isomorphic-fetch"; +import { Client } from "../src/index"; +import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; +export function getClient() { + return Client.initWithMiddleware({ + authProvider: new DummyAuthenticationProvider(), + }); +} +export function randomString() { + return Math.random() + .toString(36) + .substring(7); +} +//# sourceMappingURL=test-helper.js.map diff --git a/test/dist/es/test/test-helper.js.map b/test/dist/es/test/test-helper.js.map new file mode 100644 index 000000000..7c40ce956 --- /dev/null +++ b/test/dist/es/test/test-helper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../test-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,UAAU,SAAS;IACxB,OAAO,MAAM,CAAC,kBAAkB,CAAC;QAChC,YAAY,EAAE,IAAI,2BAA2B,EAAE;KAC/C,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC3B,OAAO,IAAI,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,EAAE,CAAC;SACZ,SAAS,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/test/node/content/BatchRequestContent.ts b/test/node/content/BatchRequestContent.ts new file mode 100644 index 000000000..ca090faf7 --- /dev/null +++ b/test/node/content/BatchRequestContent.ts @@ -0,0 +1,650 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert } from "chai"; +import * as fs from "fs"; +import "isomorphic-fetch"; + +import { BatchRequestContent, BatchRequestStep } from "../../../src/content/BatchRequestContent"; +import { randomString } from "../../test-helper"; + +const folderName = randomString(); +const folderDetails = { + name: folderName, + folder: {}, +}; + +const createFolderRequest = new Request("/me/drive/root/children", { + method: "POST", + headers: { + "Content-type": "application/json", + }, + body: JSON.stringify(folderDetails), +}); + +const getCreateFolderRequestCopy = () => { + return { + id: "1", + request: createFolderRequest, + }; +}; + +const getCreateFolderRequestWithDependsOnCopy = () => { + const data = { + id: "1", + request: createFolderRequest, + dependsOn: undefined, + }; + data.dependsOn = []; + return data; +}; + +describe("BatchRequestContent.ts", () => { + describe("Create", function() { + this.timeout(20 * 1000); + it("Should Create BatchRequestContent instance with no requests", (done) => { + const batchReq = new BatchRequestContent(); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + + it("Should create BatchRequestContent instance with empty array", (done) => { + const batchReq = new BatchRequestContent([]); + assert(batchReq instanceof BatchRequestContent); + done(); + }); + + it("Should create BatchRequestContent instance with requests", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + const createFolderDuplicate2 = getCreateFolderRequestCopy(); + createFolderDuplicate2.id = "2"; + const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); + assert.equal(batchReq.requests.size, 2); + done(); + }); + + it("Should throw error for empty request id", (done) => { + const createFolderDuplicate1 = getCreateFolderRequestCopy(); + createFolderDuplicate1.id = ""; + try { + const batchReq = new BatchRequestContent([createFolderDuplicate1]); + throw new Error("Something wrong with the empty id check"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + } + done(); + }); + + it("Should return error incase of number of requests limit exceeding", (done) => { + const requests = []; + for (let i = 0; i < 25; i++) { + const req = getCreateFolderRequestCopy(); + req.id = "" + i; + requests.push(req); + } + try { + const batchReq = new BatchRequestContent(requests); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + }); + + describe("addRequest", function() { + this.timeout(20 * 1000); + it("Should emit size exceed error", (done) => { + const requests = []; + for (let i = 0; i < 20; i++) { + const r = getCreateFolderRequestCopy(); + r.id = "" + i; + requests.push(r); + } + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(requests); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with the limiting requests"); + } catch (error) { + assert.equal(error.name, "Limit Exceeded Error"); + done(); + } + }); + + it("Should add Request JSON to the BatchRequestContent instance", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = "100"; + const batchReq = new BatchRequestContent(); + const id = batchReq.addRequest(req); + assert.equal(req.id, id); + done(); + }); + + it("Should throw duplicate id error", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addRequest(req2); + throw new Error("Something wrong with duplicate id validation"); + } catch (error) { + assert.equal(error.name, "Duplicate RequestId Error"); + done(); + } + }); + + it("Should throw duplicate id error", (done) => { + const req = getCreateFolderRequestCopy(); + req.id = ""; + const batchReq = new BatchRequestContent(); + try { + batchReq.addRequest(req); + throw new Error("Something wrong with empty id validation"); + } catch (error) { + assert.equal(error.name, "Empty Id For Request"); + done(); + } + }); + }); + + describe("removeRequest", () => { + it("Should delete the request present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, batchReq.removeRequest(req.id)); + done(); + }); + + it("Should return false for the request that is not present in the batch", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(false, batchReq.removeRequest("1000")); + done(); + }); + + it("Should remove dependencies in case dependencies present", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + const req4 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + batchReq.addDependency("2", "1"); + batchReq.addDependency("3", "2"); + batchReq.addDependency("4", "1"); + batchReq.addDependency("4", "2"); + batchReq.addDependency("4", "3"); + batchReq.removeRequest("2"); + + assert.isUndefined(batchReq.requests.get("1").dependsOn); + assert.isUndefined(batchReq.requests.get("3").dependsOn); + assert.equal(batchReq.requests.get("4").dependsOn.length, 2); + done(); + }); + }); + + describe("addDependency", function() { + this.timeout(20 * 1000); + it("Should return error for request with dependent id not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1"); + throw new Error("Dependent validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency Addition"); + done(); + } + }); + + it("Should return error for the request with given dependency id is not present", (done) => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + batchReq.addDependency("1", "100"); + throw new Error("Dependency validation is failing"); + } catch (err) { + assert.equal(err.name, "Invalid Dependency"); + done(); + } + }); + + it("Should add dependency for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2", "1"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("2", "3"); + assert.equal(batchReq.requests.get("2").dependsOn.length, 2); + done(); + }); + + it("Should return error for adding duplicate dependency", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2", "1"); + try { + batchReq.addDependency("2", "1"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + + it("Should add dependency for dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + batchReq.addDependency("3"); + assert.isDefined(batchReq.requests.get("3").dependsOn); + done(); + }); + + it("Should return error for adding duplicate dependency when dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.isDefined(batchReq.requests.get("2").dependsOn); + try { + batchReq.addDependency("2"); + } catch (e) { + assert.equal(e.name, "Duplicate Dependency"); + done(); + } + }); + + it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const batchReq = new BatchRequestContent([req1]); + try { + batchReq.addDependency("1"); + } catch (e) { + assert.equal(e.name, "Invalid Dependency Addition"); + done(); + } + }); + }); + + describe("getContent", () => { + it("Should return error for empty requests", async () => { + const batchReq = new BatchRequestContent(); + try { + const content = await batchReq.getContent(); + throw new Error("Something wrong with the empty requests validation"); + } catch (error) { + assert.equal(error.name, "Empty Payload"); + } + }); + + it("Should return json content", async () => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + try { + const content = await batchReq.getContent(); + assert.isDefined(content.requests[0].body); + assert.equal(typeof content.requests[0].body, "object"); + } catch (error) { + throw error; + } + }); + + it("Should return image's base64 string", async () => { + const fileName = "sample_image.jpg"; + fs.readFile(`./spec/sample_files/${fileName}`, {}, async (err, file) => { + if (err) { + throw err; + } + const uploadOneDriveFile = { + id: "1", + request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { + method: "PUT", + headers: { + "Content-type": "image/jpg", + }, + body: file, + }), + }; + const batchReq = new BatchRequestContent([uploadOneDriveFile]); + try { + const content = await batchReq.getContent(); + assert.isDefined(content.requests[0].body); + } catch (error) { + throw error; + } + }); + }); + + it("Should throw error for request does not have content-type header if it does have a body", async () => { + const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { + method: "POST", + body: JSON.stringify(folderDetails), + }); + + const batchReq = new BatchRequestContent([ + { + id: "1", + request: createFolderReqWithoutHeader, + }, + ]); + try { + const content = await batchReq.getContent(); + throw new Error("Something wrong with the header checking"); + } catch (error) { + assert.equal(error.name, "Invalid Content-type header"); + } + }); + }); + + describe("removeDependency", function() { + this.timeout(20 * 1000); + + it("Should return false for dependent not present", (done) => { + const batchReq = new BatchRequestContent(); + assert.equal(false, batchReq.removeDependency("1")); + done(); + }); + + it("Should return false for dependency array not present in the request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(false, batchReq.removeDependency("2")); + done(); + }); + + it("Should return false for given dependency id is not present in the dependent request", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(false, batchReq.removeDependency("2", "5")); + done(); + }); + + it("Should delete the given dependency and dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + batchReq.addDependency("2"); + assert.equal(true, batchReq.removeDependency("2", "1")); + done(); + }); + + it("Should delete all dependencies for a given dependent", (done) => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + const req3 = getCreateFolderRequestCopy(); + req1.id = "1"; + req2.id = "2"; + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + batchReq.addDependency("3", "1"); + batchReq.addDependency("3", "2"); + assert.equal(true, batchReq.removeDependency("3")); + done(); + }); + }); + + describe("validateDependencies", () => { + /* tslint:disable: no-string-literal */ + it("Should throw error for empty request object", (done) => { + try { + BatchRequestContent["validateDependencies"](new Map() as Map); + throw new Error("Something wrong with the empty requests check"); + } catch (error) { + assert.equal(error.name, "Empty Requests Error"); + done(); + } + }); + + it("isParallel - Should validate for single request", () => { + const req = getCreateFolderRequestCopy(); + const batchReq = new BatchRequestContent([req]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isParallel - Should validate for multiple requests", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isParallel - Should validate for requests with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isParallel - Should validate for requests with empty dependsOn array", () => { + const req1 = getCreateFolderRequestCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should not validate for first request having dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = undefined; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should not validate for a request does not depend on anything", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should not validate for a request does not depend on previous request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["4"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should not validate for requests having more than one dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["2", "3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSerial - Should validate for proper serial dependencies", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const req4 = getCreateFolderRequestWithDependsOnCopy(); + req4.id = "4"; + req4.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3, req4]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should validate for first request with undefined dependsOn", () => { + const req1 = getCreateFolderRequestCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should validate for first request with empty dependsOn array", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.id = "1"; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should not validate for first request having dependency on itself", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["1"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["1"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should not validate for first request having dependency on non existing request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["10"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["10"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["10"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should validate for requests dependsOn some middle order request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should not validate for middle order request with empty dependsOn", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["1"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + req2.dependsOn = ["2"]; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["2"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + + it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { + const req1 = getCreateFolderRequestWithDependsOnCopy(); + req1.dependsOn = ["2"]; + const req2 = getCreateFolderRequestWithDependsOnCopy(); + req2.id = "2"; + const req3 = getCreateFolderRequestWithDependsOnCopy(); + req3.id = "3"; + req3.dependsOn = ["3"]; + const batchReq = new BatchRequestContent([req1, req2, req3]); + assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); + }); + /* tslint:enable: no-string-literal */ + }); +}); diff --git a/test/node/content/BatchResponseContent.ts b/test/node/content/BatchResponseContent.ts new file mode 100644 index 000000000..fbb88504e --- /dev/null +++ b/test/node/content/BatchResponseContent.ts @@ -0,0 +1,127 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +import { assert } from "chai"; + +import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; + +const redirect = { + id: "1", + status: 302, + headers: { + location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", + }, +}; +const forbidden = { + id: "3", + status: 401, + body: { + error: { + code: "Forbidden", + message: "...", + }, + }, +}; +const okWithBody = { + id: "2", + status: 200, + body: { + "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", + value: [], + }, +}; +const okWithoutBody = { + id: "4", + status: 204, + body: null, +}; + +describe("BatchResponseContent.ts", () => { + describe("update", function() { + this.timeout(20 * 1000); + + it("Should update instance with nextLink responses", (done) => { + const responses = [redirect, forbidden]; + const batchRes = new BatchResponseContent({ + responses, + "@odata.nextLink": "dummy nextlink", + }); + batchRes.update({ + responses: [okWithoutBody, okWithBody], + }); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + + describe("createResponseObject", function() { + this.timeout(20 * 1000); + + it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + assert.isDefined(batchRes.getResponseById("1")); + assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("3")); + assert.isDefined(batchRes.getResponseById("4")); + done(); + }); + }); + + describe("getResponseById", function() { + this.timeout(20 * 1000); + + it("Should return response object for given id", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponseById("1")); + done(); + }); + + it("Should return undefined for given id for which the response is not present", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isUndefined(batchRes.getResponseById("100")); + done(); + }); + }); + + describe("getResponses", function() { + this.timeout(20 * 1000); + + it("Should return responses map", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect], + }); + assert.isDefined(batchRes.getResponses()); + done(); + }); + }); + + describe("getResponsesIterator", function() { + this.timeout(20 * 1000); + + it("Should return iterator", (done) => { + const batchRes = new BatchResponseContent({ + responses: [redirect, forbidden, okWithBody, okWithoutBody], + }); + let count = 0; + const iterator = batchRes.getResponsesIterator(); + let data = iterator.next(); + while (!data.done) { + data = iterator.next(); + count++; + } + assert.equal(count, 4); + done(); + }); + }); +}); diff --git a/spec/sample_files/empty-spreadsheet.xlsx b/test/sample_files/empty-spreadsheet.xlsx similarity index 100% rename from spec/sample_files/empty-spreadsheet.xlsx rename to test/sample_files/empty-spreadsheet.xlsx diff --git a/spec/sample_files/onenotepage.html b/test/sample_files/onenotepage.html similarity index 100% rename from spec/sample_files/onenotepage.html rename to test/sample_files/onenotepage.html diff --git a/spec/sample_files/onenotepage_fileattachment.html b/test/sample_files/onenotepage_fileattachment.html similarity index 100% rename from spec/sample_files/onenotepage_fileattachment.html rename to test/sample_files/onenotepage_fileattachment.html diff --git a/spec/sample_files/sample_image.jpg b/test/sample_files/sample_image.jpg similarity index 100% rename from spec/sample_files/sample_image.jpg rename to test/sample_files/sample_image.jpg diff --git a/spec/test-helper.ts b/test/test-helper.ts similarity index 100% rename from spec/test-helper.ts rename to test/test-helper.ts diff --git a/test/tsconfig-test-cjs.json b/test/tsconfig-test-cjs.json new file mode 100644 index 000000000..a1f5fa6ab --- /dev/null +++ b/test/tsconfig-test-cjs.json @@ -0,0 +1,11 @@ +{ + "extends": "./../tsconfig-base.json", + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["dom", "esnext"], + "outDir": "lib/es" + }, + "include": ["test/"], + "exclude": ["test/development"] +} diff --git a/test/tsconfig-test-es.json b/test/tsconfig-test-es.json new file mode 100644 index 000000000..e208d8261 --- /dev/null +++ b/test/tsconfig-test-es.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "module": "es6", + "target": "es6", + "lib": ["dom", "esnext"], + "outDir": "dist/es" + }, + "include": ["common", "node", "browser"] +} diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json index 3cc1c3494..940d4d977 100644 --- a/tsconfig-cjs.json +++ b/tsconfig-cjs.json @@ -6,6 +6,6 @@ "lib": ["dom", "esnext"], "outDir": "lib" }, - "exclude": ["node_modules", "lib", "samples", "spec/development"], - "include": ["./src/**/*.ts", "./spec/**/*.ts"] + "exclude": ["node_modules", "lib", "samples", "test/"], + "include": ["./src/**/*.ts"] } diff --git a/tsconfig-es.json b/tsconfig-es.json index 9cdbc0114..49e0ef498 100644 --- a/tsconfig-es.json +++ b/tsconfig-es.json @@ -6,6 +6,6 @@ "lib": ["dom", "esnext"], "outDir": "lib/es" }, - "exclude": ["node_modules", "lib", "samples", "spec/development"], - "include": ["./src/**/*.ts"] + "exclude": ["node_modules", "lib", "samples", "test/development"], + "include": ["./src/**/*.ts", "../test"] } diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 8933d0153..000000000 --- a/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig-base.json", - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": ["dom", "esnext"], - "outDir": "lib/es" - }, - "exclude": ["node_modules", "lib", "samples", "spec/development"], - "include": ["./src/**/*.ts", "./spec/**/*.ts"] -} From 86d3bff2149da24163a774c1fc0f91a293bcf1ff Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Tue, 29 Dec 2020 16:20:55 -0800 Subject: [PATCH 04/10] sorting the graph responsehandler tests --- .gitignore | 4 +- .huskyrc | 2 +- karma.conf.js | 24 +- package-lock.json | 37 +- package.json | 194 +-- src/GraphResponseHandler.ts | 4 + src/content/BatchRequestContent.ts | 4 +- test/{common => }/DummyHTTPMessageHandler.ts | 4 +- test/{common => }/DummyHandlerOptions.ts | 2 +- test/browser/core/GraphResponseHandler.ts | 125 +- test/common/DummyAuthenticationProvider.ts | 30 - test/common/content/BatchRequestContent.ts | 67 +- test/common/{ => content}/package-lock.json | 0 test/common/core/Client.ts | 8 +- test/common/core/GraphRequestUtil.ts | 2 +- test/common/core/GraphResponseHandler.ts | 24 +- test/common/core/HTTPClient.ts | 4 +- test/common/core/HTTPClientFactory.ts | 4 +- test/common/core/urlGeneration.ts | 2 +- test/common/core/urlParsing.ts | 2 +- .../middleware/AuthenticationHandler.ts | 2 +- .../AuthenticationHandlerOptions.ts | 2 +- test/common/middleware/ChaosHandler.ts | 2 +- test/common/middleware/MiddlewareControl.ts | 2 +- test/common/middleware/RedirectHandler.ts | 2 +- .../middleware/RedirectHandlerOptions.ts | 4 +- test/common/middleware/RetryHandler.ts | 2 +- test/common/middleware/RetryHandlerOptions.ts | 12 +- test/common/middleware/TelemetryHandler.ts | 2 +- test/common/package.json | 19 - test/common/tasks/LargeFileUploadTask.ts | 4 +- test/common/tasks/PageIterator.ts | 2 +- test/common/test-helper.ts | 24 - test/dist/es/src/Client.d.ts | 51 - test/dist/es/src/Client.js | 101 -- test/dist/es/src/Client.js.map | 1 - test/dist/es/src/Constants.d.ts | 19 - test/dist/es/src/Constants.js | 20 - test/dist/es/src/Constants.js.map | 1 - .../es/src/CustomAuthenticationProvider.d.ts | 38 - .../es/src/CustomAuthenticationProvider.js | 44 - .../src/CustomAuthenticationProvider.js.map | 1 - test/dist/es/src/GraphError.d.ts | 51 - test/dist/es/src/GraphError.js | 35 - test/dist/es/src/GraphError.js.map | 1 - test/dist/es/src/GraphErrorHandler.d.ts | 59 - test/dist/es/src/GraphErrorHandler.js | 98 -- test/dist/es/src/GraphErrorHandler.js.map | 1 - test/dist/es/src/GraphRequest.d.ts | 378 ------ test/dist/es/src/GraphRequest.js | 716 ----------- test/dist/es/src/GraphRequest.js.map | 1 - test/dist/es/src/GraphRequestUtil.d.ts | 32 - test/dist/es/src/GraphRequestUtil.js | 56 - test/dist/es/src/GraphRequestUtil.js.map | 1 - test/dist/es/src/GraphResponseHandler.d.ts | 61 - test/dist/es/src/GraphResponseHandler.js | 188 --- test/dist/es/src/GraphResponseHandler.js.map | 1 - test/dist/es/src/HTTPClient.d.ts | 54 - test/dist/es/src/HTTPClient.js | 82 -- test/dist/es/src/HTTPClient.js.map | 1 - test/dist/es/src/HTTPClientFactory.d.ts | 40 - test/dist/es/src/HTTPClientFactory.js | 72 -- test/dist/es/src/HTTPClientFactory.js.map | 1 - test/dist/es/src/IAuthProvider.d.ts | 13 - test/dist/es/src/IAuthProvider.js | 7 - test/dist/es/src/IAuthProvider.js.map | 1 - test/dist/es/src/IAuthProviderCallback.d.ts | 12 - test/dist/es/src/IAuthProviderCallback.js | 7 - test/dist/es/src/IAuthProviderCallback.js.map | 1 - test/dist/es/src/IAuthenticationProvider.d.ts | 20 - test/dist/es/src/IAuthenticationProvider.js | 7 - .../es/src/IAuthenticationProvider.js.map | 1 - .../src/IAuthenticationProviderOptions.d.ts | 14 - .../es/src/IAuthenticationProviderOptions.js | 7 - .../src/IAuthenticationProviderOptions.js.map | 1 - test/dist/es/src/IClientOptions.d.ts | 27 - test/dist/es/src/IClientOptions.js | 7 - test/dist/es/src/IClientOptions.js.map | 1 - test/dist/es/src/IContext.d.ts | 21 - test/dist/es/src/IContext.js | 7 - test/dist/es/src/IContext.js.map | 1 - test/dist/es/src/IFetchOptions.d.ts | 29 - test/dist/es/src/IFetchOptions.js | 7 - test/dist/es/src/IFetchOptions.js.map | 1 - test/dist/es/src/IGraphRequestCallback.d.ts | 13 - test/dist/es/src/IGraphRequestCallback.js | 7 - test/dist/es/src/IGraphRequestCallback.js.map | 1 - test/dist/es/src/IOptions.d.ts | 24 - test/dist/es/src/IOptions.js | 7 - test/dist/es/src/IOptions.js.map | 1 - .../ImplicitMSALAuthenticationProvider.d.ts | 47 - .../src/ImplicitMSALAuthenticationProvider.js | 87 -- .../ImplicitMSALAuthenticationProvider.js.map | 1 - .../MSALAuthenticationProviderOptions.d.ts | 30 - .../src/MSALAuthenticationProviderOptions.js | 24 - .../MSALAuthenticationProviderOptions.js.map | 1 - test/dist/es/src/Range.d.ts | 34 - test/dist/es/src/Range.js | 28 - test/dist/es/src/Range.js.map | 1 - test/dist/es/src/RequestMethod.d.ts | 22 - test/dist/es/src/RequestMethod.js | 24 - test/dist/es/src/RequestMethod.js.map | 1 - test/dist/es/src/ResponseType.d.ts | 25 - test/dist/es/src/ResponseType.js | 27 - test/dist/es/src/ResponseType.js.map | 1 - test/dist/es/src/ValidatePolyFilling.d.ts | 13 - test/dist/es/src/ValidatePolyFilling.js | 29 - test/dist/es/src/ValidatePolyFilling.js.map | 1 - test/dist/es/src/Version.d.ts | 10 - test/dist/es/src/Version.js | 13 - test/dist/es/src/Version.js.map | 1 - .../es/src/content/BatchRequestContent.d.ts | 144 --- .../es/src/content/BatchRequestContent.js | 410 ------- .../es/src/content/BatchRequestContent.js.map | 1 - .../es/src/content/BatchResponseContent.d.ts | 82 -- .../es/src/content/BatchResponseContent.js | 89 -- .../src/content/BatchResponseContent.js.map | 1 - test/dist/es/src/index.d.ts | 42 - test/dist/es/src/index.js | 32 - test/dist/es/src/index.js.map | 1 - .../src/middleware/AuthenticationHandler.d.ts | 56 - .../src/middleware/AuthenticationHandler.js | 75 -- .../middleware/AuthenticationHandler.js.map | 1 - test/dist/es/src/middleware/ChaosHandler.d.ts | 125 -- test/dist/es/src/middleware/ChaosHandler.js | 246 ---- .../es/src/middleware/ChaosHandler.js.map | 1 - .../es/src/middleware/HTTPMessageHandler.d.ts | 26 - .../es/src/middleware/HTTPMessageHandler.js | 32 - .../src/middleware/HTTPMessageHandler.js.map | 1 - test/dist/es/src/middleware/IMiddleware.d.ts | 16 - test/dist/es/src/middleware/IMiddleware.js | 7 - .../dist/es/src/middleware/IMiddleware.js.map | 1 - .../es/src/middleware/MiddlewareControl.d.ts | 48 - .../es/src/middleware/MiddlewareControl.js | 53 - .../src/middleware/MiddlewareControl.js.map | 1 - .../es/src/middleware/MiddlewareFactory.d.ts | 25 - .../es/src/middleware/MiddlewareFactory.js | 51 - .../src/middleware/MiddlewareFactory.js.map | 1 - .../es/src/middleware/MiddlewareUtil.d.ts | 53 - test/dist/es/src/middleware/MiddlewareUtil.js | 136 --- .../es/src/middleware/MiddlewareUtil.js.map | 1 - .../es/src/middleware/RedirectHandler.d.ts | 145 --- .../dist/es/src/middleware/RedirectHandler.js | 211 ---- .../es/src/middleware/RedirectHandler.js.map | 1 - test/dist/es/src/middleware/RetryHandler.d.ts | 121 -- test/dist/es/src/middleware/RetryHandler.js | 189 --- .../es/src/middleware/RetryHandler.js.map | 1 - .../es/src/middleware/TelemetryHandler.d.ts | 62 - .../es/src/middleware/TelemetryHandler.js | 83 -- .../es/src/middleware/TelemetryHandler.js.map | 1 - .../options/AuthenticationHandlerOptions.d.ts | 38 - .../options/AuthenticationHandlerOptions.js | 26 - .../AuthenticationHandlerOptions.js.map | 1 - .../middleware/options/ChaosHandlerData.d.ts | 21 - .../middleware/options/ChaosHandlerData.js | 86 -- .../options/ChaosHandlerData.js.map | 1 - .../options/ChaosHandlerOptions.d.ts | 62 - .../middleware/options/ChaosHandlerOptions.js | 40 - .../options/ChaosHandlerOptions.js.map | 1 - .../src/middleware/options/ChaosStrategy.d.ts | 17 - .../src/middleware/options/ChaosStrategy.js | 19 - .../middleware/options/ChaosStrategy.js.map | 1 - .../options/IMiddlewareOptions.d.ts | 11 - .../middleware/options/IMiddlewareOptions.js | 7 - .../options/IMiddlewareOptions.js.map | 1 - .../options/RedirectHandlerOptions.d.ts | 58 - .../options/RedirectHandlerOptions.js | 53 - .../options/RedirectHandlerOptions.js.map | 1 - .../options/RetryHandlerOptions.d.ts | 83 -- .../middleware/options/RetryHandlerOptions.js | 90 -- .../options/RetryHandlerOptions.js.map | 1 - .../options/TelemetryHandlerOptions.d.ts | 58 - .../options/TelemetryHandlerOptions.js | 76 -- .../options/TelemetryHandlerOptions.js.map | 1 - .../es/src/tasks/LargeFileUploadTask.d.ts | 172 --- test/dist/es/src/tasks/LargeFileUploadTask.js | 223 ---- .../es/src/tasks/LargeFileUploadTask.js.map | 1 - .../tasks/OneDriveLargeFileUploadTask.d.ts | 86 -- .../src/tasks/OneDriveLargeFileUploadTask.js | 153 --- .../tasks/OneDriveLargeFileUploadTask.js.map | 1 - .../OneDriveLargeFileUploadTaskUtil.d.ts | 15 - .../tasks/OneDriveLargeFileUploadTaskUtil.js | 43 - .../OneDriveLargeFileUploadTaskUtil.js.map | 1 - test/dist/es/src/tasks/PageIterator.d.ts | 134 -- test/dist/es/src/tasks/PageIterator.js | 138 --- test/dist/es/src/tasks/PageIterator.js.map | 1 - .../es/test/DummyAuthenticationProvider.d.ts | 24 - .../es/test/DummyAuthenticationProvider.js | 27 - .../test/DummyAuthenticationProvider.js.map | 1 - .../common/DummyAuthenticationProvider.d.ts | 24 - .../common/DummyAuthenticationProvider.js | 27 - .../common/DummyAuthenticationProvider.js.map | 1 - .../test/common/DummyHTTPMessageHandler.d.ts | 46 - .../es/test/common/DummyHTTPMessageHandler.js | 47 - .../common/DummyHTTPMessageHandler.js.map | 1 - .../es/test/common/DummyHandlerOptions.d.ts | 30 - .../es/test/common/DummyHandlerOptions.js | 24 - .../es/test/common/DummyHandlerOptions.js.map | 1 - .../common/content/BatchRequestContent.d.ts | 7 - .../common/content/BatchRequestContent.js | 601 --------- .../common/content/BatchRequestContent.js.map | 1 - .../common/content/BatchResponseContent.d.ts | 7 - .../common/content/BatchResponseContent.js | 114 -- .../content/BatchResponseContent.js.map | 1 - test/dist/es/test/common/core/Client.d.ts | 7 - test/dist/es/test/common/core/Client.js | 105 -- test/dist/es/test/common/core/Client.js.map | 1 - .../test/common/core/GraphErrorHandler.d.ts | 7 - .../es/test/common/core/GraphErrorHandler.js | 102 -- .../test/common/core/GraphErrorHandler.js.map | 1 - .../es/test/common/core/GraphRequestUtil.d.ts | 7 - .../es/test/common/core/GraphRequestUtil.js | 69 -- .../test/common/core/GraphRequestUtil.js.map | 1 - .../common/core/GraphResponseHandler.d.ts | 7 - .../test/common/core/GraphResponseHandler.js | 162 --- .../common/core/GraphResponseHandler.js.map | 1 - test/dist/es/test/common/core/HTTPClient.d.ts | 7 - test/dist/es/test/common/core/HTTPClient.js | 95 -- .../es/test/common/core/HTTPClient.js.map | 1 - .../test/common/core/HTTPClientFactory.d.ts | 7 - .../es/test/common/core/HTTPClientFactory.js | 30 - .../test/common/core/HTTPClientFactory.js.map | 1 - test/dist/es/test/common/core/Range.d.ts | 7 - test/dist/es/test/common/core/Range.js | 32 - test/dist/es/test/common/core/Range.js.map | 1 - .../es/test/common/core/urlGeneration.d.ts | 7 - .../dist/es/test/common/core/urlGeneration.js | 146 --- .../es/test/common/core/urlGeneration.js.map | 1 - test/dist/es/test/common/core/urlParsing.d.ts | 7 - test/dist/es/test/common/core/urlParsing.js | 54 - .../es/test/common/core/urlParsing.js.map | 1 - .../middleware/AuthenticationHandler.d.ts | 7 - .../middleware/AuthenticationHandler.js | 24 - .../middleware/AuthenticationHandler.js.map | 1 - .../AuthenticationHandlerOptions.d.ts | 7 - .../AuthenticationHandlerOptions.js | 25 - .../AuthenticationHandlerOptions.js.map | 1 - .../test/common/middleware/ChaosHandler.d.ts | 1 - .../es/test/common/middleware/ChaosHandler.js | 225 ---- .../common/middleware/ChaosHandler.js.map | 1 - .../MSALAuthenticationProviderOptions.d.ts | 7 - .../MSALAuthenticationProviderOptions.js | 17 - .../MSALAuthenticationProviderOptions.js.map | 1 - .../common/middleware/MiddlewareControl.d.ts | 7 - .../common/middleware/MiddlewareControl.js | 44 - .../middleware/MiddlewareControl.js.map | 1 - .../common/middleware/MiddlewareFactory.d.ts | 7 - .../common/middleware/MiddlewareFactory.js | 23 - .../middleware/MiddlewareFactory.js.map | 1 - .../common/middleware/MiddlewareUtil.d.ts | 0 .../test/common/middleware/MiddlewareUtil.js | 306 ----- .../common/middleware/MiddlewareUtil.js.map | 1 - .../common/middleware/RedirectHandler.d.ts | 7 - .../test/common/middleware/RedirectHandler.js | 323 ----- .../common/middleware/RedirectHandler.js.map | 1 - .../middleware/RedirectHandlerOptions.d.ts | 7 - .../middleware/RedirectHandlerOptions.js | 48 - .../middleware/RedirectHandlerOptions.js.map | 1 - .../test/common/middleware/RetryHandler.d.ts | 7 - .../es/test/common/middleware/RetryHandler.js | 221 ---- .../common/middleware/RetryHandler.js.map | 1 - .../middleware/RetryHandlerOptions.d.ts | 7 - .../common/middleware/RetryHandlerOptions.js | 94 -- .../middleware/RetryHandlerOptions.js.map | 1 - .../common/middleware/TelemetryHandler.d.ts | 7 - .../common/middleware/TelemetryHandler.js | 104 -- .../common/middleware/TelemetryHandler.js.map | 1 - .../middleware/TelemetryHandlerOptions.d.ts | 7 - .../middleware/TelemetryHandlerOptions.js | 67 - .../middleware/TelemetryHandlerOptions.js.map | 1 - .../common/tasks/LargeFileUploadTask.d.ts | 7 - .../test/common/tasks/LargeFileUploadTask.js | 171 --- .../common/tasks/LargeFileUploadTask.js.map | 1 - .../tasks/OneDriveLargeFileUploadTask.d.ts | 7 - .../tasks/OneDriveLargeFileUploadTask.js | 40 - .../tasks/OneDriveLargeFileUploadTask.js.map | 1 - .../OneDriveLargeFileUploadTaskUtil.d.ts | 7 - .../tasks/OneDriveLargeFileUploadTaskUtil.js | 29 - .../OneDriveLargeFileUploadTaskUtil.js.map | 1 - .../es/test/common/tasks/PageIterator.d.ts | 7 - .../dist/es/test/common/tasks/PageIterator.js | 146 --- .../es/test/common/tasks/PageIterator.js.map | 1 - test/dist/es/test/common/test-helper.d.ts | 10 - test/dist/es/test/common/test-helper.js | 20 - test/dist/es/test/common/test-helper.js.map | 1 - .../node/content/BatchRequestContent.d.ts | 7 - .../test/node/content/BatchRequestContent.js | 601 --------- .../node/content/BatchRequestContent.js.map | 1 - .../node/content/BatchResponseContent.d.ts | 7 - .../test/node/content/BatchResponseContent.js | 114 -- .../node/content/BatchResponseContent.js.map | 1 - test/dist/es/test/test-helper.d.ts | 10 - test/dist/es/test/test-helper.js | 20 - test/dist/es/test/test-helper.js.map | 1 - test/node/content/BatchRequestContent.ts | 38 +- test/package-lock.json | 1085 +++++++++++++++++ test/package.json | 18 + test/test-helper.ts | 2 - test/tsconfig-test-cjs.json | 3 +- test/tsconfig-test-es.json | 7 +- tsconfig-cjs.json | 4 +- tsconfig-es.json | 2 +- 302 files changed, 1303 insertions(+), 12315 deletions(-) rename test/{common => }/DummyHTTPMessageHandler.ts (93%) rename test/{common => }/DummyHandlerOptions.ts (91%) delete mode 100644 test/common/DummyAuthenticationProvider.ts rename test/common/{ => content}/package-lock.json (100%) delete mode 100644 test/common/package.json delete mode 100644 test/common/test-helper.ts delete mode 100644 test/dist/es/src/Client.d.ts delete mode 100644 test/dist/es/src/Client.js delete mode 100644 test/dist/es/src/Client.js.map delete mode 100644 test/dist/es/src/Constants.d.ts delete mode 100644 test/dist/es/src/Constants.js delete mode 100644 test/dist/es/src/Constants.js.map delete mode 100644 test/dist/es/src/CustomAuthenticationProvider.d.ts delete mode 100644 test/dist/es/src/CustomAuthenticationProvider.js delete mode 100644 test/dist/es/src/CustomAuthenticationProvider.js.map delete mode 100644 test/dist/es/src/GraphError.d.ts delete mode 100644 test/dist/es/src/GraphError.js delete mode 100644 test/dist/es/src/GraphError.js.map delete mode 100644 test/dist/es/src/GraphErrorHandler.d.ts delete mode 100644 test/dist/es/src/GraphErrorHandler.js delete mode 100644 test/dist/es/src/GraphErrorHandler.js.map delete mode 100644 test/dist/es/src/GraphRequest.d.ts delete mode 100644 test/dist/es/src/GraphRequest.js delete mode 100644 test/dist/es/src/GraphRequest.js.map delete mode 100644 test/dist/es/src/GraphRequestUtil.d.ts delete mode 100644 test/dist/es/src/GraphRequestUtil.js delete mode 100644 test/dist/es/src/GraphRequestUtil.js.map delete mode 100644 test/dist/es/src/GraphResponseHandler.d.ts delete mode 100644 test/dist/es/src/GraphResponseHandler.js delete mode 100644 test/dist/es/src/GraphResponseHandler.js.map delete mode 100644 test/dist/es/src/HTTPClient.d.ts delete mode 100644 test/dist/es/src/HTTPClient.js delete mode 100644 test/dist/es/src/HTTPClient.js.map delete mode 100644 test/dist/es/src/HTTPClientFactory.d.ts delete mode 100644 test/dist/es/src/HTTPClientFactory.js delete mode 100644 test/dist/es/src/HTTPClientFactory.js.map delete mode 100644 test/dist/es/src/IAuthProvider.d.ts delete mode 100644 test/dist/es/src/IAuthProvider.js delete mode 100644 test/dist/es/src/IAuthProvider.js.map delete mode 100644 test/dist/es/src/IAuthProviderCallback.d.ts delete mode 100644 test/dist/es/src/IAuthProviderCallback.js delete mode 100644 test/dist/es/src/IAuthProviderCallback.js.map delete mode 100644 test/dist/es/src/IAuthenticationProvider.d.ts delete mode 100644 test/dist/es/src/IAuthenticationProvider.js delete mode 100644 test/dist/es/src/IAuthenticationProvider.js.map delete mode 100644 test/dist/es/src/IAuthenticationProviderOptions.d.ts delete mode 100644 test/dist/es/src/IAuthenticationProviderOptions.js delete mode 100644 test/dist/es/src/IAuthenticationProviderOptions.js.map delete mode 100644 test/dist/es/src/IClientOptions.d.ts delete mode 100644 test/dist/es/src/IClientOptions.js delete mode 100644 test/dist/es/src/IClientOptions.js.map delete mode 100644 test/dist/es/src/IContext.d.ts delete mode 100644 test/dist/es/src/IContext.js delete mode 100644 test/dist/es/src/IContext.js.map delete mode 100644 test/dist/es/src/IFetchOptions.d.ts delete mode 100644 test/dist/es/src/IFetchOptions.js delete mode 100644 test/dist/es/src/IFetchOptions.js.map delete mode 100644 test/dist/es/src/IGraphRequestCallback.d.ts delete mode 100644 test/dist/es/src/IGraphRequestCallback.js delete mode 100644 test/dist/es/src/IGraphRequestCallback.js.map delete mode 100644 test/dist/es/src/IOptions.d.ts delete mode 100644 test/dist/es/src/IOptions.js delete mode 100644 test/dist/es/src/IOptions.js.map delete mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts delete mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.js delete mode 100644 test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map delete mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.d.ts delete mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.js delete mode 100644 test/dist/es/src/MSALAuthenticationProviderOptions.js.map delete mode 100644 test/dist/es/src/Range.d.ts delete mode 100644 test/dist/es/src/Range.js delete mode 100644 test/dist/es/src/Range.js.map delete mode 100644 test/dist/es/src/RequestMethod.d.ts delete mode 100644 test/dist/es/src/RequestMethod.js delete mode 100644 test/dist/es/src/RequestMethod.js.map delete mode 100644 test/dist/es/src/ResponseType.d.ts delete mode 100644 test/dist/es/src/ResponseType.js delete mode 100644 test/dist/es/src/ResponseType.js.map delete mode 100644 test/dist/es/src/ValidatePolyFilling.d.ts delete mode 100644 test/dist/es/src/ValidatePolyFilling.js delete mode 100644 test/dist/es/src/ValidatePolyFilling.js.map delete mode 100644 test/dist/es/src/Version.d.ts delete mode 100644 test/dist/es/src/Version.js delete mode 100644 test/dist/es/src/Version.js.map delete mode 100644 test/dist/es/src/content/BatchRequestContent.d.ts delete mode 100644 test/dist/es/src/content/BatchRequestContent.js delete mode 100644 test/dist/es/src/content/BatchRequestContent.js.map delete mode 100644 test/dist/es/src/content/BatchResponseContent.d.ts delete mode 100644 test/dist/es/src/content/BatchResponseContent.js delete mode 100644 test/dist/es/src/content/BatchResponseContent.js.map delete mode 100644 test/dist/es/src/index.d.ts delete mode 100644 test/dist/es/src/index.js delete mode 100644 test/dist/es/src/index.js.map delete mode 100644 test/dist/es/src/middleware/AuthenticationHandler.d.ts delete mode 100644 test/dist/es/src/middleware/AuthenticationHandler.js delete mode 100644 test/dist/es/src/middleware/AuthenticationHandler.js.map delete mode 100644 test/dist/es/src/middleware/ChaosHandler.d.ts delete mode 100644 test/dist/es/src/middleware/ChaosHandler.js delete mode 100644 test/dist/es/src/middleware/ChaosHandler.js.map delete mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.d.ts delete mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.js delete mode 100644 test/dist/es/src/middleware/HTTPMessageHandler.js.map delete mode 100644 test/dist/es/src/middleware/IMiddleware.d.ts delete mode 100644 test/dist/es/src/middleware/IMiddleware.js delete mode 100644 test/dist/es/src/middleware/IMiddleware.js.map delete mode 100644 test/dist/es/src/middleware/MiddlewareControl.d.ts delete mode 100644 test/dist/es/src/middleware/MiddlewareControl.js delete mode 100644 test/dist/es/src/middleware/MiddlewareControl.js.map delete mode 100644 test/dist/es/src/middleware/MiddlewareFactory.d.ts delete mode 100644 test/dist/es/src/middleware/MiddlewareFactory.js delete mode 100644 test/dist/es/src/middleware/MiddlewareFactory.js.map delete mode 100644 test/dist/es/src/middleware/MiddlewareUtil.d.ts delete mode 100644 test/dist/es/src/middleware/MiddlewareUtil.js delete mode 100644 test/dist/es/src/middleware/MiddlewareUtil.js.map delete mode 100644 test/dist/es/src/middleware/RedirectHandler.d.ts delete mode 100644 test/dist/es/src/middleware/RedirectHandler.js delete mode 100644 test/dist/es/src/middleware/RedirectHandler.js.map delete mode 100644 test/dist/es/src/middleware/RetryHandler.d.ts delete mode 100644 test/dist/es/src/middleware/RetryHandler.js delete mode 100644 test/dist/es/src/middleware/RetryHandler.js.map delete mode 100644 test/dist/es/src/middleware/TelemetryHandler.d.ts delete mode 100644 test/dist/es/src/middleware/TelemetryHandler.js delete mode 100644 test/dist/es/src/middleware/TelemetryHandler.js.map delete mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js delete mode 100644 test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.d.ts delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.js delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerData.js.map delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.js delete mode 100644 test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map delete mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.d.ts delete mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.js delete mode 100644 test/dist/es/src/middleware/options/ChaosStrategy.js.map delete mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.js delete mode 100644 test/dist/es/src/middleware/options/IMiddlewareOptions.js.map delete mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.js delete mode 100644 test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map delete mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.js delete mode 100644 test/dist/es/src/middleware/options/RetryHandlerOptions.js.map delete mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts delete mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.js delete mode 100644 test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map delete mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.d.ts delete mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.js delete mode 100644 test/dist/es/src/tasks/LargeFileUploadTask.js.map delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js delete mode 100644 test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map delete mode 100644 test/dist/es/src/tasks/PageIterator.d.ts delete mode 100644 test/dist/es/src/tasks/PageIterator.js delete mode 100644 test/dist/es/src/tasks/PageIterator.js.map delete mode 100644 test/dist/es/test/DummyAuthenticationProvider.d.ts delete mode 100644 test/dist/es/test/DummyAuthenticationProvider.js delete mode 100644 test/dist/es/test/DummyAuthenticationProvider.js.map delete mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.d.ts delete mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.js delete mode 100644 test/dist/es/test/common/DummyAuthenticationProvider.js.map delete mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.d.ts delete mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.js delete mode 100644 test/dist/es/test/common/DummyHTTPMessageHandler.js.map delete mode 100644 test/dist/es/test/common/DummyHandlerOptions.d.ts delete mode 100644 test/dist/es/test/common/DummyHandlerOptions.js delete mode 100644 test/dist/es/test/common/DummyHandlerOptions.js.map delete mode 100644 test/dist/es/test/common/content/BatchRequestContent.d.ts delete mode 100644 test/dist/es/test/common/content/BatchRequestContent.js delete mode 100644 test/dist/es/test/common/content/BatchRequestContent.js.map delete mode 100644 test/dist/es/test/common/content/BatchResponseContent.d.ts delete mode 100644 test/dist/es/test/common/content/BatchResponseContent.js delete mode 100644 test/dist/es/test/common/content/BatchResponseContent.js.map delete mode 100644 test/dist/es/test/common/core/Client.d.ts delete mode 100644 test/dist/es/test/common/core/Client.js delete mode 100644 test/dist/es/test/common/core/Client.js.map delete mode 100644 test/dist/es/test/common/core/GraphErrorHandler.d.ts delete mode 100644 test/dist/es/test/common/core/GraphErrorHandler.js delete mode 100644 test/dist/es/test/common/core/GraphErrorHandler.js.map delete mode 100644 test/dist/es/test/common/core/GraphRequestUtil.d.ts delete mode 100644 test/dist/es/test/common/core/GraphRequestUtil.js delete mode 100644 test/dist/es/test/common/core/GraphRequestUtil.js.map delete mode 100644 test/dist/es/test/common/core/GraphResponseHandler.d.ts delete mode 100644 test/dist/es/test/common/core/GraphResponseHandler.js delete mode 100644 test/dist/es/test/common/core/GraphResponseHandler.js.map delete mode 100644 test/dist/es/test/common/core/HTTPClient.d.ts delete mode 100644 test/dist/es/test/common/core/HTTPClient.js delete mode 100644 test/dist/es/test/common/core/HTTPClient.js.map delete mode 100644 test/dist/es/test/common/core/HTTPClientFactory.d.ts delete mode 100644 test/dist/es/test/common/core/HTTPClientFactory.js delete mode 100644 test/dist/es/test/common/core/HTTPClientFactory.js.map delete mode 100644 test/dist/es/test/common/core/Range.d.ts delete mode 100644 test/dist/es/test/common/core/Range.js delete mode 100644 test/dist/es/test/common/core/Range.js.map delete mode 100644 test/dist/es/test/common/core/urlGeneration.d.ts delete mode 100644 test/dist/es/test/common/core/urlGeneration.js delete mode 100644 test/dist/es/test/common/core/urlGeneration.js.map delete mode 100644 test/dist/es/test/common/core/urlParsing.d.ts delete mode 100644 test/dist/es/test/common/core/urlParsing.js delete mode 100644 test/dist/es/test/common/core/urlParsing.js.map delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.d.ts delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.js delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandler.js.map delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js delete mode 100644 test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map delete mode 100644 test/dist/es/test/common/middleware/ChaosHandler.d.ts delete mode 100644 test/dist/es/test/common/middleware/ChaosHandler.js delete mode 100644 test/dist/es/test/common/middleware/ChaosHandler.js.map delete mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts delete mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js delete mode 100644 test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map delete mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.d.ts delete mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.js delete mode 100644 test/dist/es/test/common/middleware/MiddlewareControl.js.map delete mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.d.ts delete mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.js delete mode 100644 test/dist/es/test/common/middleware/MiddlewareFactory.js.map delete mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.d.ts delete mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.js delete mode 100644 test/dist/es/test/common/middleware/MiddlewareUtil.js.map delete mode 100644 test/dist/es/test/common/middleware/RedirectHandler.d.ts delete mode 100644 test/dist/es/test/common/middleware/RedirectHandler.js delete mode 100644 test/dist/es/test/common/middleware/RedirectHandler.js.map delete mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts delete mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.js delete mode 100644 test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map delete mode 100644 test/dist/es/test/common/middleware/RetryHandler.d.ts delete mode 100644 test/dist/es/test/common/middleware/RetryHandler.js delete mode 100644 test/dist/es/test/common/middleware/RetryHandler.js.map delete mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts delete mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.js delete mode 100644 test/dist/es/test/common/middleware/RetryHandlerOptions.js.map delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.d.ts delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.js delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandler.js.map delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.js delete mode 100644 test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map delete mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts delete mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.js delete mode 100644 test/dist/es/test/common/tasks/LargeFileUploadTask.js.map delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js delete mode 100644 test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map delete mode 100644 test/dist/es/test/common/tasks/PageIterator.d.ts delete mode 100644 test/dist/es/test/common/tasks/PageIterator.js delete mode 100644 test/dist/es/test/common/tasks/PageIterator.js.map delete mode 100644 test/dist/es/test/common/test-helper.d.ts delete mode 100644 test/dist/es/test/common/test-helper.js delete mode 100644 test/dist/es/test/common/test-helper.js.map delete mode 100644 test/dist/es/test/node/content/BatchRequestContent.d.ts delete mode 100644 test/dist/es/test/node/content/BatchRequestContent.js delete mode 100644 test/dist/es/test/node/content/BatchRequestContent.js.map delete mode 100644 test/dist/es/test/node/content/BatchResponseContent.d.ts delete mode 100644 test/dist/es/test/node/content/BatchResponseContent.js delete mode 100644 test/dist/es/test/node/content/BatchResponseContent.js.map delete mode 100644 test/dist/es/test/test-helper.d.ts delete mode 100644 test/dist/es/test/test-helper.js delete mode 100644 test/dist/es/test/test-helper.js.map create mode 100644 test/package-lock.json create mode 100644 test/package.json diff --git a/.gitignore b/.gitignore index e2230a5e9..0f27427cf 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,7 @@ samples/browser/src/secrets.js samples/browser/src/graph-js-sdk.js samples/browser/src/graph-es-sdk.js -spec/**/*.js -spec/**/*.d.ts -spec/**/*.js.map + spec/**/secrets.ts .nyc_output/* \ No newline at end of file diff --git a/.huskyrc b/.huskyrc index 2cccd352d..b0c6b7030 100644 --- a/.huskyrc +++ b/.huskyrc @@ -1,5 +1,5 @@ { "hooks": { - "pre-commit": "npm run buid" + "pre-commit": "npm run build" } } diff --git a/karma.conf.js b/karma.conf.js index 90bb7f1fa..964cfc9ed 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,13 +1,13 @@ module.exports = function(config) { - config.set({ - frameworks: ["mocha", "chai", "karma-typescript"], - files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts"], - preprocessors: { - "**/*.ts": ["karma-typescript"], - }, - karmaTypescriptConfig: { - tsconfig: "./test/tsconfig-es.json", - }, - browsers: ["ChromeHeadless"], - }); -}; + config.set({ + frameworks: ["mocha", "chai", "karma-typescript"], + files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts", "test/*.ts"], + preprocessors: { + "**/*.ts": ["karma-typescript"], + }, + karmaTypescriptConfig: { + tsconfig: "./tsconfig-cjs.json", + }, + browsers: ["ChromeHeadless"], + }); +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4c88bd8dc..ef6a24fd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2648,15 +2648,6 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "dev": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -5103,13 +5094,13 @@ "dev": true }, "isomorphic-fetch": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", "dev": true, "requires": { - "node-fetch": "^1.0.1", - "whatwg-fetch": ">=0.10.0" + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" } }, "istanbul-lib-coverage": { @@ -6780,14 +6771,10 @@ } }, "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "dev": true, - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "dev": true }, "node-preload": { "version": "0.2.1", @@ -9851,9 +9838,9 @@ } }, "whatwg-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz", + "integrity": "sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A==", "dev": true }, "which": { diff --git a/package.json b/package.json index 4967c954e..6facc4f88 100644 --- a/package.json +++ b/package.json @@ -1,99 +1,99 @@ { - "name": "@microsoft/microsoft-graph-client", - "version": "2.1.0-Preview.2", - "description": "Microsoft Graph Client Library", - "license": "MIT", - "main": "lib/src/index.js", - "module": "lib/es/index.js", - "typings": "lib/src/index", - "files": [ - "lib/", - "src/" - ], - "types": "./lib/src/index.d.ts", - "dependencies": { - "@babel/runtime": "^7.4.4", - "esm": "^3.2.25", - "karma": "^5.2.3", - "tslib": "^1.9.3" - }, - "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/plugin-transform-runtime": "^7.4.4", - "@babel/preset-env": "^7.4.4", - "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@types/chai": "^4.2.14", - "@types/mocha": "^5.2.7", - "@types/node": "^12.0.10", - "chai": "^4.2.0", - "gulp": "^4.0.2", - "husky": "^2.2.0", - "isomorphic-fetch": "^2.2.1", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^2.1.0", - "karma-mocha": "^2.0.1", - "karma-typescript": "^5.2.0", - "lint-staged": "^8.1.5", - "mocha": "^6.2.3", - "msal": "^1.0.0", - "nyc": "^15.1.0", - "prettier": "^1.17.0", - "puppeteer": "^5.5.0", - "rollup": "^1.10.1", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-commonjs": "^10.0.1", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-terser": "^5.0.0", - "source-map-support": "^0.5.19", - "ts-node": "^9.0.0", - "tslint": "^5.16.0", - "tslint-config-prettier": "^1.18.0", - "typescript": "^3.4.5", - "uglify-es": "^3.3.9" - }, - "scripts": { - "setVersion": "gulp setVersion", - "build:es": "tsc --p tsconfig-es.json", - "build:cjs": "tsc --p tsconfig-cjs.json", - "pre-build": "npm run setVersion", - "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", - "test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks", - "test:content": "tsc --p spec/tsconfig.json && mocha spec/content", - "test:core": "tsc --p spec/tsconfig.json && mocha spec/core", - "test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware", - "test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks", - "test:development": "tsc --p spec/tsconfig.json && mocha spec/development/workload", - "test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload", - "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", - "format:css": "prettier --write \"**/*.css\"", - "format:html": "prettier --write \"**/*.html\"", - "format:js": "prettier --write \"**/*.js\"", - "format:json": "prettier --write \"**/*.json\"", - "format:md": "prettier --write \"**/*.md\"", - "format:rc": "prettier --write --parser json \"**/.*rc\"", - "format:ts": "prettier --write \"**/*.ts\"", - "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", - "prepack": "npm install && npm run build && npm run test", - "test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts", - "test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js", - "test:es": "tsc -p ./test/tsconfig-test-es.json && mocha test/dist/**/*.js --require esm", - "test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts", - "cover": "nyc npm run test", - "coverage": "nyc npm run test:esm", - "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" - }, - "nyc": { - "all": true, - "cache": false, - "exclude": [ - "samples/", - "*.js", - "lib/" - ] - } + "name": "@microsoft/microsoft-graph-client", + "version": "2.1.0-Preview.2", + "description": "Microsoft Graph Client Library", + "license": "MIT", + "main": "lib/src/index.js", + "module": "lib/es/index.js", + "typings": "lib/src/index", + "files": [ + "lib/", + "src/" + ], + "types": "./lib/src/index.d.ts", + "dependencies": { + "@babel/runtime": "^7.4.4", + "esm": "^3.2.25", + "karma": "^5.2.3", + "tslib": "^1.9.3" + }, + "devDependencies": { + "@babel/core": "^7.4.4", + "@babel/plugin-transform-runtime": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@types/chai": "^4.2.14", + "@types/mocha": "^5.2.7", + "@types/node": "^12.0.10", + "chai": "^4.2.0", + "gulp": "^4.0.2", + "husky": "^2.2.0", + "isomorphic-fetch": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^2.1.0", + "karma-mocha": "^2.0.1", + "karma-typescript": "^5.2.0", + "lint-staged": "^8.1.5", + "mocha": "^6.2.3", + "msal": "^1.0.0", + "nyc": "^15.1.0", + "prettier": "^1.17.0", + "puppeteer": "^5.5.0", + "rollup": "^1.10.1", + "rollup-plugin-babel": "^4.3.2", + "rollup-plugin-commonjs": "^10.0.1", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^5.0.0", + "source-map-support": "^0.5.19", + "ts-node": "^9.0.0", + "tslint": "^5.16.0", + "tslint-config-prettier": "^1.18.0", + "typescript": "^3.4.5", + "uglify-es": "^3.3.9" + }, + "scripts": { + "setVersion": "gulp setVersion", + "build:es": "tsc --p tsconfig-es.json", + "build:cjs": "tsc --p tsconfig-cjs.json", + "pre-build": "npm run setVersion", + "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", + "test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks", + "test:content": "tsc --p spec/tsconfig.json && mocha spec/content", + "test:core": "tsc --p spec/tsconfig.json && mocha spec/core", + "test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware", + "test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks", + "test:development": "tsc --p spec/tsconfig.json && mocha spec/development/workload", + "test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload", + "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", + "format:css": "prettier --write \"**/*.css\"", + "format:html": "prettier --write \"**/*.html\"", + "format:js": "prettier --write \"**/*.js\"", + "format:json": "prettier --write \"**/*.json\"", + "format:md": "prettier --write \"**/*.md\"", + "format:rc": "prettier --write --parser json \"**/.*rc\"", + "format:ts": "prettier --write \"**/*.ts\"", + "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", + "prepack": "npm install && npm run build && npm run test", + "test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts", + "test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js", + "test:es": "tsc -p tsconfig-es.json && mocha lib/es/test/common/content --require esm && mocha lib/es/test/common/core --require esm && mocha lib/es/test/common/tasks --require esm && mocha lib/es/test/common/middleware --require esm", + "test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts", + "cover": "nyc npm run test", + "coverage": "nyc npm run test:esm", + "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" + }, + "nyc": { + "all": true, + "cache": false, + "exclude": [ + "samples/", + "*.js", + "lib/" + ] + } } diff --git a/src/GraphResponseHandler.ts b/src/GraphResponseHandler.ts index 1065ccb8b..7ec93179b 100644 --- a/src/GraphResponseHandler.ts +++ b/src/GraphResponseHandler.ts @@ -7,6 +7,7 @@ /** * @module GraphResponseHandler + * References - https://fetch.spec.whatwg.org/#responses */ import { GraphRequestCallback } from "./IGraphRequestCallback"; @@ -134,6 +135,7 @@ export class GraphResponseHandler { } else if (mimeType === ContentType.APPLICATION_JSON) { responseValue = await rawResponse.json(); } else { + // TODO - Update handling of responses where content-type is not unknown responseValue = Promise.resolve(rawResponse.body); } } else { @@ -148,6 +150,8 @@ export class GraphResponseHandler { * * So assuming it as a stream type so returning the body. */ + + // TODO - Update handling of responses where content-type is not present responseValue = Promise.resolve(rawResponse.body); } break; diff --git a/src/content/BatchRequestContent.ts b/src/content/BatchRequestContent.ts index a767743df..3cac61aaa 100644 --- a/src/content/BatchRequestContent.ts +++ b/src/content/BatchRequestContent.ts @@ -381,8 +381,10 @@ export class BatchRequestContent { } while (!cur.done) { const requestStep: BatchRequestStep = cur.value[1]; - const batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData; + const batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData; /** + * @see{@https://tools.ietf.org/html/rfc7578#section-4.4} + * TODO- Setting/Defaulting of content-type header to the correct value * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format} */ if (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers["content-type"] === undefined)) { diff --git a/test/common/DummyHTTPMessageHandler.ts b/test/DummyHTTPMessageHandler.ts similarity index 93% rename from test/common/DummyHTTPMessageHandler.ts rename to test/DummyHTTPMessageHandler.ts index eb7aedca0..68a3cded7 100644 --- a/test/common/DummyHTTPMessageHandler.ts +++ b/test/DummyHTTPMessageHandler.ts @@ -9,8 +9,8 @@ * @module DummyHTTPMessageHandler */ -import { Context } from "../../src/IContext"; -import { Middleware } from "../../src/middleware/IMiddleware"; +import { Context } from "../src/IContext"; +import { Middleware } from "../src/middleware/IMiddleware"; /** * @class diff --git a/test/common/DummyHandlerOptions.ts b/test/DummyHandlerOptions.ts similarity index 91% rename from test/common/DummyHandlerOptions.ts rename to test/DummyHandlerOptions.ts index 60704c090..72bab57db 100644 --- a/test/common/DummyHandlerOptions.ts +++ b/test/DummyHandlerOptions.ts @@ -9,7 +9,7 @@ * @module DummyHandlerOptions */ -import { MiddlewareOptions } from "../../src/middleware/options/IMiddlewareOptions"; +import { MiddlewareOptions } from "../src/middleware/options/IMiddlewareOptions"; /** * @class diff --git a/test/browser/core/GraphResponseHandler.ts b/test/browser/core/GraphResponseHandler.ts index d4766eb5d..22cdbfbe9 100644 --- a/test/browser/core/GraphResponseHandler.ts +++ b/test/browser/core/GraphResponseHandler.ts @@ -10,6 +10,9 @@ import { assert } from "chai"; import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; import { ResponseType } from "../../../src/ResponseType"; +/** + * References - https://fetch.spec.whatwg.org/#responses + */ describe("GraphResponseHandler.ts", () => { const htmlString = ` @@ -25,138 +28,22 @@ describe("GraphResponseHandler.ts", () => { status: 200, statusText: "OK", }; - const status204 = { - status: 204, - statusText: "OK", - }; - const status500 = { - status: 500, - statusText: "Internal Server Error", - }; - const status202 = { - status: 202, - statusText: "OK", - }; - const status200Text = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "text/plain", - }, - }; - const status200Json = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "application/json", - }, - }; - const status200Image = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "image/jpeg", - }, - }; - const status200Unknown = { - status: 200, - statusText: "OK", - headers: { - "Content-Type": "dummy/unknown", - }, - }; + /* tslint:disable: no-string-literal */ describe("parseDocumentResponse", () => { it("Should return the html string", async () => { const response = new Response(htmlString, status200); const dom = await GraphResponseHandler["parseDocumentResponse"](response, DocumentType.TEXT_HTML); assert.isDefined(dom); - assert.equal(typeof dom, "string"); - }); - }); - - describe("convertResponse", () => { - it("Should return empty response for the NO CONTENT (204 response)", async () => { - const response = new Response(undefined, status204); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.isUndefined(responseValue); - }); - - it("Should return empty text value for empty response", async () => { - const response = new Response(undefined, status202); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.isUndefined(responseValue); - }); - - it("Should return text data for text/plain content-type", async () => { - const data = "text data"; - const response = new Response(data, status200Text); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue, data); - }); - - it("Should return json data for application/json content-type", async () => { - const data = { - test: "test", - }; - const response = new Response(JSON.stringify(data), status200Json); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue.test, data.test); - }); - - it("Should return raw response incase of unknown content-type", async () => { - const data = "test data"; - const response = new Response(data, status200Unknown); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue, data); - }); - - it("Should return response value as text", async () => { - const response = new Response(htmlString, status200); - const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.TEXT); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); + assert.instanceOf(dom, Document); }); it("Should return response value as text for text/html return type", async () => { const response = new Response(htmlString, status200); const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.DOCUMENT); assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); - }); - - it("Should return response value as json", async () => { - const json = { test: "test" }; - const response = new Response(JSON.stringify(json), status200); - const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.JSON); - assert.isDefined(responseValue); - assert.equal(responseValue.test, "test"); - }); - - it("Should return response value as text for default response type", async () => { - const response = new Response(htmlString, status200); - const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); + assert.instanceOf(responseValue, Document); }); }); /* tslint:enable: no-string-literal */ - - describe("getResponse", () => { - it("Should return a raw response", async () => { - const response = new Response(htmlString, status200); - const responseValue = await GraphResponseHandler.getResponse(response, ResponseType.RAW); - assert.isDefined(responseValue); - assert.isTrue(responseValue instanceof Response); - }); - - it("Should return valid 200 OK response", async () => { - const response = new Response(htmlString, status200); - const responseValue = await GraphResponseHandler.getResponse(response, ResponseType.TEXT); - assert.isDefined(responseValue); - }); - }); }); diff --git a/test/common/DummyAuthenticationProvider.ts b/test/common/DummyAuthenticationProvider.ts deleted file mode 100644 index 818b64047..000000000 --- a/test/common/DummyAuthenticationProvider.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -/** - * @module DummyAuthenticationProvider - */ - -import { AuthenticationProvider } from "../../src/IAuthenticationProvider"; - -/** - * @class - * @implements AuthenticationProvider - * Class representing DummyAuthenticationProvider - */ -export class DummyAuthenticationProvider implements AuthenticationProvider { - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - public async getAccessToken(): Promise { - const token = "DUMMY_TOKEN"; - return Promise.resolve(token); - } -} diff --git a/test/common/content/BatchRequestContent.ts b/test/common/content/BatchRequestContent.ts index f590b5c31..17777a967 100644 --- a/test/common/content/BatchRequestContent.ts +++ b/test/common/content/BatchRequestContent.ts @@ -6,11 +6,10 @@ */ import { assert } from "chai"; -import * as fs from "fs"; import "isomorphic-fetch"; import { BatchRequestContent, BatchRequestStep } from "../../../src/content/BatchRequestContent"; -import { randomString } from "../test-helper"; +import { randomString } from "../../test-helper"; const folderName = randomString(); const folderDetails = { @@ -72,7 +71,7 @@ describe("BatchRequestContent.ts", () => { createFolderDuplicate1.id = ""; try { const batchReq = new BatchRequestContent([createFolderDuplicate1]); - throw new Error("Something wrong with the empty id check"); + throw new Error("Test Failed - Something wrong with the empty id check"); } catch (error) { assert.equal(error.name, "Empty Id For Request"); } @@ -88,7 +87,7 @@ describe("BatchRequestContent.ts", () => { } try { const batchReq = new BatchRequestContent(requests); - throw new Error("Something wrong with the limiting requests"); + throw new Error("Test Failed - Something wrong with the limiting requests"); } catch (error) { assert.equal(error.name, "Limit Exceeded Error"); done(); @@ -110,7 +109,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(requests); try { batchReq.addRequest(req); - throw new Error("Something wrong with the limiting requests"); + throw new Error("Test Failed - Something wrong with the limiting requests"); } catch (error) { assert.equal(error.name, "Limit Exceeded Error"); done(); @@ -132,7 +131,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req1]); try { batchReq.addRequest(req2); - throw new Error("Something wrong with duplicate id validation"); + throw new Error("Test Failed - Something wrong with duplicate id validation"); } catch (error) { assert.equal(error.name, "Duplicate RequestId Error"); done(); @@ -145,7 +144,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(); try { batchReq.addRequest(req); - throw new Error("Something wrong with empty id validation"); + throw new Error("Test Failed -Something wrong with empty id validation"); } catch (error) { assert.equal(error.name, "Empty Id For Request"); done(); @@ -199,7 +198,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req]); try { batchReq.addDependency("1"); - throw new Error("Dependent validation is failing"); + throw new Error("Test Failed -Dependent validation is failing"); } catch (err) { assert.equal(err.name, "Invalid Dependency Addition"); done(); @@ -211,7 +210,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req]); try { batchReq.addDependency("1", "100"); - throw new Error("Dependency validation is failing"); + throw new Error("Test Failed -Dependency validation is failing"); } catch (err) { assert.equal(err.name, "Invalid Dependency"); done(); @@ -297,7 +296,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(); try { const content = await batchReq.getContent(); - throw new Error("Something wrong with the empty requests validation"); + throw new Error("Test Failed - Something wrong with the empty requests validation"); } catch (error) { assert.equal(error.name, "Empty Payload"); } @@ -314,52 +313,6 @@ describe("BatchRequestContent.ts", () => { throw error; } }); - - it("Should return image's base64 string", async () => { - const fileName = "sample_image.jpg"; - fs.readFile(`./spec/sample_files/${fileName}`, {}, async (err, file) => { - if (err) { - throw err; - } - const uploadOneDriveFile = { - id: "1", - request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { - method: "PUT", - headers: { - "Content-type": "image/jpg", - }, - body: file, - }), - }; - const batchReq = new BatchRequestContent([uploadOneDriveFile]); - try { - const content = await batchReq.getContent(); - assert.isDefined(content.requests[0].body); - } catch (error) { - throw error; - } - }); - }); - - it("Should throw error for request does not have content-type header if it does have a body", async () => { - const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { - method: "POST", - body: JSON.stringify(folderDetails), - }); - - const batchReq = new BatchRequestContent([ - { - id: "1", - request: createFolderReqWithoutHeader, - }, - ]); - try { - const content = await batchReq.getContent(); - throw new Error("Something wrong with the header checking"); - } catch (error) { - assert.equal(error.name, "Invalid Content-type header"); - } - }); }); describe("removeDependency", function() { @@ -423,7 +376,7 @@ describe("BatchRequestContent.ts", () => { it("Should throw error for empty request object", (done) => { try { BatchRequestContent["validateDependencies"](new Map() as Map); - throw new Error("Something wrong with the empty requests check"); + throw new Error("Test Failed - Something wrong with the empty requests check"); } catch (error) { assert.equal(error.name, "Empty Requests Error"); done(); diff --git a/test/common/package-lock.json b/test/common/content/package-lock.json similarity index 100% rename from test/common/package-lock.json rename to test/common/content/package-lock.json diff --git a/test/common/core/Client.ts b/test/common/core/Client.ts index 61473a9f7..069f2fcd9 100644 --- a/test/common/core/Client.ts +++ b/test/common/core/Client.ts @@ -17,8 +17,8 @@ import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHan import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyAuthenticationProvider } from "../../DummyAuthenticationProvider"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; describe("Client.ts", () => { /* tslint:disable: no-string-literal */ @@ -33,7 +33,7 @@ describe("Client.ts", () => { middleware: dummyHTTPHandler, }; const client: Client = Client.initWithMiddleware(options); - throw new Error("Something wrong with the ambiguity check"); + throw new Error("Test Failed - Something wrong with the ambiguity check"); } catch (error) { assert.equal(error.name, "AmbiguityInInitialization"); } @@ -61,7 +61,7 @@ describe("Client.ts", () => { try { const options: ClientOptions = {}; Client.initWithMiddleware(options); - throw new Error("Something wrong with the client initialization check"); + throw new Error("Test Failed - Something wrong with the client initialization check"); } catch (error) { assert.equal(error.name, "InvalidMiddlewareChain"); } diff --git a/test/common/core/GraphRequestUtil.ts b/test/common/core/GraphRequestUtil.ts index 96353ffac..704ef4538 100644 --- a/test/common/core/GraphRequestUtil.ts +++ b/test/common/core/GraphRequestUtil.ts @@ -61,7 +61,7 @@ describe("GraphRequestUtil.ts", () => { node2.link = node1; try { serializeContent(node1); - throw new Error("Something wrong with the serialize content, it should not stringify cyclic referenced objects"); + throw new Error("Test Failed - Something wrong with the serialize content, it should not stringify cyclic referenced objects"); } catch (error) { assert.equal(error.message, "Unable to stringify the content"); } diff --git a/test/common/core/GraphResponseHandler.ts b/test/common/core/GraphResponseHandler.ts index d4766eb5d..6454410b6 100644 --- a/test/common/core/GraphResponseHandler.ts +++ b/test/common/core/GraphResponseHandler.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; +import { GraphResponseHandler } from "../../../src/GraphResponseHandler"; import { ResponseType } from "../../../src/ResponseType"; describe("GraphResponseHandler.ts", () => { @@ -66,15 +66,6 @@ describe("GraphResponseHandler.ts", () => { }, }; /* tslint:disable: no-string-literal */ - describe("parseDocumentResponse", () => { - it("Should return the html string", async () => { - const response = new Response(htmlString, status200); - const dom = await GraphResponseHandler["parseDocumentResponse"](response, DocumentType.TEXT_HTML); - assert.isDefined(dom); - assert.equal(typeof dom, "string"); - }); - }); - describe("convertResponse", () => { it("Should return empty response for the NO CONTENT (204 response)", async () => { const response = new Response(undefined, status204); @@ -85,7 +76,7 @@ describe("GraphResponseHandler.ts", () => { it("Should return empty text value for empty response", async () => { const response = new Response(undefined, status202); const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.isUndefined(responseValue); + assert.isNull(responseValue); }); it("Should return text data for text/plain content-type", async () => { @@ -108,7 +99,8 @@ describe("GraphResponseHandler.ts", () => { const data = "test data"; const response = new Response(data, status200Unknown); const responseValue = await GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue, data); + // TODO - Handle unknown responses + // assert.equal(responseValue, data); }); it("Should return response value as text", async () => { @@ -119,14 +111,6 @@ describe("GraphResponseHandler.ts", () => { assert.equal(responseValue, htmlString); }); - it("Should return response value as text for text/html return type", async () => { - const response = new Response(htmlString, status200); - const responseValue = await GraphResponseHandler["convertResponse"](response, ResponseType.DOCUMENT); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); - }); - it("Should return response value as json", async () => { const json = { test: "test" }; const response = new Response(JSON.stringify(json), status200); diff --git a/test/common/core/HTTPClient.ts b/test/common/core/HTTPClient.ts index 359adfffc..943ab1dc3 100644 --- a/test/common/core/HTTPClient.ts +++ b/test/common/core/HTTPClient.ts @@ -10,7 +10,7 @@ import { assert } from "chai"; import { HTTPClient } from "../../../src/HTTPClient"; import { Context } from "../../../src/IContext"; import { FetchOptions } from "../../../src/IFetchOptions"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; describe("HTTPClient.ts", () => { const httpMessageHandler: DummyHTTPMessageHandler = new DummyHTTPMessageHandler(); @@ -63,7 +63,7 @@ describe("HTTPClient.ts", () => { request: url, }; await httpClient.sendRequest(context); - throw new Error("Something wrong with the context validation"); + throw new Error("Test Failed - Something wrong with the context validation"); } catch (error) { assert.equal(error.name, "InvalidRequestOptions"); } diff --git a/test/common/core/HTTPClientFactory.ts b/test/common/core/HTTPClientFactory.ts index 83649c2e8..5dad7e61f 100644 --- a/test/common/core/HTTPClientFactory.ts +++ b/test/common/core/HTTPClientFactory.ts @@ -9,8 +9,8 @@ import { assert } from "chai"; import { HTTPClient } from "../../../src/HTTPClient"; import { HTTPClientFactory } from "../../../src/HTTPClientFactory"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyAuthenticationProvider } from "../../DummyAuthenticationProvider"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; describe("HTTPClientFactory.ts", () => { /* tslint:disable: no-string-literal */ diff --git a/test/common/core/urlGeneration.ts b/test/common/core/urlGeneration.ts index 74ca64ce6..0672ee6cb 100644 --- a/test/common/core/urlGeneration.ts +++ b/test/common/core/urlGeneration.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { getClient } from "../test-helper"; +import { getClient } from "../../test-helper"; const client = getClient(); const cases = []; diff --git a/test/common/core/urlParsing.ts b/test/common/core/urlParsing.ts index c1241eac4..d779a6554 100644 --- a/test/common/core/urlParsing.ts +++ b/test/common/core/urlParsing.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { getClient } from "../test-helper"; +import { getClient } from "../../test-helper"; const client = getClient(); diff --git a/test/common/middleware/AuthenticationHandler.ts b/test/common/middleware/AuthenticationHandler.ts index 5af6902f5..50f852924 100644 --- a/test/common/middleware/AuthenticationHandler.ts +++ b/test/common/middleware/AuthenticationHandler.ts @@ -8,7 +8,7 @@ import { assert } from "chai"; import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +import { DummyAuthenticationProvider } from "../../DummyAuthenticationProvider"; const dummyAuthProvider = new DummyAuthenticationProvider(); const authHandler = new AuthenticationHandler(dummyAuthProvider); diff --git a/test/common/middleware/AuthenticationHandlerOptions.ts b/test/common/middleware/AuthenticationHandlerOptions.ts index 7403c716e..0a5c1a079 100644 --- a/test/common/middleware/AuthenticationHandlerOptions.ts +++ b/test/common/middleware/AuthenticationHandlerOptions.ts @@ -9,7 +9,7 @@ import { assert } from "chai"; import { AuthenticationHandlerOptions } from "../../../src/middleware/options/AuthenticationHandlerOptions"; import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; +import { DummyAuthenticationProvider } from "../../DummyAuthenticationProvider"; describe("AuthenticationHandlerOptions.ts", () => { const dummyAuthProvider = new DummyAuthenticationProvider(); diff --git a/test/common/middleware/ChaosHandler.ts b/test/common/middleware/ChaosHandler.ts index 78965c632..132463305 100644 --- a/test/common/middleware/ChaosHandler.ts +++ b/test/common/middleware/ChaosHandler.ts @@ -6,7 +6,7 @@ import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; import { RequestMethod } from "../../../src/RequestMethod"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; const chaosHandlerOptions = new ChaosHandlerOptions(); const chaosHandler = new ChaosHandler(); diff --git a/test/common/middleware/MiddlewareControl.ts b/test/common/middleware/MiddlewareControl.ts index 512f272c7..5fdd8ef63 100644 --- a/test/common/middleware/MiddlewareControl.ts +++ b/test/common/middleware/MiddlewareControl.ts @@ -13,7 +13,7 @@ import { assert } from "chai"; import "isomorphic-fetch"; import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { DummyHandlerOptions } from "../DummyHandlerOptions"; +import { DummyHandlerOptions } from "../../DummyHandlerOptions"; describe("MiddlewareControl.ts", () => { const dummyHandlerOption = new DummyHandlerOptions(); diff --git a/test/common/middleware/RedirectHandler.ts b/test/common/middleware/RedirectHandler.ts index d07187389..e554690e9 100644 --- a/test/common/middleware/RedirectHandler.ts +++ b/test/common/middleware/RedirectHandler.ts @@ -11,7 +11,7 @@ import { Context } from "../../../src/IContext"; import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; import { RedirectHandler } from "../../../src/middleware/RedirectHandler"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; const redirectHandlerOptions = new RedirectHandlerOptions(); const redirectHandler = new RedirectHandler(); diff --git a/test/common/middleware/RedirectHandlerOptions.ts b/test/common/middleware/RedirectHandlerOptions.ts index 1db8c263d..01d4341d1 100644 --- a/test/common/middleware/RedirectHandlerOptions.ts +++ b/test/common/middleware/RedirectHandlerOptions.ts @@ -27,7 +27,7 @@ describe("RedirectHandlerOptions.ts", () => { it("Should throw error for setting max redirects more than allowed", () => { try { const options = new RedirectHandlerOptions(100); - throw new Error("Something wrong with the max redirects value redirection"); + throw new Error("Test Failed - Something wrong with the max redirects value redirection"); } catch (error) { assert.equal(error.name, "MaxLimitExceeded"); } @@ -35,7 +35,7 @@ describe("RedirectHandlerOptions.ts", () => { it("Should throw error for setting max redirects to negative", () => { try { const options = new RedirectHandlerOptions(-10); - throw new Error("Something wrong with the max redirects value redirection"); + throw new Error(" Test Failed - Something wrong with the max redirects value redirection"); } catch (error) { assert.equal(error.name, "MinExpectationNotMet"); } diff --git a/test/common/middleware/RetryHandler.ts b/test/common/middleware/RetryHandler.ts index 430ce3ceb..8d3eb2ea3 100644 --- a/test/common/middleware/RetryHandler.ts +++ b/test/common/middleware/RetryHandler.ts @@ -13,7 +13,7 @@ import { FetchOptions } from "../../../src/IFetchOptions"; import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; import { RetryHandlerOptions, ShouldRetry } from "../../../src/middleware/options/RetryHandlerOptions"; import { RetryHandler } from "../../../src/middleware/RetryHandler"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; describe("RetryHandler.ts", function() { this.timeout(20 * 1000); diff --git a/test/common/middleware/RetryHandlerOptions.ts b/test/common/middleware/RetryHandlerOptions.ts index 9449cf372..61ff52827 100644 --- a/test/common/middleware/RetryHandlerOptions.ts +++ b/test/common/middleware/RetryHandlerOptions.ts @@ -26,7 +26,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for both delay and maxRetries are higher than the limit", () => { try { const options = new RetryHandlerOptions(1000, 1000); - throw new Error("Something wrong with the delay and maxRetries max limit validation"); + throw new Error("Test Failed - Something wrong with the delay and maxRetries max limit validation"); } catch (error) { assert.equal(error.name, "MaxLimitExceeded"); } @@ -35,7 +35,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for delay is higher than the limit", () => { try { const options = new RetryHandlerOptions(1000, 2); - throw new Error("Something wrong with the delay max limit validation"); + throw new Error("Test Failed - Test Failed - Something wrong with the delay max limit validation"); } catch (error) { assert.equal(error.name, "MaxLimitExceeded"); } @@ -44,7 +44,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for maxRetries is higher than the limit", () => { try { const options = new RetryHandlerOptions(1, 2000); - throw new Error("Something wrong with the maxRetries max limit validation"); + throw new Error("Test Failed - Something wrong with the maxRetries max limit validation"); } catch (error) { assert.equal(error.name, "MaxLimitExceeded"); } @@ -53,7 +53,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for both delay and maxRetries are negative", () => { try { const options = new RetryHandlerOptions(-1, -100); - throw new Error("Something wrong with the delay and maxRetries max limit validation"); + throw new Error("Test Failed - Something wrong with the delay and maxRetries max limit validation"); } catch (error) { assert.equal(error.name, "MinExpectationNotMet"); } @@ -62,7 +62,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for delay is negative", () => { try { const options = new RetryHandlerOptions(-5, 2); - throw new Error("Something wrong with the delay max limit validation"); + throw new Error("Test Failed - Something wrong with the delay max limit validation"); } catch (error) { assert.equal(error.name, "MinExpectationNotMet"); } @@ -71,7 +71,7 @@ describe("RetryHandlerOptions.ts", () => { it("Should throw error for maxRetries is negative", () => { try { const options = new RetryHandlerOptions(1, -10); - throw new Error("Something wrong with the maxRetries max limit validation"); + throw new Error("Test Failed - Something wrong with the maxRetries max limit validation"); } catch (error) { assert.equal(error.name, "MinExpectationNotMet"); } diff --git a/test/common/middleware/TelemetryHandler.ts b/test/common/middleware/TelemetryHandler.ts index db7ca8090..571000029 100644 --- a/test/common/middleware/TelemetryHandler.ts +++ b/test/common/middleware/TelemetryHandler.ts @@ -12,7 +12,7 @@ import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; import { TelemetryHandler } from "../../../src/middleware/TelemetryHandler"; import { PACKAGE_VERSION } from "../../../src/Version"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; +import { DummyHTTPMessageHandler } from "../../DummyHTTPMessageHandler"; describe("TelemetryHandler.ts", () => { /* tslint:disable: no-string-literal */ diff --git a/test/common/package.json b/test/common/package.json deleted file mode 100644 index 42132b6f8..000000000 --- a/test/common/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "devDependencies": { - "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta", - "@types/chai": "^4.2.14", - "@types/form-data": "^2.2.1", - "@types/isomorphic-fetch": "0.0.35", - "@types/microsoft-graph": "^1.9.0", - "@types/mocha": "^5.2.7", - "@types/node": "^12.0.0", - "chai": "^4.2.0", - "es6-promise": "^4.2.6", - "form-data": "^2.3.3", - "isomorphic-fetch": "^2.2.1", - "mocha": "^8.2.1", - "msal": "^1.0.0", - "node-fetch": "^2.6.1", - "ts-node": "^9.0.0" - } -} diff --git a/test/common/tasks/LargeFileUploadTask.ts b/test/common/tasks/LargeFileUploadTask.ts index 4a9b7023e..5554db8c1 100644 --- a/test/common/tasks/LargeFileUploadTask.ts +++ b/test/common/tasks/LargeFileUploadTask.ts @@ -8,7 +8,7 @@ import { assert } from "chai"; import { LargeFileUploadTask } from "../../../src/tasks/LargeFileUploadTask"; -import { getClient } from "../test-helper"; +import { getClient } from "../../test-helper"; describe("LargeFileUploadTask.ts", () => { /* tslint:disable: no-string-literal */ @@ -168,7 +168,7 @@ describe("LargeFileUploadTask.ts", () => { uploadTask .upload() .then((res) => { - throw new Error("Upload is working for upload completed task"); + throw new Error("Test Failed - Upload is working for upload completed task"); }) .catch((err) => { assert.equal(err.name, "Invalid Session"); diff --git a/test/common/tasks/PageIterator.ts b/test/common/tasks/PageIterator.ts index fe09d4973..4cd871ef5 100644 --- a/test/common/tasks/PageIterator.ts +++ b/test/common/tasks/PageIterator.ts @@ -9,7 +9,7 @@ import { assert } from "chai"; import { Client } from "../../../src/index"; import { PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; -import { getClient } from "../test-helper"; +import { getClient } from "../../test-helper"; const client: Client = getClient(); diff --git a/test/common/test-helper.ts b/test/common/test-helper.ts deleted file mode 100644 index 2521b7ab8..000000000 --- a/test/common/test-helper.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import "isomorphic-fetch"; - -import { Client } from "../../src/index"; - -import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; - -export function getClient(): Client { - return Client.initWithMiddleware({ - authProvider: new DummyAuthenticationProvider(), - }); -} - -export function randomString() { - return Math.random() - .toString(36) - .substring(7); -} diff --git a/test/dist/es/src/Client.d.ts b/test/dist/es/src/Client.d.ts deleted file mode 100644 index a3416cd59..000000000 --- a/test/dist/es/src/Client.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { GraphRequest } from "./GraphRequest"; -import { ClientOptions } from "./IClientOptions"; -import { Options } from "./IOptions"; -export declare class Client { - /** - * @private - * A member which stores the Client instance options - */ - private config; - /** - * @private - * A member which holds the HTTPClient instance - */ - private httpClient; - /** - * @public - * @static - * To create a client instance with options and initializes the default middleware chain - * @param {Options} options - The options for client instance - * @returns The Client instance - */ - static init(options: Options): Client; - /** - * @public - * @static - * To create a client instance with the Client Options - * @param {ClientOptions} clientOptions - The options object for initializing the client - * @returns The Client instance - */ - static initWithMiddleware(clientOptions: ClientOptions): Client; - /** - * @private - * @constructor - * Creates an instance of Client - * @param {ClientOptions} clientOptions - The options to instantiate the client object - */ - private constructor(); - /** - * @public - * Entry point to make requests - * @param {string} path - The path string value - * @returns The graph request instance - */ - api(path: string): GraphRequest; -} diff --git a/test/dist/es/src/Client.js b/test/dist/es/src/Client.js deleted file mode 100644 index d4b0e471e..000000000 --- a/test/dist/es/src/Client.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Client - */ -import { GRAPH_API_VERSION, GRAPH_BASE_URL } from "./Constants"; -import { CustomAuthenticationProvider } from "./CustomAuthenticationProvider"; -import { GraphRequest } from "./GraphRequest"; -import { HTTPClient } from "./HTTPClient"; -import { HTTPClientFactory } from "./HTTPClientFactory"; -import { validatePolyFilling } from "./ValidatePolyFilling"; -export class Client { - /** - * @private - * @constructor - * Creates an instance of Client - * @param {ClientOptions} clientOptions - The options to instantiate the client object - */ - constructor(clientOptions) { - /** - * @private - * A member which stores the Client instance options - */ - this.config = { - baseUrl: GRAPH_BASE_URL, - debugLogging: false, - defaultVersion: GRAPH_API_VERSION, - }; - try { - validatePolyFilling(); - } catch (error) { - throw error; - } - for (const key in clientOptions) { - if (clientOptions.hasOwnProperty(key)) { - this.config[key] = clientOptions[key]; - } - } - let httpClient; - if (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) { - const error = new Error(); - error.name = "AmbiguityInInitialization"; - error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both"; - throw error; - } else if (clientOptions.authProvider !== undefined) { - httpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider); - } else if (clientOptions.middleware !== undefined) { - httpClient = new HTTPClient(...[].concat(clientOptions.middleware)); - } else { - const error = new Error(); - error.name = "InvalidMiddlewareChain"; - error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain"; - throw error; - } - this.httpClient = httpClient; - } - /** - * @public - * @static - * To create a client instance with options and initializes the default middleware chain - * @param {Options} options - The options for client instance - * @returns The Client instance - */ - static init(options) { - const clientOptions = {}; - for (const i in options) { - if (options.hasOwnProperty(i)) { - clientOptions[i] = i === "authProvider" ? new CustomAuthenticationProvider(options[i]) : options[i]; - } - } - return Client.initWithMiddleware(clientOptions); - } - /** - * @public - * @static - * To create a client instance with the Client Options - * @param {ClientOptions} clientOptions - The options object for initializing the client - * @returns The Client instance - */ - static initWithMiddleware(clientOptions) { - try { - return new Client(clientOptions); - } catch (error) { - throw error; - } - } - /** - * @public - * Entry point to make requests - * @param {string} path - The path string value - * @returns The graph request instance - */ - api(path) { - return new GraphRequest(this.httpClient, this.config, path); - } -} -//# sourceMappingURL=Client.js.map diff --git a/test/dist/es/src/Client.js.map b/test/dist/es/src/Client.js.map deleted file mode 100644 index 7f8a51acc..000000000 --- a/test/dist/es/src/Client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../../src/Client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,MAAM;IAiDlB;;;;;OAKG;IACH,YAAoB,aAA4B;QAtDhD;;;WAGG;QACK,WAAM,GAAkB;YAC/B,OAAO,EAAE,cAAc;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;QACxC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE;YACxB,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;gBAC9B,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aACpG;SACD;QACD,OAAO,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,kBAAkB,CAAC,aAA4B;QAC5D,IAAI;YACH,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;SACjC;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,KAAK,CAAC;SACZ;IACF,CAAC;IAsCD;;;;;OAKG;IACI,GAAG,CAAC,IAAY;QACtB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/Constants.d.ts b/test/dist/es/src/Constants.d.ts deleted file mode 100644 index ebb3031a9..000000000 --- a/test/dist/es/src/Constants.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Constants - */ -/** - * @constant - * A Default API endpoint version for a request - */ -export declare const GRAPH_API_VERSION = "v1.0"; -/** - * @constant - * A Default base url for a request - */ -export declare const GRAPH_BASE_URL = "https://graph.microsoft.com/"; diff --git a/test/dist/es/src/Constants.js b/test/dist/es/src/Constants.js deleted file mode 100644 index 709dba82d..000000000 --- a/test/dist/es/src/Constants.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Constants - */ -/** - * @constant - * A Default API endpoint version for a request - */ -export const GRAPH_API_VERSION = "v1.0"; -/** - * @constant - * A Default base url for a request - */ -export const GRAPH_BASE_URL = "https://graph.microsoft.com/"; -//# sourceMappingURL=Constants.js.map diff --git a/test/dist/es/src/Constants.js.map b/test/dist/es/src/Constants.js.map deleted file mode 100644 index 5bdd957b9..000000000 --- a/test/dist/es/src/Constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,8BAA8B,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/CustomAuthenticationProvider.d.ts b/test/dist/es/src/CustomAuthenticationProvider.d.ts deleted file mode 100644 index e0f325025..000000000 --- a/test/dist/es/src/CustomAuthenticationProvider.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module CustomAuthenticationProvider - */ -import { AuthenticationProvider } from "./IAuthenticationProvider"; -import { AuthProvider } from "./IAuthProvider"; -/** - * @class - * Class representing CustomAuthenticationProvider - * @extends AuthenticationProvider - */ -export declare class CustomAuthenticationProvider implements AuthenticationProvider { - /** - * @private - * A member to hold authProvider callback - */ - private provider; - /** - * @public - * @constructor - * Creates an instance of CustomAuthenticationProvider - * @param {AuthProviderCallback} provider - An authProvider function - * @returns An instance of CustomAuthenticationProvider - */ - constructor(provider: AuthProvider); - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken(): Promise; -} diff --git a/test/dist/es/src/CustomAuthenticationProvider.js b/test/dist/es/src/CustomAuthenticationProvider.js deleted file mode 100644 index c43855a7b..000000000 --- a/test/dist/es/src/CustomAuthenticationProvider.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * Class representing CustomAuthenticationProvider - * @extends AuthenticationProvider - */ -export class CustomAuthenticationProvider { - /** - * @public - * @constructor - * Creates an instance of CustomAuthenticationProvider - * @param {AuthProviderCallback} provider - An authProvider function - * @returns An instance of CustomAuthenticationProvider - */ - constructor(provider) { - this.provider = provider; - } - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - return new Promise((resolve, reject) => { - this.provider((error, accessToken) => { - if (accessToken) { - resolve(accessToken); - } else { - reject(error); - } - }); - }); - }); - } -} -//# sourceMappingURL=CustomAuthenticationProvider.js.map diff --git a/test/dist/es/src/CustomAuthenticationProvider.js.map b/test/dist/es/src/CustomAuthenticationProvider.js.map deleted file mode 100644 index f263e874f..000000000 --- a/test/dist/es/src/CustomAuthenticationProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"CustomAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/CustomAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAOxC;;;;;;OAMG;IACH,YAAmB,QAAsB;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACU,cAAc;;YAC1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAsC,EAAE,MAA4B,EAAE,EAAE;gBAC3F,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAU,EAAE,WAA0B,EAAE,EAAE;oBACxD,IAAI,WAAW,EAAE;wBAChB,OAAO,CAAC,WAAW,CAAC,CAAC;qBACrB;yBAAM;wBACN,MAAM,CAAC,KAAK,CAAC,CAAC;qBACd;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphError.d.ts b/test/dist/es/src/GraphError.d.ts deleted file mode 100644 index 735afeb09..000000000 --- a/test/dist/es/src/GraphError.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphError - */ -/** - * @class - * Class for GraphError - * @NOTE: This is NOT what is returned from the Graph - * GraphError is created from parsing JSON errors returned from the graph - * Some fields are renamed ie, "request-id" => requestId so you can use dot notation - */ -export declare class GraphError extends Error { - /** - * @public - * A member holding status code of the error - */ - statusCode: number; - /** - * @public - * A member holding code i.e name of the error - */ - code: string | null; - /** - * @public - * A member holding request-id i.e identifier of the request - */ - requestId: string | null; - /** - * @public - * A member holding processed date and time of the request - */ - date: Date; - /** - * @public - * A member holding original error response by the graph service - */ - body: any; - /** - * @public - * @constructor - * Creates an instance of GraphError - * @param {number} [statusCode = -1] - The status code of the error - * @returns An instance of GraphError - */ - constructor(statusCode?: number, message?: string, baseError?: Error); -} diff --git a/test/dist/es/src/GraphError.js b/test/dist/es/src/GraphError.js deleted file mode 100644 index 787e68808..000000000 --- a/test/dist/es/src/GraphError.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphError - */ -/** - * @class - * Class for GraphError - * @NOTE: This is NOT what is returned from the Graph - * GraphError is created from parsing JSON errors returned from the graph - * Some fields are renamed ie, "request-id" => requestId so you can use dot notation - */ -export class GraphError extends Error { - /** - * @public - * @constructor - * Creates an instance of GraphError - * @param {number} [statusCode = -1] - The status code of the error - * @returns An instance of GraphError - */ - constructor(statusCode = -1, message, baseError) { - super(message || (baseError && baseError.message)); - this.statusCode = statusCode; - this.code = null; - this.requestId = null; - this.date = new Date(); - this.body = null; - this.stack = baseError ? baseError.stack : this.stack; - } -} -//# sourceMappingURL=GraphError.js.map diff --git a/test/dist/es/src/GraphError.js.map b/test/dist/es/src/GraphError.js.map deleted file mode 100644 index 22d35f7ec..000000000 --- a/test/dist/es/src/GraphError.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphError.js","sourceRoot":"","sources":["../../../../src/GraphError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH,MAAM,OAAO,UAAW,SAAQ,KAAK;IA+BpC;;;;;;OAMG;IACH,YAAmB,aAAqB,CAAC,CAAC,EAAE,OAAgB,EAAE,SAAiB;QAC9E,KAAK,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACvD,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphErrorHandler.d.ts b/test/dist/es/src/GraphErrorHandler.d.ts deleted file mode 100644 index 2814f6506..000000000 --- a/test/dist/es/src/GraphErrorHandler.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphErrorHandler - */ -import { GraphError } from "./GraphError"; -import { GraphRequestCallback } from "./IGraphRequestCallback"; -/** - * @class - * Class for GraphErrorHandler - */ -export declare class GraphErrorHandler { - /** - * @private - * @static - * Populates the GraphError instance with Error instance values - * @param {Error} error - The error returned by graph service or some native error - * @param {number} [statusCode] - The status code of the response - * @returns The GraphError instance - */ - private static constructError; - /** - * @private - * @static - * @async - * Populates the GraphError instance from the Error returned by graph service - * @param {any} error - The error returned by graph service or some native error - * @param {number} statusCode - The status code of the response - * @returns A promise that resolves to GraphError instance - * - * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo - * { - * "error": { - * "code": "SearchEvents", - * "message": "The parameter $search is not currently supported on the Events resource.", - * "innerError": { - * "request-id": "b31c83fd-944c-4663-aa50-5d9ceb367e19", - * "date": "2016-11-17T18:37:45" - * } - * } - * } - */ - private static constructErrorFromResponse; - /** - * @public - * @static - * @async - * To get the GraphError object - * @param {any} [error = null] - The error returned by graph service or some native error - * @param {number} [statusCode = -1] - The status code of the response - * @param {GraphRequestCallback} [callback] - The graph request callback function - * @returns A promise that resolves to GraphError instance - */ - static getError(error?: any, statusCode?: number, callback?: GraphRequestCallback): Promise; -} diff --git a/test/dist/es/src/GraphErrorHandler.js b/test/dist/es/src/GraphErrorHandler.js deleted file mode 100644 index fc760594c..000000000 --- a/test/dist/es/src/GraphErrorHandler.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @module GraphErrorHandler - */ -import { GraphError } from "./GraphError"; -/** - * @class - * Class for GraphErrorHandler - */ -export class GraphErrorHandler { - /** - * @private - * @static - * Populates the GraphError instance with Error instance values - * @param {Error} error - The error returned by graph service or some native error - * @param {number} [statusCode] - The status code of the response - * @returns The GraphError instance - */ - static constructError(error, statusCode) { - const gError = new GraphError(statusCode, "", error); - if (error.name !== undefined) { - gError.code = error.name; - } - gError.body = error.toString(); - gError.date = new Date(); - return gError; - } - /** - * @private - * @static - * @async - * Populates the GraphError instance from the Error returned by graph service - * @param {any} error - The error returned by graph service or some native error - * @param {number} statusCode - The status code of the response - * @returns A promise that resolves to GraphError instance - * - * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo - * { - * "error": { - * "code": "SearchEvents", - * "message": "The parameter $search is not currently supported on the Events resource.", - * "innerError": { - * "request-id": "b31c83fd-944c-4663-aa50-5d9ceb367e19", - * "date": "2016-11-17T18:37:45" - * } - * } - * } - */ - static constructErrorFromResponse(error, statusCode) { - error = error.error; - const gError = new GraphError(statusCode, error.message); - gError.code = error.code; - if (error.innerError !== undefined) { - gError.requestId = error.innerError["request-id"]; - gError.date = new Date(error.innerError.date); - } - try { - gError.body = JSON.stringify(error); - } catch (error) { - // tslint:disable-line: no-empty - } - return gError; - } - /** - * @public - * @static - * @async - * To get the GraphError object - * @param {any} [error = null] - The error returned by graph service or some native error - * @param {number} [statusCode = -1] - The status code of the response - * @param {GraphRequestCallback} [callback] - The graph request callback function - * @returns A promise that resolves to GraphError instance - */ - static getError(error = null, statusCode = -1, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - let gError; - if (error && error.error) { - gError = GraphErrorHandler.constructErrorFromResponse(error, statusCode); - } else if (typeof Error !== "undefined" && error instanceof Error) { - gError = GraphErrorHandler.constructError(error, statusCode); - } else { - gError = new GraphError(statusCode); - } - if (typeof callback === "function") { - callback(gError, null); - } else { - return gError; - } - }); - } -} -//# sourceMappingURL=GraphErrorHandler.js.map diff --git a/test/dist/es/src/GraphErrorHandler.js.map b/test/dist/es/src/GraphErrorHandler.js.map deleted file mode 100644 index 1f8bd0fb5..000000000 --- a/test/dist/es/src/GraphErrorHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphErrorHandler.js","sourceRoot":"","sources":["../../../../src/GraphErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;GAGG;AAEH,MAAM,OAAO,iBAAiB;IAC7B;;;;;;;OAOG;IACK,MAAM,CAAC,cAAc,CAAC,KAAY,EAAE,UAAmB;QAC9D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC7B,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;SACzB;QACD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACK,MAAM,CAAC,0BAA0B,CAAC,KAAU,EAAE,UAAkB;QACvE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACzB,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;YACnC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC9C;QACD,IAAI;YACH,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACpC;QAAC,OAAO,KAAK,EAAE;YACf,gCAAgC;SAChC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAO,QAAQ,CAAC,QAAa,IAAI,EAAE,aAAqB,CAAC,CAAC,EAAE,QAA+B;;YACvG,IAAI,MAAkB,CAAC;YACvB,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE;gBACzB,MAAM,GAAG,iBAAiB,CAAC,0BAA0B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aACzE;iBAAM,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,YAAY,KAAK,EAAE;gBAClE,MAAM,GAAG,iBAAiB,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;aAC7D;iBAAM;gBACN,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;aACpC;YACD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;gBACnC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACvB;iBAAM;gBACN,OAAO,MAAM,CAAC;aACd;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphRequest.d.ts b/test/dist/es/src/GraphRequest.d.ts deleted file mode 100644 index 464d527ce..000000000 --- a/test/dist/es/src/GraphRequest.d.ts +++ /dev/null @@ -1,378 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { HTTPClient } from "./HTTPClient"; -import { ClientOptions } from "./IClientOptions"; -import { GraphRequestCallback } from "./IGraphRequestCallback"; -import { MiddlewareOptions } from "./middleware/options/IMiddlewareOptions"; -import { ResponseType } from "./ResponseType"; -/** - * @interface - * Signature to representing key value pairs - * @property {[key: string] : string | number} - The Key value pair - */ -interface KeyValuePairObjectStringNumber { - [key: string]: string | number; -} -/** - * @interface - * Signature to define URL components - * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS - * - * @property {string} host - The host to which the request needs to be made - * @property {string} version - Version of the graph endpoint - * @property {string} [path] - The path of the resource request - * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params - * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request - * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif' - */ -export interface URLComponents { - host: string; - version: string; - path?: string; - oDataQueryParams: KeyValuePairObjectStringNumber; - otherURLQueryParams: KeyValuePairObjectStringNumber; - otherURLQueryOptions?: string[]; -} -/** - * @class - * A Class representing GraphRequest - */ -export declare class GraphRequest { - /** - * @private - * A member variable to hold HTTPClient instance - */ - private httpClient; - /** - * @private - * A member variable to hold client options - */ - private config; - /** - * @private - * A member to hold URL Components data - */ - private urlComponents; - /** - * @private - * A member to hold custom header options for a request - */ - private _headers; - /** - * @private - * A member to hold custom options for a request - */ - private _options; - /** - * @private - * A member to hold the array of middleware options for a request - */ - private _middlewareOptions; - /** - * @private - * A member to hold custom response type for a request - */ - private _responseType; - /** - * @public - * @constructor - * Creates an instance of GraphRequest - * @param {HTTPClient} httpClient - The HTTPClient instance - * @param {ClientOptions} config - The options for making request - * @param {string} path - A path string - */ - constructor(httpClient: HTTPClient, config: ClientOptions, path: string); - /** - * @private - * Parses the path string and creates URLComponents out of it - * @param {string} path - The request path string - * @returns Nothing - */ - private parsePath; - /** - * @private - * Adds the query parameter as comma separated values - * @param {string} propertyName - The name of a property - * @param {string|string[]} propertyValue - The vale of a property - * @param {IArguments} additionalProperties - The additional properties - * @returns Nothing - */ - private addCsvQueryParameter; - /** - * @private - * Builds the full url from the URLComponents to make a request - * @returns The URL string that is qualified to make a request to graph endpoint - */ - private buildFullUrl; - /** - * @private - * Builds the query string from the URLComponents - * @returns The Constructed query string - */ - private createQueryString; - /** - * @private - * Parses the query parameters to set the urlComponents property of the GraphRequest object - * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter - * @returns The same GraphRequest instance that is being called with - */ - private parseQueryParameter; - /** - * @private - * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object - * @param {string} queryParameter - the query parameters - * returns nothing - */ - private parseQueryParamenterString; - /** - * @private - * Sets values into the urlComponents property of GraphRequest object. - * @param {string} paramKey - the query parameter key - * @param {string} paramValue - the query paramter value - * @returns nothing - */ - private setURLComponentsQueryParamater; - /** - * @private - * Check if the query parameter string has a valid key-value structure - * @param {string} queryString - the query parameter string. Example -> "name=value" - * #returns true if the query string has a valid key-value structure else false - */ - private isValidQueryKeyValuePair; - /** - * @private - * Updates the custom headers and options for a request - * @param {FetchOptions} options - The request options object - * @returns Nothing - */ - private updateRequestOptions; - /** - * @private - * @async - * Adds the custom headers and options to the request and makes the HTTPClient send request call - * @param {RequestInfo} request - The request url string or the Request object value - * @param {FetchOptions} options - The options to make a request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the response content - */ - private send; - /** - * @private - * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json - * @param none - * @returns nothing - */ - private setHeaderContentType; - /** - * @public - * Sets the custom header for a request - * @param {string} headerKey - A header key - * @param {string} headerValue - A header value - * @returns The same GraphRequest instance that is being called with - */ - header(headerKey: string, headerValue: string): GraphRequest; - /** - * @public - * Sets the custom headers for a request - * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers - * @returns The same GraphRequest instance that is being called with - */ - headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest; - /** - * @public - * Sets the option for making a request - * @param {string} key - The key value - * @param {any} value - The value - * @returns The same GraphRequest instance that is being called with - */ - option(key: string, value: any): GraphRequest; - /** - * @public - * Sets the options for making a request - * @param {{ [key: string]: any }} options - The options key value pair - * @returns The same GraphRequest instance that is being called with - */ - options(options: { [key: string]: any }): GraphRequest; - /** - * @public - * Sets the middleware options for a request - * @param {MiddlewareOptions[]} options - The array of middleware options - * @returns The same GraphRequest instance that is being called with - */ - middlewareOptions(options: MiddlewareOptions[]): GraphRequest; - /** - * @public - * Sets the api endpoint version for a request - * @param {string} version - The version value - * @returns The same GraphRequest instance that is being called with - */ - version(version: string): GraphRequest; - /** - * @public - * Sets the api endpoint version for a request - * @param {ResponseType} responseType - The response type value - * @returns The same GraphRequest instance that is being called with - */ - responseType(responseType: ResponseType): GraphRequest; - /** - * @public - * To add properties for select OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query - */ - select(properties: string | string[]): GraphRequest; - /** - * @public - * To add properties for expand OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query - */ - expand(properties: string | string[]): GraphRequest; - /** - * @public - * To add properties for orderby OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query - */ - orderby(properties: string | string[]): GraphRequest; - /** - * @public - * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string. - * @param {string} filterStr - The filter query string - * @returns The same GraphRequest instance that is being called with, after adding the $filter query - */ - filter(filterStr: string): GraphRequest; - /** - * @public - * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string. - * @param {string} searchStr - The search criterion string - * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria - */ - search(searchStr: string): GraphRequest; - /** - * @public - * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value. - * @param {number} n - The number value - * @returns The same GraphRequest instance that is being called with, after adding the number for $top query - */ - top(n: number): GraphRequest; - /** - * @public - * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value. - * @param {number} n - The number value - * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query - */ - skip(n: number): GraphRequest; - /** - * @public - * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value. - * @param {string} token - The token value - * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option - */ - skipToken(token: string): GraphRequest; - /** - * @public - * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value. - * @param {boolean} isCount - The count boolean - * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option - */ - count(isCount?: boolean): GraphRequest; - /** - * @public - * Appends query string to the urlComponent - * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value - * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component - */ - query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest; - /** - * @public - * @async - * Makes a http request with GET method - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the get response - */ - get(callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes a http request with POST method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the post response - */ - post(content: any, callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Alias for Post request call - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the post response - */ - create(content: any, callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes http request with PUT method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the put response - */ - put(content: any, callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes http request with PATCH method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the patch response - */ - patch(content: any, callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Alias for PATCH request - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the patch response - */ - update(content: any, callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes http request with DELETE method - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the delete response - */ - delete(callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Alias for delete request call - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the delete response - */ - del(callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes a http request with GET method to read response as a stream. - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the getStream response - */ - getStream(callback?: GraphRequestCallback): Promise; - /** - * @public - * @async - * Makes a http request with GET method to read response as a stream. - * @param {any} stream - The stream instance - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the putStream response - */ - putStream(stream: any, callback?: GraphRequestCallback): Promise; -} -export {}; diff --git a/test/dist/es/src/GraphRequest.js b/test/dist/es/src/GraphRequest.js deleted file mode 100644 index 22e1c4109..000000000 --- a/test/dist/es/src/GraphRequest.js +++ /dev/null @@ -1,716 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { GraphErrorHandler } from "./GraphErrorHandler"; -import { oDataQueryNames, serializeContent, urlJoin } from "./GraphRequestUtil"; -import { GraphResponseHandler } from "./GraphResponseHandler"; -import { MiddlewareControl } from "./middleware/MiddlewareControl"; -import { RequestMethod } from "./RequestMethod"; -import { ResponseType } from "./ResponseType"; -/** - * @class - * A Class representing GraphRequest - */ -export class GraphRequest { - /* tslint:enable: variable-name */ - /** - * @public - * @constructor - * Creates an instance of GraphRequest - * @param {HTTPClient} httpClient - The HTTPClient instance - * @param {ClientOptions} config - The options for making request - * @param {string} path - A path string - */ - constructor(httpClient, config, path) { - /** - * @private - * Parses the path string and creates URLComponents out of it - * @param {string} path - The request path string - * @returns Nothing - */ - this.parsePath = (path) => { - // Strips out the base of the url if they passed in - if (path.indexOf("https://") !== -1) { - path = path.replace("https://", ""); - // Find where the host ends - const endOfHostStrPos = path.indexOf("/"); - if (endOfHostStrPos !== -1) { - // Parse out the host - this.urlComponents.host = "https://" + path.substring(0, endOfHostStrPos); - // Strip the host from path - path = path.substring(endOfHostStrPos + 1, path.length); - } - // Remove the following version - const endOfVersionStrPos = path.indexOf("/"); - if (endOfVersionStrPos !== -1) { - // Parse out the version - this.urlComponents.version = path.substring(0, endOfVersionStrPos); - // Strip version from path - path = path.substring(endOfVersionStrPos + 1, path.length); - } - } - // Strip out any leading "/" - if (path.charAt(0) === "/") { - path = path.substr(1); - } - const queryStrPos = path.indexOf("?"); - if (queryStrPos === -1) { - // No query string - this.urlComponents.path = path; - } else { - this.urlComponents.path = path.substr(0, queryStrPos); - // Capture query string into oDataQueryParams and otherURLQueryParams - const queryParams = path.substring(queryStrPos + 1, path.length).split("&"); - for (const queryParam of queryParams) { - this.parseQueryParameter(queryParam); - } - } - }; - this.httpClient = httpClient; - this.config = config; - this.urlComponents = { - host: this.config.baseUrl, - version: this.config.defaultVersion, - oDataQueryParams: {}, - otherURLQueryParams: {}, - otherURLQueryOptions: [], - }; - this._headers = {}; - this._options = {}; - this._middlewareOptions = []; - this.parsePath(path); - } - /** - * @private - * Adds the query parameter as comma separated values - * @param {string} propertyName - The name of a property - * @param {string|string[]} propertyValue - The vale of a property - * @param {IArguments} additionalProperties - The additional properties - * @returns Nothing - */ - addCsvQueryParameter(propertyName, propertyValue, additionalProperties) { - // If there are already $propertyName value there, append a "," - this.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + "," : ""; - let allValues = []; - if (additionalProperties.length > 1 && typeof propertyValue === "string") { - allValues = Array.prototype.slice.call(additionalProperties); - } else if (typeof propertyValue === "string") { - allValues.push(propertyValue); - } else { - allValues = allValues.concat(propertyValue); - } - this.urlComponents.oDataQueryParams[propertyName] += allValues.join(","); - } - /** - * @private - * Builds the full url from the URLComponents to make a request - * @returns The URL string that is qualified to make a request to graph endpoint - */ - buildFullUrl() { - const url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString(); - if (this.config.debugLogging) { - console.log(url); // tslint:disable-line: no-console - } - return url; - } - /** - * @private - * Builds the query string from the URLComponents - * @returns The Constructed query string - */ - createQueryString() { - // Combining query params from oDataQueryParams and otherURLQueryParams - const urlComponents = this.urlComponents; - const query = []; - if (Object.keys(urlComponents.oDataQueryParams).length !== 0) { - for (const property in urlComponents.oDataQueryParams) { - if (urlComponents.oDataQueryParams.hasOwnProperty(property)) { - query.push(property + "=" + urlComponents.oDataQueryParams[property]); - } - } - } - if (Object.keys(urlComponents.otherURLQueryParams).length !== 0) { - for (const property in urlComponents.otherURLQueryParams) { - if (urlComponents.otherURLQueryParams.hasOwnProperty(property)) { - query.push(property + "=" + urlComponents.otherURLQueryParams[property]); - } - } - } - if (urlComponents.otherURLQueryOptions.length !== 0) { - for (const str of urlComponents.otherURLQueryOptions) { - query.push(str); - } - } - return query.length > 0 ? "?" + query.join("&") : ""; - } - /** - * @private - * Parses the query parameters to set the urlComponents property of the GraphRequest object - * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter - * @returns The same GraphRequest instance that is being called with - */ - parseQueryParameter(queryDictionaryOrString) { - if (typeof queryDictionaryOrString === "string") { - if (queryDictionaryOrString.charAt(0) === "?") { - queryDictionaryOrString = queryDictionaryOrString.substring(1); - } - if (queryDictionaryOrString.indexOf("&") !== -1) { - const queryParams = queryDictionaryOrString.split("&"); - for (const str of queryParams) { - this.parseQueryParamenterString(str); - } - } else { - this.parseQueryParamenterString(queryDictionaryOrString); - } - } else if (queryDictionaryOrString.constructor === Object) { - for (const key in queryDictionaryOrString) { - if (queryDictionaryOrString.hasOwnProperty(key)) { - this.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]); - } - } - } - return this; - } - /** - * @private - * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object - * @param {string} queryParameter - the query parameters - * returns nothing - */ - parseQueryParamenterString(queryParameter) { - /* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters. - Example-> "/me?$expand=home($select=city)" */ - if (this.isValidQueryKeyValuePair(queryParameter)) { - const indexOfFirstEquals = queryParameter.indexOf("="); - const paramKey = queryParameter.substring(0, indexOfFirstEquals); - const paramValue = queryParameter.substring(indexOfFirstEquals + 1); - this.setURLComponentsQueryParamater(paramKey, paramValue); - } else { - /* Push values which are not of key-value structure. - Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/ - this.urlComponents.otherURLQueryOptions.push(queryParameter); - } - } - /** - * @private - * Sets values into the urlComponents property of GraphRequest object. - * @param {string} paramKey - the query parameter key - * @param {string} paramValue - the query paramter value - * @returns nothing - */ - setURLComponentsQueryParamater(paramKey, paramValue) { - if (oDataQueryNames.indexOf(paramKey) !== -1) { - const currentValue = this.urlComponents.oDataQueryParams[paramKey]; - const isValueAppendable = currentValue && (paramKey === "$expand" || paramKey === "$select" || paramKey === "$orderby"); - this.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + "," + paramValue : paramValue; - } else { - this.urlComponents.otherURLQueryParams[paramKey] = paramValue; - } - } - /** - * @private - * Check if the query parameter string has a valid key-value structure - * @param {string} queryString - the query parameter string. Example -> "name=value" - * #returns true if the query string has a valid key-value structure else false - */ - isValidQueryKeyValuePair(queryString) { - const indexofFirstEquals = queryString.indexOf("="); - if (indexofFirstEquals === -1) { - return false; - } - const indexofOpeningParanthesis = queryString.indexOf("("); - if (indexofOpeningParanthesis !== -1 && queryString.indexOf("(") < indexofFirstEquals) { - // Example -> .query($select($expand=true)); - return false; - } - return true; - } - /** - * @private - * Updates the custom headers and options for a request - * @param {FetchOptions} options - The request options object - * @returns Nothing - */ - updateRequestOptions(options) { - const optionsHeaders = Object.assign({}, options.headers); - if (this.config.fetchOptions !== undefined) { - const fetchOptions = Object.assign({}, this.config.fetchOptions); - Object.assign(options, fetchOptions); - if (typeof this.config.fetchOptions.headers !== undefined) { - options.headers = Object.assign({}, this.config.fetchOptions.headers); - } - } - Object.assign(options, this._options); - if (options.headers !== undefined) { - Object.assign(optionsHeaders, options.headers); - } - Object.assign(optionsHeaders, this._headers); - options.headers = optionsHeaders; - } - /** - * @private - * @async - * Adds the custom headers and options to the request and makes the HTTPClient send request call - * @param {RequestInfo} request - The request url string or the Request object value - * @param {FetchOptions} options - The options to make a request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the response content - */ - send(request, options, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - let rawResponse; - const middlewareControl = new MiddlewareControl(this._middlewareOptions); - this.updateRequestOptions(options); - try { - const context = yield this.httpClient.sendRequest({ - request, - options, - middlewareControl, - }); - rawResponse = context.response; - const response = yield GraphResponseHandler.getResponse(rawResponse, this._responseType, callback); - return response; - } catch (error) { - let statusCode; - if (typeof rawResponse !== "undefined") { - statusCode = rawResponse.status; - } - const gError = yield GraphErrorHandler.getError(error, statusCode, callback); - throw gError; - } - }); - } - /** - * @private - * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json - * @param none - * @returns nothing - */ - setHeaderContentType() { - if (!this._headers) { - this.header("Content-Type", "application/json"); - return; - } - const headerKeys = Object.keys(this._headers); - for (const headerKey of headerKeys) { - if (headerKey.toLowerCase() === "content-type") { - return; - } - } - // Default the content-type to application/json in case the content-type is not present in the header - this.header("Content-Type", "application/json"); - } - /** - * @public - * Sets the custom header for a request - * @param {string} headerKey - A header key - * @param {string} headerValue - A header value - * @returns The same GraphRequest instance that is being called with - */ - header(headerKey, headerValue) { - this._headers[headerKey] = headerValue; - return this; - } - /** - * @public - * Sets the custom headers for a request - * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers - * @returns The same GraphRequest instance that is being called with - */ - headers(headers) { - for (const key in headers) { - if (headers.hasOwnProperty(key)) { - this._headers[key] = headers[key]; - } - } - return this; - } - /** - * @public - * Sets the option for making a request - * @param {string} key - The key value - * @param {any} value - The value - * @returns The same GraphRequest instance that is being called with - */ - option(key, value) { - this._options[key] = value; - return this; - } - /** - * @public - * Sets the options for making a request - * @param {{ [key: string]: any }} options - The options key value pair - * @returns The same GraphRequest instance that is being called with - */ - options(options) { - for (const key in options) { - if (options.hasOwnProperty(key)) { - this._options[key] = options[key]; - } - } - return this; - } - /** - * @public - * Sets the middleware options for a request - * @param {MiddlewareOptions[]} options - The array of middleware options - * @returns The same GraphRequest instance that is being called with - */ - middlewareOptions(options) { - this._middlewareOptions = options; - return this; - } - /** - * @public - * Sets the api endpoint version for a request - * @param {string} version - The version value - * @returns The same GraphRequest instance that is being called with - */ - version(version) { - this.urlComponents.version = version; - return this; - } - /** - * @public - * Sets the api endpoint version for a request - * @param {ResponseType} responseType - The response type value - * @returns The same GraphRequest instance that is being called with - */ - responseType(responseType) { - this._responseType = responseType; - return this; - } - /** - * @public - * To add properties for select OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query - */ - /* - * Accepts .select("displayName,birthday") - * and .select(["displayName", "birthday"]) - * and .select("displayName", "birthday") - * - */ - select(properties) { - this.addCsvQueryParameter("$select", properties, arguments); - return this; - } - /** - * @public - * To add properties for expand OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query - */ - expand(properties) { - this.addCsvQueryParameter("$expand", properties, arguments); - return this; - } - /** - * @public - * To add properties for orderby OData Query param - * @param {string|string[]} properties - The Properties value - * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query - */ - orderby(properties) { - this.addCsvQueryParameter("$orderby", properties, arguments); - return this; - } - /** - * @public - * To add query string for filter OData Query param. The request URL accepts only one $filter Odata Query option and its value is set to the most recently passed filter query string. - * @param {string} filterStr - The filter query string - * @returns The same GraphRequest instance that is being called with, after adding the $filter query - */ - filter(filterStr) { - this.urlComponents.oDataQueryParams.$filter = filterStr; - return this; - } - /** - * @public - * To add criterion for search OData Query param. The request URL accepts only one $search Odata Query option and its value is set to the most recently passed search criterion string. - * @param {string} searchStr - The search criterion string - * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria - */ - search(searchStr) { - this.urlComponents.oDataQueryParams.$search = searchStr; - return this; - } - /** - * @public - * To add number for top OData Query param. The request URL accepts only one $top Odata Query option and its value is set to the most recently passed number value. - * @param {number} n - The number value - * @returns The same GraphRequest instance that is being called with, after adding the number for $top query - */ - top(n) { - this.urlComponents.oDataQueryParams.$top = n; - return this; - } - /** - * @public - * To add number for skip OData Query param. The request URL accepts only one $skip Odata Query option and its value is set to the most recently passed number value. - * @param {number} n - The number value - * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query - */ - skip(n) { - this.urlComponents.oDataQueryParams.$skip = n; - return this; - } - /** - * @public - * To add token string for skipToken OData Query param. The request URL accepts only one $skipToken Odata Query option and its value is set to the most recently passed token value. - * @param {string} token - The token value - * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option - */ - skipToken(token) { - this.urlComponents.oDataQueryParams.$skipToken = token; - return this; - } - /** - * @public - * To add boolean for count OData Query param. The URL accepts only one $count Odata Query option and its value is set to the most recently passed boolean value. - * @param {boolean} isCount - The count boolean - * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option - */ - count(isCount = false) { - this.urlComponents.oDataQueryParams.$count = isCount.toString(); - return this; - } - /** - * @public - * Appends query string to the urlComponent - * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value - * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component - */ - /* - * Accepts .query("displayName=xyz") - * and .select({ name: "value" }) - */ - query(queryDictionaryOrString) { - return this.parseQueryParameter(queryDictionaryOrString); - } - /** - * @public - * @async - * Makes a http request with GET method - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the get response - */ - get(callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - const options = { - method: RequestMethod.GET, - }; - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes a http request with POST method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the post response - */ - post(content, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - const options = { - method: RequestMethod.POST, - body: serializeContent(content), - }; - const className = content && content.constructor && content.constructor.name; - if (className === "FormData") { - // Content-Type headers should not be specified in case the of FormData type content - options.headers = {}; - } else { - this.setHeaderContentType(); - options.headers = this._headers; - } - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Alias for Post request call - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the post response - */ - create(content, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return yield this.post(content, callback); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes http request with PUT method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the put response - */ - put(content, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - this.setHeaderContentType(); - const options = { - method: RequestMethod.PUT, - body: serializeContent(content), - }; - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes http request with PATCH method - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the patch response - */ - patch(content, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - this.setHeaderContentType(); - const options = { - method: RequestMethod.PATCH, - body: serializeContent(content), - }; - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Alias for PATCH request - * @param {any} content - The content that needs to be sent with the request - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the patch response - */ - update(content, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return yield this.patch(content, callback); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes http request with DELETE method - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the delete response - */ - delete(callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - const options = { - method: RequestMethod.DELETE, - }; - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Alias for delete request call - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the delete response - */ - del(callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return yield this.delete(callback); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes a http request with GET method to read response as a stream. - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the getStream response - */ - getStream(callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - const options = { - method: RequestMethod.GET, - }; - this.responseType(ResponseType.STREAM); - try { - const stream = yield this.send(url, options, callback); - return stream; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * Makes a http request with GET method to read response as a stream. - * @param {any} stream - The stream instance - * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call - * @returns A promise that resolves to the putStream response - */ - putStream(stream, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const url = this.buildFullUrl(); - const options = { - method: RequestMethod.PUT, - headers: { - "Content-Type": "application/octet-stream", - }, - body: stream, - }; - try { - const response = yield this.send(url, options, callback); - return response; - } catch (error) { - throw error; - } - }); - } -} -//# sourceMappingURL=GraphRequest.js.map diff --git a/test/dist/es/src/GraphRequest.js.map b/test/dist/es/src/GraphRequest.js.map deleted file mode 100644 index f0a160155..000000000 --- a/test/dist/es/src/GraphRequest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphRequest.js","sourceRoot":"","sources":["../../../../src/GraphRequest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA+B9C;;;GAGG;AACH,MAAM,OAAO,YAAY;IA2CxB,kCAAkC;IAElC;;;;;;;OAOG;IACH,YAAmB,UAAsB,EAAE,MAAqB,EAAE,IAAY;QAgB9E;;;;;WAKG;QACK,cAAS,GAAG,CAAC,IAAY,EAAQ,EAAE;YAC1C,mDAAmD;YACnD,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE;gBACpC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBAEpC,2BAA2B;gBAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC1C,IAAI,eAAe,KAAK,CAAC,CAAC,EAAE;oBAC3B,qBAAqB;oBACrB,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,UAA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AAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,SAAS,CAAC,MAAW,EAAE,QAA+B;;YAClE,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG;gBACf,MAAM,EAAE,aAAa,CAAC,GAAG;gBACzB,OAAO,EAAE;oBACR,cAAc,EAAE,0BAA0B;iBAC1C;gBACD,IAAI,EAAE,MAAM;aACZ,CAAC;YACF,IAAI;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACzD,OAAO,QAAQ,CAAC;aAChB;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/GraphRequestUtil.d.ts b/test/dist/es/src/GraphRequestUtil.d.ts deleted file mode 100644 index a1e98b4d8..000000000 --- a/test/dist/es/src/GraphRequestUtil.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphRequestUtil - */ -/** - * To hold list of OData query params - */ -export declare const oDataQueryNames: string[]; -/** - * To construct the URL by appending the segments with "/" - * @param {string[]} urlSegments - The array of strings - * @returns The constructed URL string - */ -export declare const urlJoin: (urlSegments: string[]) => string; -/** - * Serializes the content - * @param {any} content - The content value that needs to be serialized - * @returns The serialized content - * - * Note: - * This conversion is required due to the following reasons: - * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string. - * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers. - * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`. - * If the data received is in JSON format, `serializeContent` converts the JSON to string. - */ -export declare const serializeContent: (content: any) => any; diff --git a/test/dist/es/src/GraphRequestUtil.js b/test/dist/es/src/GraphRequestUtil.js deleted file mode 100644 index 86f1f85fd..000000000 --- a/test/dist/es/src/GraphRequestUtil.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphRequestUtil - */ -/** - * To hold list of OData query params - */ -export const oDataQueryNames = ["$select", "$expand", "$orderby", "$filter", "$top", "$skip", "$skipToken", "$count"]; -/** - * To construct the URL by appending the segments with "/" - * @param {string[]} urlSegments - The array of strings - * @returns The constructed URL string - */ -export const urlJoin = (urlSegments) => { - const removePostSlash = (s) => s.replace(/\/+$/, ""); - const removePreSlash = (s) => s.replace(/^\/+/, ""); - const joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join("/"); - const parts = Array.prototype.slice.call(urlSegments); - return parts.reduce(joiner); -}; -/** - * Serializes the content - * @param {any} content - The content value that needs to be serialized - * @returns The serialized content - * - * Note: - * This conversion is required due to the following reasons: - * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string. - * Node.js platform does not support Blob, FormData. Javascript File object inherits from Blob so it is also not supported in node. Therefore content of type Blob, File, FormData will only come from browsers. - * Parallel to ArrayBuffer in javascript, node provides Buffer interface. Node's Buffer is able to send the arbitrary binary data to the server successfully for both Browser and Node platform. Whereas sending binary data via ArrayBuffer or TypedArrays was only possible using Browser. To support both Node and Browser, `serializeContent` converts TypedArrays or ArrayBuffer to `Node Buffer`. - * If the data received is in JSON format, `serializeContent` converts the JSON to string. - */ -export const serializeContent = (content) => { - const className = content && content.constructor && content.constructor.name; - if (className === "Buffer" || className === "Blob" || className === "File" || className === "FormData" || typeof content === "string") { - return content; - } - if (className === "ArrayBuffer") { - content = Buffer.from(content); - } else if (className === "Int8Array" || className === "Int16Array" || className === "Int32Array" || className === "Uint8Array" || className === "Uint16Array" || className === "Uint32Array" || className === "Uint8ClampedArray" || className === "Float32Array" || className === "Float64Array" || className === "DataView") { - content = Buffer.from(content.buffer); - } else { - try { - content = JSON.stringify(content); - } catch (error) { - throw new Error("Unable to stringify the content"); - } - } - return content; -}; -//# sourceMappingURL=GraphRequestUtil.js.map diff --git a/test/dist/es/src/GraphRequestUtil.js.map b/test/dist/es/src/GraphRequestUtil.js.map deleted file mode 100644 index c86f4a042..000000000 --- a/test/dist/es/src/GraphRequestUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphRequestUtil.js","sourceRoot":"","sources":["../../../../src/GraphRequestUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEtH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,WAAqB,EAAU,EAAE;IACxD,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,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/test/dist/es/src/GraphResponseHandler.d.ts b/test/dist/es/src/GraphResponseHandler.d.ts deleted file mode 100644 index 404c8aaa0..000000000 --- a/test/dist/es/src/GraphResponseHandler.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module GraphResponseHandler - */ -import { GraphRequestCallback } from "./IGraphRequestCallback"; -import { ResponseType } from "./ResponseType"; -/** - * @enum - * Enum for document types - * @property {string} TEXT_HTML - The text/html content type - * @property {string} TEXT_XML - The text/xml content type - * @property {string} APPLICATION_XML - The application/xml content type - * @property {string} APPLICATION_XHTML - The application/xhml+xml content type - */ -export declare enum DocumentType { - TEXT_HTML = "text/html", - TEXT_XML = "text/xml", - APPLICATION_XML = "application/xml", - APPLICATION_XHTML = "application/xhtml+xml", -} -/** - * @class - * Class for GraphResponseHandler - */ -export declare class GraphResponseHandler { - /** - * @private - * @static - * To parse Document response - * @param {Response} rawResponse - The response object - * @param {DocumentType} type - The type to which the document needs to be parsed - * @returns A promise that resolves to a document content - */ - private static parseDocumentResponse; - /** - * @private - * @static - * @async - * To convert the native Response to response content - * @param {Response} rawResponse - The response object - * @param {ResponseType} [responseType] - The response type value - * @returns A promise that resolves to the converted response content - */ - private static convertResponse; - /** - * @public - * @static - * @async - * To get the parsed response - * @param {Response} rawResponse - The response object - * @param {ResponseType} [responseType] - The response type value - * @param {GraphRequestCallback} [callback] - The graph request callback function - * @returns The parsed response - */ - static getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise; -} diff --git a/test/dist/es/src/GraphResponseHandler.js b/test/dist/es/src/GraphResponseHandler.js deleted file mode 100644 index f9f0dda4b..000000000 --- a/test/dist/es/src/GraphResponseHandler.js +++ /dev/null @@ -1,188 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { ResponseType } from "./ResponseType"; -/** - * @enum - * Enum for document types - * @property {string} TEXT_HTML - The text/html content type - * @property {string} TEXT_XML - The text/xml content type - * @property {string} APPLICATION_XML - The application/xml content type - * @property {string} APPLICATION_XHTML - The application/xhml+xml content type - */ -export var DocumentType; -(function(DocumentType) { - DocumentType["TEXT_HTML"] = "text/html"; - DocumentType["TEXT_XML"] = "text/xml"; - DocumentType["APPLICATION_XML"] = "application/xml"; - DocumentType["APPLICATION_XHTML"] = "application/xhtml+xml"; -})(DocumentType || (DocumentType = {})); -/** - * @enum - * Enum for Content types - * @property {string} TEXT_PLAIN - The text/plain content type - * @property {string} APPLICATION_JSON - The application/json content type - */ -var ContentType; -(function(ContentType) { - ContentType["TEXT_PLAIN"] = "text/plain"; - ContentType["APPLICATION_JSON"] = "application/json"; -})(ContentType || (ContentType = {})); -/** - * @enum - * Enum for Content type regex - * @property {string} DOCUMENT - The regex to match document content types - * @property {string} IMAGE - The regex to match image content types - */ -var ContentTypeRegexStr; -(function(ContentTypeRegexStr) { - ContentTypeRegexStr["DOCUMENT"] = "^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$"; - ContentTypeRegexStr["IMAGE"] = "^image\\/.+"; -})(ContentTypeRegexStr || (ContentTypeRegexStr = {})); -/** - * @class - * Class for GraphResponseHandler - */ -export class GraphResponseHandler { - /** - * @private - * @static - * To parse Document response - * @param {Response} rawResponse - The response object - * @param {DocumentType} type - The type to which the document needs to be parsed - * @returns A promise that resolves to a document content - */ - static parseDocumentResponse(rawResponse, type) { - try { - if (typeof DOMParser !== "undefined") { - return new Promise((resolve, reject) => { - rawResponse.text().then((xmlString) => { - try { - const parser = new DOMParser(); - const xmlDoc = parser.parseFromString(xmlString, type); - resolve(xmlDoc); - } catch (error) { - reject(error); - } - }); - }); - } else { - return Promise.resolve(rawResponse.body); - } - } catch (error) { - throw error; - } - } - /** - * @private - * @static - * @async - * To convert the native Response to response content - * @param {Response} rawResponse - The response object - * @param {ResponseType} [responseType] - The response type value - * @returns A promise that resolves to the converted response content - */ - static convertResponse(rawResponse, responseType) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - if (rawResponse.status === 204) { - // NO CONTENT - return Promise.resolve(); - } - let responseValue; - try { - switch (responseType) { - case ResponseType.ARRAYBUFFER: - responseValue = yield rawResponse.arrayBuffer(); - break; - case ResponseType.BLOB: - responseValue = yield rawResponse.blob(); - break; - case ResponseType.DOCUMENT: - responseValue = yield GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML); - break; - case ResponseType.JSON: - responseValue = yield rawResponse.json(); - break; - case ResponseType.STREAM: - responseValue = yield Promise.resolve(rawResponse.body); - break; - case ResponseType.TEXT: - responseValue = yield rawResponse.text(); - break; - default: - const contentType = rawResponse.headers.get("Content-type"); - if (contentType !== null) { - const mimeType = contentType.split(";")[0]; - if (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) { - responseValue = yield GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType); - } else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) { - responseValue = rawResponse.blob(); - } else if (mimeType === ContentType.TEXT_PLAIN) { - responseValue = yield rawResponse.text(); - } else if (mimeType === ContentType.APPLICATION_JSON) { - responseValue = yield rawResponse.json(); - } else { - responseValue = Promise.resolve(rawResponse.body); - } - } else { - /** - * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says: - * A sender that generates a message containing a payload body SHOULD - * generate a Content-Type header field in that message unless the - * intended media type of the enclosed representation is unknown to the - * sender. If a Content-Type header field is not present, the recipient - * MAY either assume a media type of "application/octet-stream" - * ([RFC2046], Section 4.5.1) or examine the data to determine its type. - * - * So assuming it as a stream type so returning the body. - */ - responseValue = Promise.resolve(rawResponse.body); - } - break; - } - } catch (error) { - throw error; - } - return responseValue; - }); - } - /** - * @public - * @static - * @async - * To get the parsed response - * @param {Response} rawResponse - The response object - * @param {ResponseType} [responseType] - The response type value - * @param {GraphRequestCallback} [callback] - The graph request callback function - * @returns The parsed response - */ - static getResponse(rawResponse, responseType, callback) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - if (responseType === ResponseType.RAW) { - return Promise.resolve(rawResponse); - } else { - const response = yield GraphResponseHandler.convertResponse(rawResponse, responseType); - if (rawResponse.ok) { - // Status Code 2XX - if (typeof callback === "function") { - callback(null, response); - } else { - return response; - } - } else { - // NOT OK Response - throw response; - } - } - } catch (error) { - throw error; - } - }); - } -} -//# sourceMappingURL=GraphResponseHandler.js.map diff --git a/test/dist/es/src/GraphResponseHandler.js.map b/test/dist/es/src/GraphResponseHandler.js.map deleted file mode 100644 index 6df3f7cf8..000000000 --- a/test/dist/es/src/GraphResponseHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphResponseHandler.js","sourceRoot":"","sources":["../../../../src/GraphResponseHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACvB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IACrB,mDAAmC,CAAA;IACnC,2DAA2C,CAAA;AAC5C,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;;;;GAKG;AAEH,IAAK,WAGJ;AAHD,WAAK,WAAW;IACf,wCAAyB,CAAA;IACzB,oDAAqC,CAAA;AACtC,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AAED;;;;;GAKG;AACH,IAAK,mBAGJ;AAHD,WAAK,mBAAmB;IACvB,2FAAoE,CAAA;IACpE,4CAAqB,CAAA;AACtB,CAAC,EAHI,mBAAmB,KAAnB,mBAAmB,QAGvB;AAED;;;GAGG;AAEH,MAAM,OAAO,oBAAoB;IAChC;;;;;;;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AC,CAAC;6BAClD;yBACD;6BAAM;4BACN;;;;;;;;;;+BAUG;4BACH,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;yBAClD;wBACD,MAAM;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;YACD,OAAO,aAAa,CAAC;QACtB,CAAC;KAAA;IAED;;;;;;;;;OASG;IACI,MAAM,CAAO,WAAW,CAAC,WAAqB,EAAE,YAA2B,EAAE,QAA+B;;YAClH,IAAI;gBACH,IAAI,YAAY,KAAK,YAAY,CAAC,GAAG,EAAE;oBACtC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;iBACpC;qBAAM;oBACN,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;oBACvF,IAAI,WAAW,CAAC,EAAE,EAAE;wBACnB,kBAAkB;wBAClB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;4BACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;yBACzB;6BAAM;4BACN,OAAO,QAAQ,CAAC;yBAChB;qBACD;yBAAM;wBACN,kBAAkB;wBAClB,MAAM,QAAQ,CAAC;qBACf;iBACD;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/HTTPClient.d.ts b/test/dist/es/src/HTTPClient.d.ts deleted file mode 100644 index 86e980968..000000000 --- a/test/dist/es/src/HTTPClient.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module HTTPClient - */ -import { Context } from "./IContext"; -import { Middleware } from "./middleware/IMiddleware"; -/** - * @class - * Class representing HTTPClient - */ -export declare class HTTPClient { - /** - * @private - * A member holding first middleware of the middleware chain - */ - private middleware; - /** - * @public - * @constructor - * Creates an instance of a HTTPClient - * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers - */ - constructor(...middleware: Middleware[]); - /** - * @private - * Processes the middleware parameter passed to set this.middleware property - * The calling function should validate if middleware is not undefined or not empty. - * @param {...Middleware} middleware - The middleware passed - * @returns Nothing - */ - private setMiddleware; - /** - * @private - * Processes the middleware array to construct the chain - * and sets this.middleware property to the first middlware handler of the array - * The calling function should validate if middleware is not undefined or not empty - * @param {Middleware[]} middlewareArray - The array of middleware handlers - * @returns Nothing - */ - private parseMiddleWareArray; - /** - * @public - * @async - * To send the request through the middleware chain - * @param {Context} context - The context of a request - * @returns A promise that resolves to the Context - */ - sendRequest(context: Context): Promise; -} diff --git a/test/dist/es/src/HTTPClient.js b/test/dist/es/src/HTTPClient.js deleted file mode 100644 index 92f366437..000000000 --- a/test/dist/es/src/HTTPClient.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * Class representing HTTPClient - */ -export class HTTPClient { - /** - * @public - * @constructor - * Creates an instance of a HTTPClient - * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers - */ - constructor(...middleware) { - if (!middleware || !middleware.length) { - const error = new Error(); - error.name = "InvalidMiddlewareChain"; - error.message = "Please provide a default middleware chain or custom middleware chain"; - throw error; - } - this.setMiddleware(...middleware); - } - /** - * @private - * Processes the middleware parameter passed to set this.middleware property - * The calling function should validate if middleware is not undefined or not empty. - * @param {...Middleware} middleware - The middleware passed - * @returns Nothing - */ - setMiddleware(...middleware) { - if (middleware.length > 1) { - this.parseMiddleWareArray(middleware); - } else { - this.middleware = middleware[0]; - } - } - /** - * @private - * Processes the middleware array to construct the chain - * and sets this.middleware property to the first middlware handler of the array - * The calling function should validate if middleware is not undefined or not empty - * @param {Middleware[]} middlewareArray - The array of middleware handlers - * @returns Nothing - */ - parseMiddleWareArray(middlewareArray) { - middlewareArray.forEach((element, index) => { - if (index < middlewareArray.length - 1) { - element.setNext(middlewareArray[index + 1]); - } - }); - this.middleware = middlewareArray[0]; - } - /** - * @public - * @async - * To send the request through the middleware chain - * @param {Context} context - The context of a request - * @returns A promise that resolves to the Context - */ - sendRequest(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - if (typeof context.request === "string" && context.options === undefined) { - const error = new Error(); - error.name = "InvalidRequestOptions"; - error.message = "Unable to execute the middleware, Please provide valid options for a request"; - throw error; - } - yield this.middleware.execute(context); - return context; - } catch (error) { - throw error; - } - }); - } -} -//# sourceMappingURL=HTTPClient.js.map diff --git a/test/dist/es/src/HTTPClient.js.map b/test/dist/es/src/HTTPClient.js.map deleted file mode 100644 index a19db7a35..000000000 --- a/test/dist/es/src/HTTPClient.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTTPClient.js","sourceRoot":"","sources":["../../../../src/HTTPClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;GAGG;AACH,MAAM,OAAO,UAAU;IAOtB;;;;;OAKG;IACH,YAAmB,GAAG,UAAwB;QAC7C,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YACtC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,GAAG,wBAAwB,CAAC;YACtC,KAAK,CAAC,OAAO,GAAG,sEAAsE,CAAC;YACvF,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CAAC,GAAG,UAAwB;QAChD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;SACtC;aAAM;YACN,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;SAChC;IACF,CAAC;IAED;;;;;;;OAOG;IACK,oBAAoB,CAAC,eAA6B;QACzD,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC1C,IAAI,KAAK,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;aAC5C;QACF,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACU,WAAW,CAAC,OAAgB;;YACxC,IAAI;gBACH,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;oBACzE,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;oBAC1B,KAAK,CAAC,IAAI,GAAG,uBAAuB,CAAC;oBACrC,KAAK,CAAC,OAAO,GAAG,8EAA8E,CAAC;oBAC/F,MAAM,KAAK,CAAC;iBACZ;gBACD,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACvC,OAAO,OAAO,CAAC;aACf;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/HTTPClientFactory.d.ts b/test/dist/es/src/HTTPClientFactory.d.ts deleted file mode 100644 index cd4910ccc..000000000 --- a/test/dist/es/src/HTTPClientFactory.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module HTTPClientFactory - */ -import { HTTPClient } from "./HTTPClient"; -import { AuthenticationProvider } from "./IAuthenticationProvider"; -import { Middleware } from "./middleware/IMiddleware"; -/** - * @class - * Class representing HTTPClientFactory - */ -export declare class HTTPClientFactory { - /** - * @public - * @static - * Creates HTTPClient with default middleware chain - * @param {AuthenticationProvider} authProvider - The authentication provider instance - * @returns A HTTPClient instance - * - * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline. - * * HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request - * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag. - * * The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for - * them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same. - */ - static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient; - /** - * @public - * @static - * Creates a middleware chain with the given one - * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers - * @returns A HTTPClient instance - */ - static createWithMiddleware(...middleware: Middleware[]): HTTPClient; -} diff --git a/test/dist/es/src/HTTPClientFactory.js b/test/dist/es/src/HTTPClientFactory.js deleted file mode 100644 index c154df062..000000000 --- a/test/dist/es/src/HTTPClientFactory.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module HTTPClientFactory - */ -import { HTTPClient } from "./HTTPClient"; -import { AuthenticationHandler } from "./middleware/AuthenticationHandler"; -import { HTTPMessageHandler } from "./middleware/HTTPMessageHandler"; -import { RedirectHandlerOptions } from "./middleware/options/RedirectHandlerOptions"; -import { RetryHandlerOptions } from "./middleware/options/RetryHandlerOptions"; -import { RedirectHandler } from "./middleware/RedirectHandler"; -import { RetryHandler } from "./middleware/RetryHandler"; -import { TelemetryHandler } from "./middleware/TelemetryHandler"; -/** - * @private - * To check whether the environment is node or not - * @returns A boolean representing the environment is node or not - */ -const isNodeEnvironment = () => { - return typeof process === "object" && typeof require === "function"; -}; -/** - * @class - * Class representing HTTPClientFactory - */ -export class HTTPClientFactory { - /** - * @public - * @static - * Creates HTTPClient with default middleware chain - * @param {AuthenticationProvider} authProvider - The authentication provider instance - * @returns A HTTPClient instance - * - * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline. - * * HTTPMessageHander should be the last one in the middleware pipeline, because this makes the actual network call of the request - * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag. - * * The best place for AuthenticationHandler is in the starting of the pipeline, because every other handler might have to work for multiple times for a request but the auth token for - * them will remain same. For example, Retry and Redirect handlers might be working multiple times for a request based on the response but their auth token would remain same. - */ - static createWithAuthenticationProvider(authProvider) { - const authenticationHandler = new AuthenticationHandler(authProvider); - const retryHandler = new RetryHandler(new RetryHandlerOptions()); - const telemetryHandler = new TelemetryHandler(); - const httpMessageHandler = new HTTPMessageHandler(); - authenticationHandler.setNext(retryHandler); - if (isNodeEnvironment()) { - const redirectHandler = new RedirectHandler(new RedirectHandlerOptions()); - retryHandler.setNext(redirectHandler); - redirectHandler.setNext(telemetryHandler); - } else { - retryHandler.setNext(telemetryHandler); - } - telemetryHandler.setNext(httpMessageHandler); - return HTTPClientFactory.createWithMiddleware(authenticationHandler); - } - /** - * @public - * @static - * Creates a middleware chain with the given one - * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers - * @returns A HTTPClient instance - */ - static createWithMiddleware(...middleware) { - // Middleware should not empty or undefined. This is check is present in the HTTPClient constructor. - return new HTTPClient(...middleware); - } -} -//# sourceMappingURL=HTTPClientFactory.js.map diff --git a/test/dist/es/src/HTTPClientFactory.js.map b/test/dist/es/src/HTTPClientFactory.js.map deleted file mode 100644 index f766d62fe..000000000 --- a/test/dist/es/src/HTTPClientFactory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTTPClientFactory.js","sourceRoot":"","sources":["../../../../src/HTTPClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,GAAY,EAAE;IACvC,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,CAAC;AACrE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC7B;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,gCAAgC,CAAC,YAAoC;QAClF,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAC;QACtE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAChD,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAEpD,qBAAqB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,iBAAiB,EAAE,EAAE;YACxB,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC;YAC1E,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YACtC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;SAC1C;aAAM;YACN,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACvC;QACD,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC7C,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,oBAAoB,CAAC,GAAG,UAAwB;QAC7D,oGAAoG;QACpG,OAAO,IAAI,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;IACtC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthProvider.d.ts b/test/dist/es/src/IAuthProvider.d.ts deleted file mode 100644 index 6455c998c..000000000 --- a/test/dist/es/src/IAuthProvider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { AuthProviderCallback } from "./IAuthProviderCallback"; -/** - * @interface - * Signature that holds authProvider - * @callback - The anonymous callback function which takes a single param - */ -export declare type AuthProvider = (done: AuthProviderCallback) => void; diff --git a/test/dist/es/src/IAuthProvider.js b/test/dist/es/src/IAuthProvider.js deleted file mode 100644 index 2ff61ee48..000000000 --- a/test/dist/es/src/IAuthProvider.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IAuthProvider.js.map diff --git a/test/dist/es/src/IAuthProvider.js.map b/test/dist/es/src/IAuthProvider.js.map deleted file mode 100644 index 5f10fae4d..000000000 --- a/test/dist/es/src/IAuthProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IAuthProvider.js","sourceRoot":"","sources":["../../../../src/IAuthProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthProviderCallback.d.ts b/test/dist/es/src/IAuthProviderCallback.d.ts deleted file mode 100644 index 8f27ae6fe..000000000 --- a/test/dist/es/src/IAuthProviderCallback.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @interface - * Signature that defines callback for an authentication provider - * @callback - The anonymous callback function which takes two params - */ -export declare type AuthProviderCallback = (error: any, accessToken: string | null) => void; diff --git a/test/dist/es/src/IAuthProviderCallback.js b/test/dist/es/src/IAuthProviderCallback.js deleted file mode 100644 index 59e35dcd6..000000000 --- a/test/dist/es/src/IAuthProviderCallback.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IAuthProviderCallback.js.map diff --git a/test/dist/es/src/IAuthProviderCallback.js.map b/test/dist/es/src/IAuthProviderCallback.js.map deleted file mode 100644 index 77a7b9efc..000000000 --- a/test/dist/es/src/IAuthProviderCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IAuthProviderCallback.js","sourceRoot":"","sources":["../../../../src/IAuthProviderCallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthenticationProvider.d.ts b/test/dist/es/src/IAuthenticationProvider.d.ts deleted file mode 100644 index 03a2b0f0f..000000000 --- a/test/dist/es/src/IAuthenticationProvider.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; -/** - * @interface - * A signature representing Authentication provider - * @property {Function} getAccessToken - The function to get the access token from the authentication provider - */ -export interface AuthenticationProvider { - /** - * To get access token from the authentication provider - * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance - * @returns A promise that resolves to an access token - */ - getAccessToken: (authenticationProviderOptions?: AuthenticationProviderOptions) => Promise; -} diff --git a/test/dist/es/src/IAuthenticationProvider.js b/test/dist/es/src/IAuthenticationProvider.js deleted file mode 100644 index 357ef4cc4..000000000 --- a/test/dist/es/src/IAuthenticationProvider.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IAuthenticationProvider.js.map diff --git a/test/dist/es/src/IAuthenticationProvider.js.map b/test/dist/es/src/IAuthenticationProvider.js.map deleted file mode 100644 index e5f4518b9..000000000 --- a/test/dist/es/src/IAuthenticationProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/IAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IAuthenticationProviderOptions.d.ts b/test/dist/es/src/IAuthenticationProviderOptions.d.ts deleted file mode 100644 index d09469347..000000000 --- a/test/dist/es/src/IAuthenticationProviderOptions.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @interface - * A signature represents the Authentication provider options - * @property {string[]} [scopes] - The array of scopes - */ -export interface AuthenticationProviderOptions { - scopes?: string[]; -} diff --git a/test/dist/es/src/IAuthenticationProviderOptions.js b/test/dist/es/src/IAuthenticationProviderOptions.js deleted file mode 100644 index ece3d9c9c..000000000 --- a/test/dist/es/src/IAuthenticationProviderOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IAuthenticationProviderOptions.js.map diff --git a/test/dist/es/src/IAuthenticationProviderOptions.js.map b/test/dist/es/src/IAuthenticationProviderOptions.js.map deleted file mode 100644 index ff80f08a7..000000000 --- a/test/dist/es/src/IAuthenticationProviderOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../src/IAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IClientOptions.d.ts b/test/dist/es/src/IClientOptions.d.ts deleted file mode 100644 index 5b1470070..000000000 --- a/test/dist/es/src/IClientOptions.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { AuthenticationProvider } from "./IAuthenticationProvider"; -import { FetchOptions } from "./IFetchOptions"; -import { Middleware } from "./middleware/IMiddleware"; -/** - * @interface - * Options for initializing the Graph Client - * @property {Function} [authProvider] - The authentication provider instance - * @property {string} [baseUrl] - Base url that needs to be appended to every request - * @property {boolean} [debugLogging] - The boolean to enable/disable debug logging - * @property {string} [defaultVersion] - The default version that needs to be used while making graph api request - * @property {FetchOptions} [fetchOptions] - The options for fetch request - * @property {Middleware| Middleware[]} [middleware] - The first middleware of the middleware chain or an array of the Middleware handlers - */ -export interface ClientOptions { - authProvider?: AuthenticationProvider; - baseUrl?: string; - debugLogging?: boolean; - defaultVersion?: string; - fetchOptions?: FetchOptions; - middleware?: Middleware | Middleware[]; -} diff --git a/test/dist/es/src/IClientOptions.js b/test/dist/es/src/IClientOptions.js deleted file mode 100644 index 49e988bbd..000000000 --- a/test/dist/es/src/IClientOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IClientOptions.js.map diff --git a/test/dist/es/src/IClientOptions.js.map b/test/dist/es/src/IClientOptions.js.map deleted file mode 100644 index e0867d978..000000000 --- a/test/dist/es/src/IClientOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IClientOptions.js","sourceRoot":"","sources":["../../../../src/IClientOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IContext.d.ts b/test/dist/es/src/IContext.d.ts deleted file mode 100644 index aa66332b4..000000000 --- a/test/dist/es/src/IContext.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { FetchOptions } from "./IFetchOptions"; -import { MiddlewareControl } from "./middleware/MiddlewareControl"; -/** - * @interface - * @property {RequestInfo} request - The request url string or the Request instance - * @property {FetchOptions} [options] - The options for the request - * @property {Response} [response] - The response content - * @property {MiddlewareControl} [middlewareControl] - The options for the middleware chain - */ -export interface Context { - request: RequestInfo; - options?: FetchOptions; - response?: Response; - middlewareControl?: MiddlewareControl; -} diff --git a/test/dist/es/src/IContext.js b/test/dist/es/src/IContext.js deleted file mode 100644 index ef5e90a4c..000000000 --- a/test/dist/es/src/IContext.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IContext.js.map diff --git a/test/dist/es/src/IContext.js.map b/test/dist/es/src/IContext.js.map deleted file mode 100644 index 1a2142713..000000000 --- a/test/dist/es/src/IContext.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IContext.js","sourceRoot":"","sources":["../../../../src/IContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IFetchOptions.d.ts b/test/dist/es/src/IFetchOptions.d.ts deleted file mode 100644 index 76f54c2df..000000000 --- a/test/dist/es/src/IFetchOptions.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @interface {@link https://github.com/bitinn/node-fetch/#options} - * Signature to define the fetch request options for node environment - * @property {number} [follow] - Maximum redirect count. 0 to not follow redirect - * @property {number} [timeout] - Request/Response timeout in milliseconds, it resets on redirect. 0 to disable (OS limit applies) - * @property {number} [compress] - Support gzip/deflate content encoding. false to disable - * @property {number} [size] - Maximum response body size in bytes. 0 to disable - * @property {any} [agent] - HTTP(S).Agent instance, allows custom proxy, certificate, lookup, family etc. - */ -export interface NodeFetchInit { - follow?: number; - timeout?: number; - compress?: boolean; - size?: number; - agent?: any; -} -/** - * @interface - * Signature to define the fetch api options which includes both fetch standard options and also the extended node fetch options - * @extends RequestInit @see {@link https://fetch.spec.whatwg.org/#requestinit} - * @extends NodeFetchInit - */ -export interface FetchOptions extends RequestInit, NodeFetchInit {} diff --git a/test/dist/es/src/IFetchOptions.js b/test/dist/es/src/IFetchOptions.js deleted file mode 100644 index 83b13f39f..000000000 --- a/test/dist/es/src/IFetchOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IFetchOptions.js.map diff --git a/test/dist/es/src/IFetchOptions.js.map b/test/dist/es/src/IFetchOptions.js.map deleted file mode 100644 index 96bb36791..000000000 --- a/test/dist/es/src/IFetchOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IFetchOptions.js","sourceRoot":"","sources":["../../../../src/IFetchOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IGraphRequestCallback.d.ts b/test/dist/es/src/IGraphRequestCallback.d.ts deleted file mode 100644 index e48785edb..000000000 --- a/test/dist/es/src/IGraphRequestCallback.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { GraphError } from "./GraphError"; -/** - * @interface - * Signature to define the GraphRequest callback - * @callback - The anonymous callback function - */ -export declare type GraphRequestCallback = (error: GraphError, response: any, rawResponse?: any) => void; diff --git a/test/dist/es/src/IGraphRequestCallback.js b/test/dist/es/src/IGraphRequestCallback.js deleted file mode 100644 index ed6c9c0e3..000000000 --- a/test/dist/es/src/IGraphRequestCallback.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IGraphRequestCallback.js.map diff --git a/test/dist/es/src/IGraphRequestCallback.js.map b/test/dist/es/src/IGraphRequestCallback.js.map deleted file mode 100644 index 1ebf20e4c..000000000 --- a/test/dist/es/src/IGraphRequestCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IGraphRequestCallback.js","sourceRoot":"","sources":["../../../../src/IGraphRequestCallback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/IOptions.d.ts b/test/dist/es/src/IOptions.d.ts deleted file mode 100644 index e35597077..000000000 --- a/test/dist/es/src/IOptions.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { AuthProvider } from "./IAuthProvider"; -import { FetchOptions } from "./IFetchOptions"; -/** - * @interface - * Options for initializing the Graph Client - * @property {AuthProvider} authProvider - The function to get the authentication token - * @property {string} [baseUrl] - Base url that needs to be appended to every request - * @property {boolean} [debugLogging] - The boolean to enable/disable debug logging - * @property {string} [defaultVersion] - The default version that needs to be used while making graph api request - * @property {FetchOptions} [fetchOptions] - The options for fetch request - */ -export interface Options { - authProvider: AuthProvider; - baseUrl?: string; - debugLogging?: boolean; - defaultVersion?: string; - fetchOptions?: FetchOptions; -} diff --git a/test/dist/es/src/IOptions.js b/test/dist/es/src/IOptions.js deleted file mode 100644 index dfed1da55..000000000 --- a/test/dist/es/src/IOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IOptions.js.map diff --git a/test/dist/es/src/IOptions.js.map b/test/dist/es/src/IOptions.js.map deleted file mode 100644 index 0d09cac51..000000000 --- a/test/dist/es/src/IOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IOptions.js","sourceRoot":"","sources":["../../../../src/IOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts b/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts deleted file mode 100644 index d5cd67205..000000000 --- a/test/dist/es/src/ImplicitMSALAuthenticationProvider.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ImplicitMSALAuthenticationProvider - */ -import { UserAgentApplication } from "msal"; -import { AuthenticationProvider } from "./IAuthenticationProvider"; -import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; -import { MSALAuthenticationProviderOptions } from "./MSALAuthenticationProviderOptions"; -/** - * @class - * Class representing ImplicitMSALAuthenticationProvider - * @extends AuthenticationProvider - */ -export declare class ImplicitMSALAuthenticationProvider implements AuthenticationProvider { - /** - * @private - * A member holding an instance of MSALAuthenticationProviderOptions - */ - private options; - /** - * @private - * A member holding an instance of MSAL UserAgentApplication - */ - private msalApplication; - /** - * @public - * @constructor - * Creates an instance of ImplicitMSALAuthenticationProvider - * @param {UserAgentApplication} msalApplication - An instance of MSAL UserAgentApplication - * @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions - * @returns An instance of ImplicitMSALAuthenticationProvider - */ - constructor(msalApplication: UserAgentApplication, options: MSALAuthenticationProviderOptions); - /** - * @public - * @async - * To get the access token - * @param {AuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object - * @returns The promise that resolves to an access token - */ - getAccessToken(authenticationProviderOptions?: AuthenticationProviderOptions): Promise; -} diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js deleted file mode 100644 index 2c3e5ec71..000000000 --- a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @module ImplicitMSALAuthenticationProvider - */ -import { InteractionRequiredAuthError } from "msal"; -/** - * @class - * Class representing ImplicitMSALAuthenticationProvider - * @extends AuthenticationProvider - */ -export class ImplicitMSALAuthenticationProvider { - /** - * @public - * @constructor - * Creates an instance of ImplicitMSALAuthenticationProvider - * @param {UserAgentApplication} msalApplication - An instance of MSAL UserAgentApplication - * @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions - * @returns An instance of ImplicitMSALAuthenticationProvider - */ - constructor(msalApplication, options) { - this.options = options; - this.msalApplication = msalApplication; - } - /** - * @public - * @async - * To get the access token - * @param {AuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object - * @returns The promise that resolves to an access token - */ - getAccessToken(authenticationProviderOptions) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = authenticationProviderOptions; - let scopes; - if (typeof options !== "undefined") { - scopes = options.scopes; - } - if (typeof scopes === "undefined" || scopes.length === 0) { - scopes = this.options.scopes; - } - if (scopes.length === 0) { - const error = new Error(); - error.name = "EmptyScopes"; - error.message = "Scopes cannot be empty, Please provide a scopes"; - throw error; - } - if (this.msalApplication.getAccount()) { - const tokenRequest = { - scopes, - }; - try { - const authResponse = yield this.msalApplication.acquireTokenSilent(tokenRequest); - return authResponse.accessToken; - } catch (error) { - if (error instanceof InteractionRequiredAuthError) { - try { - const authResponse = yield this.msalApplication.acquireTokenPopup(tokenRequest); - return authResponse.accessToken; - } catch (error) { - throw error; - } - } else { - throw error; - } - } - } else { - try { - const tokenRequest = { - scopes, - }; - yield this.msalApplication.loginPopup(tokenRequest); - const authResponse = yield this.msalApplication.acquireTokenSilent(tokenRequest); - return authResponse.accessToken; - } catch (error) { - throw error; - } - } - }); - } -} -//# sourceMappingURL=ImplicitMSALAuthenticationProvider.js.map diff --git a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map b/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map deleted file mode 100644 index 730c28d5f..000000000 --- a/test/dist/es/src/ImplicitMSALAuthenticationProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ImplicitMSALAuthenticationProvider.js","sourceRoot":"","sources":["../../../../src/ImplicitMSALAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AAEH,OAAO,EAA0C,4BAA4B,EAAwB,MAAM,MAAM,CAAC;AAMlH;;;;GAIG;AACH,MAAM,OAAO,kCAAkC;IAa9C;;;;;;;OAOG;IACH,YAAmB,eAAqC,EAAE,OAA0C;QACnG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACU,cAAc,CAAC,6BAA6D;;YACxF,MAAM,OAAO,GAAsC,6BAAkE,CAAC;YACtH,IAAI,MAAgB,CAAC;YACrB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;aACxB;YACD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzD,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aAC7B;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;gBACxB,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC;gBAC3B,KAAK,CAAC,OAAO,GAAG,iDAAiD,CAAC;gBAClE,MAAM,KAAK,CAAC;aACZ;YACD,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,EAAE;gBACtC,MAAM,YAAY,GAA6B;oBAC9C,MAAM;iBACN,CAAC;gBACF,IAAI;oBACH,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;oBAC/F,OAAO,YAAY,CAAC,WAAW,CAAC;iBAChC;gBAAC,OAAO,KAAK,EAAE;oBACf,IAAI,KAAK,YAAY,4BAA4B,EAAE;wBAClD,IAAI;4BACH,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;4BAC9F,OAAO,YAAY,CAAC,WAAW,CAAC;yBAChC;wBAAC,OAAO,KAAK,EAAE;4BACf,MAAM,KAAK,CAAC;yBACZ;qBACD;yBAAM;wBACN,MAAM,KAAK,CAAC;qBACZ;iBACD;aACD;iBAAM;gBACN,IAAI;oBACH,MAAM,YAAY,GAA6B;wBAC9C,MAAM;qBACN,CAAC;oBACF,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;oBACpD,MAAM,YAAY,GAAiB,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;oBAC/F,OAAO,YAAY,CAAC,WAAW,CAAC;iBAChC;gBAAC,OAAO,KAAK,EAAE;oBACf,MAAM,KAAK,CAAC;iBACZ;aACD;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts b/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts deleted file mode 100644 index 9e919042b..000000000 --- a/test/dist/es/src/MSALAuthenticationProviderOptions.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module MSALAuthenticationProviderOptions - */ -import { AuthenticationProviderOptions } from "./IAuthenticationProviderOptions"; -/** - * @class - * @implements AuthenticationProviderOptions - * Class representing MSALAuthenticationProviderOptions - */ -export declare class MSALAuthenticationProviderOptions implements AuthenticationProviderOptions { - /** - * @public - * A member holding array of scopes - */ - scopes: string[]; - /** - * @public - * @constructor - * To create an instance of MSALAuthenticationProviderOptions - * @param {string[]} scopes - An array of scopes - * @returns An instance of MSALAuthenticationProviderOptions - */ - constructor(scopes: string[]); -} diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.js b/test/dist/es/src/MSALAuthenticationProviderOptions.js deleted file mode 100644 index c9234d382..000000000 --- a/test/dist/es/src/MSALAuthenticationProviderOptions.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * @implements AuthenticationProviderOptions - * Class representing MSALAuthenticationProviderOptions - */ -export class MSALAuthenticationProviderOptions { - /** - * @public - * @constructor - * To create an instance of MSALAuthenticationProviderOptions - * @param {string[]} scopes - An array of scopes - * @returns An instance of MSALAuthenticationProviderOptions - */ - constructor(scopes) { - this.scopes = scopes; - } -} -//# sourceMappingURL=MSALAuthenticationProviderOptions.js.map diff --git a/test/dist/es/src/MSALAuthenticationProviderOptions.js.map b/test/dist/es/src/MSALAuthenticationProviderOptions.js.map deleted file mode 100644 index dee7f63dc..000000000 --- a/test/dist/es/src/MSALAuthenticationProviderOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MSALAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../src/MSALAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;GAIG;AACH,MAAM,OAAO,iCAAiC;IAO7C;;;;;;OAMG;IACH,YAAmB,MAAgB;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/Range.d.ts b/test/dist/es/src/Range.d.ts deleted file mode 100644 index c3ae2503d..000000000 --- a/test/dist/es/src/Range.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Range - */ -/** - * @class - * Class representing Range - */ -export declare class Range { - /** - * @public - * The minimum value of the range - */ - minValue: number; - /** - * @public - * The maximum value of the range - */ - maxValue: number; - /** - * @public - * @constructor - * Creates a range for given min and max values - * @param {number} [minVal = -1] - The minimum value. - * @param {number} [maxVal = -1] - The maximum value. - * @returns An instance of a Range - */ - constructor(minVal?: number, maxVal?: number); -} diff --git a/test/dist/es/src/Range.js b/test/dist/es/src/Range.js deleted file mode 100644 index 91ef71bfa..000000000 --- a/test/dist/es/src/Range.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Range - */ -/** - * @class - * Class representing Range - */ -export class Range { - /** - * @public - * @constructor - * Creates a range for given min and max values - * @param {number} [minVal = -1] - The minimum value. - * @param {number} [maxVal = -1] - The maximum value. - * @returns An instance of a Range - */ - constructor(minVal = -1, maxVal = -1) { - this.minValue = minVal; - this.maxValue = maxVal; - } -} -//# sourceMappingURL=Range.js.map diff --git a/test/dist/es/src/Range.js.map b/test/dist/es/src/Range.js.map deleted file mode 100644 index 543c667bf..000000000 --- a/test/dist/es/src/Range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../../src/Range.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,OAAO,KAAK;IAajB;;;;;;;OAOG;IACH,YAAmB,SAAiB,CAAC,CAAC,EAAE,SAAiB,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;IACxB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/RequestMethod.d.ts b/test/dist/es/src/RequestMethod.d.ts deleted file mode 100644 index dfd7cf9ba..000000000 --- a/test/dist/es/src/RequestMethod.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @enum - * Enum for RequestMethods - * @property {string} GET - The get request type - * @property {string} PATCH - The patch request type - * @property {string} POST - The post request type - * @property {string} PUT - The put request type - * @property {string} DELETE - The delete request type - */ -export declare enum RequestMethod { - GET = "GET", - PATCH = "PATCH", - POST = "POST", - PUT = "PUT", - DELETE = "DELETE", -} diff --git a/test/dist/es/src/RequestMethod.js b/test/dist/es/src/RequestMethod.js deleted file mode 100644 index c29fd8f05..000000000 --- a/test/dist/es/src/RequestMethod.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @enum - * Enum for RequestMethods - * @property {string} GET - The get request type - * @property {string} PATCH - The patch request type - * @property {string} POST - The post request type - * @property {string} PUT - The put request type - * @property {string} DELETE - The delete request type - */ -export var RequestMethod; -(function(RequestMethod) { - RequestMethod["GET"] = "GET"; - RequestMethod["PATCH"] = "PATCH"; - RequestMethod["POST"] = "POST"; - RequestMethod["PUT"] = "PUT"; - RequestMethod["DELETE"] = "DELETE"; -})(RequestMethod || (RequestMethod = {})); -//# sourceMappingURL=RequestMethod.js.map diff --git a/test/dist/es/src/RequestMethod.js.map b/test/dist/es/src/RequestMethod.js.map deleted file mode 100644 index 9d6fa9df1..000000000 --- a/test/dist/es/src/RequestMethod.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RequestMethod.js","sourceRoot":"","sources":["../../../../src/RequestMethod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACxB,4BAAW,CAAA;IACX,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,4BAAW,CAAA;IACX,kCAAiB,CAAA;AAClB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB"} \ No newline at end of file diff --git a/test/dist/es/src/ResponseType.d.ts b/test/dist/es/src/ResponseType.d.ts deleted file mode 100644 index 53a9050c4..000000000 --- a/test/dist/es/src/ResponseType.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @enum - * Enum for ResponseType values - * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer} - * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob} - * @property {string} DOCUMENT - This downloads content as a document or stream - * @property {string} JSON - To download response content as a json - * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html} - * @property {string} TEXT - For downloading response as a text - */ -export declare enum ResponseType { - ARRAYBUFFER = "arraybuffer", - BLOB = "blob", - DOCUMENT = "document", - JSON = "json", - RAW = "raw", - STREAM = "stream", - TEXT = "text", -} diff --git a/test/dist/es/src/ResponseType.js b/test/dist/es/src/ResponseType.js deleted file mode 100644 index 4b1b5e630..000000000 --- a/test/dist/es/src/ResponseType.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @enum - * Enum for ResponseType values - * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer} - * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob} - * @property {string} DOCUMENT - This downloads content as a document or stream - * @property {string} JSON - To download response content as a json - * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html} - * @property {string} TEXT - For downloading response as a text - */ -export var ResponseType; -(function(ResponseType) { - ResponseType["ARRAYBUFFER"] = "arraybuffer"; - ResponseType["BLOB"] = "blob"; - ResponseType["DOCUMENT"] = "document"; - ResponseType["JSON"] = "json"; - ResponseType["RAW"] = "raw"; - ResponseType["STREAM"] = "stream"; - ResponseType["TEXT"] = "text"; -})(ResponseType || (ResponseType = {})); -//# sourceMappingURL=ResponseType.js.map diff --git a/test/dist/es/src/ResponseType.js.map b/test/dist/es/src/ResponseType.js.map deleted file mode 100644 index c1cef8465..000000000 --- a/test/dist/es/src/ResponseType.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ResponseType.js","sourceRoot":"","sources":["../../../../src/ResponseType.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IACvB,2CAA2B,CAAA;IAC3B,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,6BAAa,CAAA;IACb,2BAAW,CAAA;IACX,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACd,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB"} \ No newline at end of file diff --git a/test/dist/es/src/ValidatePolyFilling.d.ts b/test/dist/es/src/ValidatePolyFilling.d.ts deleted file mode 100644 index cdeb15a3b..000000000 --- a/test/dist/es/src/ValidatePolyFilling.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @constant - * @function - * Validates availability of Promise and fetch in global context - * @returns The true in case the Promise and fetch available, otherwise throws error - */ -export declare const validatePolyFilling: () => boolean; diff --git a/test/dist/es/src/ValidatePolyFilling.js b/test/dist/es/src/ValidatePolyFilling.js deleted file mode 100644 index e3ec4b463..000000000 --- a/test/dist/es/src/ValidatePolyFilling.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @constant - * @function - * Validates availability of Promise and fetch in global context - * @returns The true in case the Promise and fetch available, otherwise throws error - */ -export const validatePolyFilling = () => { - if (typeof Promise === "undefined" && typeof fetch === "undefined") { - const error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them."); - error.name = "PolyFillNotAvailable"; - throw error; - } else if (typeof Promise === "undefined") { - const error = new Error("Library cannot function without Promise. So, please provide polyfill for it."); - error.name = "PolyFillNotAvailable"; - throw error; - } else if (typeof fetch === "undefined") { - const error = new Error("Library cannot function without fetch. So, please provide polyfill for it."); - error.name = "PolyFillNotAvailable"; - throw error; - } - return true; -}; -//# sourceMappingURL=ValidatePolyFilling.js.map diff --git a/test/dist/es/src/ValidatePolyFilling.js.map b/test/dist/es/src/ValidatePolyFilling.js.map deleted file mode 100644 index 7b706676a..000000000 --- a/test/dist/es/src/ValidatePolyFilling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ValidatePolyFilling.js","sourceRoot":"","sources":["../../../../src/ValidatePolyFilling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAY,EAAE;IAChD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACnE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;QACpH,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;SAAM,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAC1C,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QACxG,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACxC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QACtG,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,KAAK,CAAC;KACZ;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/Version.d.ts b/test/dist/es/src/Version.d.ts deleted file mode 100644 index a496a98b1..000000000 --- a/test/dist/es/src/Version.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module Version - */ -export declare const PACKAGE_VERSION = "2.1.0-Preview.2"; diff --git a/test/dist/es/src/Version.js b/test/dist/es/src/Version.js deleted file mode 100644 index 073470dff..000000000 --- a/test/dist/es/src/Version.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -// THIS FILE IS AUTO GENERATED -// ANY CHANGES WILL BE LOST DURING BUILD -/** - * @module Version - */ -export const PACKAGE_VERSION = "2.1.0-Preview.2"; -//# sourceMappingURL=Version.js.map diff --git a/test/dist/es/src/Version.js.map b/test/dist/es/src/Version.js.map deleted file mode 100644 index 7fa736388..000000000 --- a/test/dist/es/src/Version.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../../../src/Version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8BAA8B;AAC9B,wCAAwC;AAExC;;GAEG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/content/BatchRequestContent.d.ts b/test/dist/es/src/content/BatchRequestContent.d.ts deleted file mode 100644 index 9cea5d057..000000000 --- a/test/dist/es/src/content/BatchRequestContent.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @interface - * Signature representing BatchRequestStep data - * @property {string} id - Unique identity for the request, Should not be an empty string - * @property {string[]} [dependsOn] - Array of dependencies - * @property {Request} request - The Request object - */ -export interface BatchRequestStep { - id: string; - dependsOn?: string[]; - request: Request; -} -/** - * @interface - * Signature representing single request in a Batching - * @extends RequestInit - * @see {@link https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L1337} and {@link https://fetch.spec.whatwg.org/#requestinit} - * - * @property {string} url - The url value of the request - */ -export interface RequestData extends RequestInit { - url: string; -} -/** - * @interface - * Signature representing batch request data - * @property {string} id - Unique identity for the request, Should not be an empty string - * @property {string[]} [dependsOn] - Array of dependencies - */ -export interface BatchRequestData extends RequestData { - id: string; - dependsOn?: string[]; -} -/** - * @interface - * Signature representing batch request body - * @property {BatchRequestData[]} requests - Array of request data, a json representation of requests for batch - */ -export interface BatchRequestBody { - requests: BatchRequestData[]; -} -/** - * @class - * Class for handling BatchRequestContent - */ -export declare class BatchRequestContent { - /** - * @private - * @static - * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} - */ - private static requestLimit; - /** - * @public - * To keep track of requests, key will be id of the request and value will be the request json - */ - requests: Map; - /** - * @private - * @static - * Validates the dependency chain of the requests - * - * Note: - * Individual requests can depend on other individual requests. Currently, requests can only depend on a single other request, and must follow one of these three patterns: - * 1. Parallel - no individual request states a dependency in the dependsOn property. - * 2. Serial - all individual requests depend on the previous individual request. - * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency. - * As JSON batching matures, these limitations will be removed. - * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} - * - * @param {Map} requests - The map of requests. - * @returns The boolean indicating the validation status - */ - private static validateDependencies; - /** - * @private - * @static - * @async - * Converts Request Object instance to a JSON - * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance - * @returns A promise that resolves to JSON representation of a request - */ - private static getRequestData; - /** - * @private - * @static - * @async - * Gets the body of a Request object instance - * @param {IsomorphicRequest} request - The IsomorphicRequest object instance - * @returns The Promise that resolves to a body value of a Request - */ - private static getRequestBody; - /** - * @public - * @constructor - * Constructs a BatchRequestContent instance - * @param {BatchRequestStep[]} [requests] - Array of requests value - * @returns An instance of a BatchRequestContent - */ - constructor(requests?: BatchRequestStep[]); - /** - * @public - * Adds a request to the batch request content - * @param {BatchRequestStep} request - The request value - * @returns The id of the added request - */ - addRequest(request: BatchRequestStep): string; - /** - * @public - * Removes request from the batch payload and its dependencies from all dependents - * @param {string} requestId - The id of a request that needs to be removed - * @returns The boolean indicating removed status - */ - removeRequest(requestId: string): boolean; - /** - * @public - * @async - * Serialize content from BatchRequestContent instance - * @returns The body content to make batch request - */ - getContent(): Promise; - /** - * @public - * Adds a dependency for a given dependent request - * @param {string} dependentId - The id of the dependent request - * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency - * @returns Nothing - */ - addDependency(dependentId: string, dependencyId?: string): void; - /** - * @public - * Removes a dependency for a given dependent request id - * @param {string} dependentId - The id of the dependent request - * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request - * @returns The boolean indicating removed status - */ - removeDependency(dependentId: string, dependencyId?: string): boolean; -} diff --git a/test/dist/es/src/content/BatchRequestContent.js b/test/dist/es/src/content/BatchRequestContent.js deleted file mode 100644 index 760d2fee5..000000000 --- a/test/dist/es/src/content/BatchRequestContent.js +++ /dev/null @@ -1,410 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @module BatchRequestContent - */ -import { RequestMethod } from "../RequestMethod"; -/** - * @class - * Class for handling BatchRequestContent - */ -export class BatchRequestContent { - /** - * @public - * @constructor - * Constructs a BatchRequestContent instance - * @param {BatchRequestStep[]} [requests] - Array of requests value - * @returns An instance of a BatchRequestContent - */ - constructor(requests) { - this.requests = new Map(); - if (typeof requests !== "undefined") { - const limit = BatchRequestContent.requestLimit; - if (requests.length > limit) { - const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`); - error.name = "Limit Exceeded Error"; - throw error; - } - for (const req of requests) { - this.addRequest(req); - } - } - } - /** - * @private - * @static - * Validates the dependency chain of the requests - * - * Note: - * Individual requests can depend on other individual requests. Currently, requests can only depend on a single other request, and must follow one of these three patterns: - * 1. Parallel - no individual request states a dependency in the dependsOn property. - * 2. Serial - all individual requests depend on the previous individual request. - * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency. - * As JSON batching matures, these limitations will be removed. - * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} - * - * @param {Map} requests - The map of requests. - * @returns The boolean indicating the validation status - */ - static validateDependencies(requests) { - const isParallel = (reqs) => { - const iterator = reqs.entries(); - let cur = iterator.next(); - while (!cur.done) { - const curReq = cur.value[1]; - if (curReq.dependsOn !== undefined && curReq.dependsOn.length > 0) { - return false; - } - cur = iterator.next(); - } - return true; - }; - const isSerial = (reqs) => { - const iterator = reqs.entries(); - let cur = iterator.next(); - const firstRequest = cur.value[1]; - if (firstRequest.dependsOn !== undefined && firstRequest.dependsOn.length > 0) { - return false; - } - let prev = cur; - cur = iterator.next(); - while (!cur.done) { - const curReq = cur.value[1]; - if (curReq.dependsOn === undefined || curReq.dependsOn.length !== 1 || curReq.dependsOn[0] !== prev.value[1].id) { - return false; - } - prev = cur; - cur = iterator.next(); - } - return true; - }; - const isSame = (reqs) => { - const iterator = reqs.entries(); - let cur = iterator.next(); - const firstRequest = cur.value[1]; - let dependencyId; - if (firstRequest.dependsOn === undefined || firstRequest.dependsOn.length === 0) { - dependencyId = firstRequest.id; - } else { - if (firstRequest.dependsOn.length === 1) { - const fDependencyId = firstRequest.dependsOn[0]; - if (fDependencyId !== firstRequest.id && reqs.has(fDependencyId)) { - dependencyId = fDependencyId; - } else { - return false; - } - } else { - return false; - } - } - cur = iterator.next(); - while (!cur.done) { - const curReq = cur.value[1]; - if ((curReq.dependsOn === undefined || curReq.dependsOn.length === 0) && dependencyId !== curReq.id) { - return false; - } - if (curReq.dependsOn !== undefined && curReq.dependsOn.length !== 0) { - if (curReq.dependsOn.length === 1 && (curReq.id === dependencyId || curReq.dependsOn[0] !== dependencyId)) { - return false; - } - if (curReq.dependsOn.length > 1) { - return false; - } - } - cur = iterator.next(); - } - return true; - }; - if (requests.size === 0) { - const error = new Error("Empty requests map, Please provide at least one request."); - error.name = "Empty Requests Error"; - throw error; - } - return isParallel(requests) || isSerial(requests) || isSame(requests); - } - /** - * @private - * @static - * @async - * Converts Request Object instance to a JSON - * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance - * @returns A promise that resolves to JSON representation of a request - */ - static getRequestData(request) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const requestData = { - url: "", - }; - const hasHttpRegex = new RegExp("^https?://"); - // Stripping off hostname, port and url scheme - requestData.url = hasHttpRegex.test(request.url) ? "/" + request.url.split(/.*?\/\/.*?\//)[1] : request.url; - requestData.method = request.method; - const headers = {}; - request.headers.forEach((value, key) => { - headers[key] = value; - }); - if (Object.keys(headers).length) { - requestData.headers = headers; - } - if (request.method === RequestMethod.PATCH || request.method === RequestMethod.POST || request.method === RequestMethod.PUT) { - requestData.body = yield BatchRequestContent.getRequestBody(request); - } - /** - * TODO: Check any other property needs to be used from the Request object and add them - */ - return requestData; - }); - } - /** - * @private - * @static - * @async - * Gets the body of a Request object instance - * @param {IsomorphicRequest} request - The IsomorphicRequest object instance - * @returns The Promise that resolves to a body value of a Request - */ - static getRequestBody(request) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - let bodyParsed = false; - let body; - try { - const cloneReq = request.clone(); - body = yield cloneReq.json(); - bodyParsed = true; - } catch (e) { - // tslint:disable-line: no-empty - } - if (!bodyParsed) { - try { - if (typeof Blob !== "undefined") { - const blob = yield request.blob(); - const reader = new FileReader(); - body = yield new Promise((resolve) => { - reader.addEventListener( - "load", - () => { - const dataURL = reader.result; - /** - * Some valid dataURL schemes: - * 1. data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh - * 2. data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678 - * 3. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== - * 4. data:image/png,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== - * 5. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== - * @see Syntax {@link https://en.wikipedia.org/wiki/Data_URI_scheme} for more - */ - const regex = new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$"); - const segments = regex.exec(dataURL); - resolve(segments[4]); - }, - false, - ); - reader.readAsDataURL(blob); - }); - } else if (typeof Buffer !== "undefined") { - const buffer = yield request.buffer(); - body = buffer.toString("base64"); - } - bodyParsed = true; - } catch (e) { - // tslint:disable-line: no-empty - } - } - return body; - }); - } - /** - * @public - * Adds a request to the batch request content - * @param {BatchRequestStep} request - The request value - * @returns The id of the added request - */ - addRequest(request) { - const limit = BatchRequestContent.requestLimit; - if (request.id === "") { - const error = new Error(`Id for a request is empty, Please provide an unique id`); - error.name = "Empty Id For Request"; - throw error; - } - if (this.requests.size === limit) { - const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`); - error.name = "Limit Exceeded Error"; - throw error; - } - if (this.requests.has(request.id)) { - const error = new Error(`Adding request with duplicate id ${request.id}, Make the id of the requests unique`); - error.name = "Duplicate RequestId Error"; - throw error; - } - this.requests.set(request.id, request); - return request.id; - } - /** - * @public - * Removes request from the batch payload and its dependencies from all dependents - * @param {string} requestId - The id of a request that needs to be removed - * @returns The boolean indicating removed status - */ - removeRequest(requestId) { - const deleteStatus = this.requests.delete(requestId); - const iterator = this.requests.entries(); - let cur = iterator.next(); - /** - * Removing dependencies where this request is present as a dependency - */ - while (!cur.done) { - const dependencies = cur.value[1].dependsOn; - if (typeof dependencies !== "undefined") { - const index = dependencies.indexOf(requestId); - if (index !== -1) { - dependencies.splice(index, 1); - } - if (dependencies.length === 0) { - delete cur.value[1].dependsOn; - } - } - cur = iterator.next(); - } - return deleteStatus; - } - /** - * @public - * @async - * Serialize content from BatchRequestContent instance - * @returns The body content to make batch request - */ - getContent() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const requests = []; - const requestBody = { - requests, - }; - const iterator = this.requests.entries(); - let cur = iterator.next(); - if (cur.done) { - const error = new Error("No requests added yet, Please add at least one request."); - error.name = "Empty Payload"; - throw error; - } - if (!BatchRequestContent.validateDependencies(this.requests)) { - const error = new Error(`Invalid dependency found, Dependency should be: -1. Parallel - no individual request states a dependency in the dependsOn property. -2. Serial - all individual requests depend on the previous individual request. -3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.`); - error.name = "Invalid Dependency"; - throw error; - } - while (!cur.done) { - const requestStep = cur.value[1]; - const batchRequestData = yield BatchRequestContent.getRequestData(requestStep.request); - /** - * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format} - */ - if (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers["content-type"] === undefined)) { - const error = new Error(`Content-type header is not mentioned for request #${requestStep.id}, For request having body, Content-type header should be mentioned`); - error.name = "Invalid Content-type header"; - throw error; - } - batchRequestData.id = requestStep.id; - if (requestStep.dependsOn !== undefined && requestStep.dependsOn.length > 0) { - batchRequestData.dependsOn = requestStep.dependsOn; - } - requests.push(batchRequestData); - cur = iterator.next(); - } - requestBody.requests = requests; - return requestBody; - }); - } - /** - * @public - * Adds a dependency for a given dependent request - * @param {string} dependentId - The id of the dependent request - * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency - * @returns Nothing - */ - addDependency(dependentId, dependencyId) { - if (!this.requests.has(dependentId)) { - const error = new Error(`Dependent ${dependentId} does not exists, Please check the id`); - error.name = "Invalid Dependent"; - throw error; - } - if (typeof dependencyId !== "undefined" && !this.requests.has(dependencyId)) { - const error = new Error(`Dependency ${dependencyId} does not exists, Please check the id`); - error.name = "Invalid Dependency"; - throw error; - } - if (typeof dependencyId !== "undefined") { - const dependent = this.requests.get(dependentId); - if (dependent.dependsOn === undefined) { - dependent.dependsOn = []; - } - if (dependent.dependsOn.indexOf(dependencyId) !== -1) { - const error = new Error(`Dependency ${dependencyId} is already added for the request ${dependentId}`); - error.name = "Duplicate Dependency"; - throw error; - } - dependent.dependsOn.push(dependencyId); - } else { - const iterator = this.requests.entries(); - let prev; - let cur = iterator.next(); - while (!cur.done && cur.value[1].id !== dependentId) { - prev = cur; - cur = iterator.next(); - } - if (typeof prev !== "undefined") { - const dId = prev.value[0]; - if (cur.value[1].dependsOn === undefined) { - cur.value[1].dependsOn = []; - } - if (cur.value[1].dependsOn.indexOf(dId) !== -1) { - const error = new Error(`Dependency ${dId} is already added for the request ${dependentId}`); - error.name = "Duplicate Dependency"; - throw error; - } - cur.value[1].dependsOn.push(dId); - } else { - const error = new Error(`Can't add dependency ${dependencyId}, There is only a dependent request in the batch`); - error.name = "Invalid Dependency Addition"; - throw error; - } - } - } - /** - * @public - * Removes a dependency for a given dependent request id - * @param {string} dependentId - The id of the dependent request - * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request - * @returns The boolean indicating removed status - */ - removeDependency(dependentId, dependencyId) { - const request = this.requests.get(dependentId); - if (typeof request === "undefined" || request.dependsOn === undefined || request.dependsOn.length === 0) { - return false; - } - if (typeof dependencyId !== "undefined") { - const index = request.dependsOn.indexOf(dependencyId); - if (index === -1) { - return false; - } - request.dependsOn.splice(index, 1); - return true; - } else { - delete request.dependsOn; - return true; - } - } -} -/** - * @private - * @static - * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching} - */ -BatchRequestContent.requestLimit = 20; -//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/src/content/BatchRequestContent.js.map b/test/dist/es/src/content/BatchRequestContent.js.map deleted file mode 100644 index fbcbc65d8..000000000 --- a/test/dist/es/src/content/BatchRequestContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BatchRequestContent.js","sourceRoot":"","sources":["../../../../../src/content/BatchRequestContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkEjD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAqM/B;;;;;;OAMG;IACH,YAAmB,QAA6B;QAC/C,IAAI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N,OAAO,OAAO,CAAC,SAAS,CAAC;YACzB,OAAO,IAAI,CAAC;SACZ;IACF,CAAC;;AAjZD;;;;GAIG;AACY,gCAAY,GAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/content/BatchResponseContent.d.ts b/test/dist/es/src/content/BatchResponseContent.d.ts deleted file mode 100644 index 143851052..000000000 --- a/test/dist/es/src/content/BatchResponseContent.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module BatchResponseContent - */ -/** - * @interface - * Signature represents key value pair object - */ -interface KeyValuePairObject { - [key: string]: any; -} -/** - * @interface - * Signature representing Batch response body - * @property {KeyValuePairObject[]} responses - An array of key value pair representing response object for every request - * @property {string} [@odata.nextLink] - The nextLink value to get next set of responses in case of asynchronous batch requests - */ -interface BatchResponseBody { - responses: KeyValuePairObject[]; - "@odata.nextLink"?: string; -} -/** - * @class - * Class that handles BatchResponseContent - */ -export declare class BatchResponseContent { - /** - * To hold the responses - */ - private responses; - /** - * Holds the next link url - */ - private nextLink; - /** - * @public - * @constructor - * Creates the BatchResponseContent instance - * @param {BatchResponseBody} response - The response body returned for batch request from server - * @returns An instance of a BatchResponseContent - */ - constructor(response: BatchResponseBody); - /** - * @private - * Creates native Response object from the json representation of it. - * @param {KeyValuePairObject} responseJSON - The response json value - * @returns The Response Object instance - */ - private createResponseObject; - /** - * @public - * Updates the Batch response content instance with given responses. - * @param {BatchResponseBody} response - The response json representing batch response message - * @returns Nothing - */ - update(response: BatchResponseBody): void; - /** - * @public - * To get the response of a request for a given request id - * @param {string} requestId - The request id value - * @returns The Response object instance for the particular request - */ - getResponseById(requestId: string): Response; - /** - * @public - * To get all the responses of the batch request - * @returns The Map of id and Response objects - */ - getResponses(): Map; - /** - * @public - * To get the iterator for the responses - * @returns The Iterable generator for the response objects - */ - getResponsesIterator(): IterableIterator<[string, Response]>; -} -export {}; diff --git a/test/dist/es/src/content/BatchResponseContent.js b/test/dist/es/src/content/BatchResponseContent.js deleted file mode 100644 index c16517c3f..000000000 --- a/test/dist/es/src/content/BatchResponseContent.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * Class that handles BatchResponseContent - */ -export class BatchResponseContent { - /** - * @public - * @constructor - * Creates the BatchResponseContent instance - * @param {BatchResponseBody} response - The response body returned for batch request from server - * @returns An instance of a BatchResponseContent - */ - constructor(response) { - this.responses = new Map(); - this.update(response); - } - /** - * @private - * Creates native Response object from the json representation of it. - * @param {KeyValuePairObject} responseJSON - The response json value - * @returns The Response Object instance - */ - createResponseObject(responseJSON) { - const body = responseJSON.body; - const options = {}; - options.status = responseJSON.status; - if (responseJSON.statusText !== undefined) { - options.statusText = responseJSON.statusText; - } - options.headers = responseJSON.headers; - if (options.headers !== undefined && options.headers["Content-Type"] !== undefined) { - if (options.headers["Content-Type"].split(";")[0] === "application/json") { - const bodyString = JSON.stringify(body); - return new Response(bodyString, options); - } - } - return new Response(body, options); - } - /** - * @public - * Updates the Batch response content instance with given responses. - * @param {BatchResponseBody} response - The response json representing batch response message - * @returns Nothing - */ - update(response) { - this.nextLink = response["@odata.nextLink"]; - const responses = response.responses; - for (let i = 0, l = responses.length; i < l; i++) { - this.responses.set(responses[i].id, this.createResponseObject(responses[i])); - } - } - /** - * @public - * To get the response of a request for a given request id - * @param {string} requestId - The request id value - * @returns The Response object instance for the particular request - */ - getResponseById(requestId) { - return this.responses.get(requestId); - } - /** - * @public - * To get all the responses of the batch request - * @returns The Map of id and Response objects - */ - getResponses() { - return this.responses; - } - /** - * @public - * To get the iterator for the responses - * @returns The Iterable generator for the response objects - */ - *getResponsesIterator() { - const iterator = this.responses.entries(); - let cur = iterator.next(); - while (!cur.done) { - yield cur.value; - cur = iterator.next(); - } - } -} -//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/src/content/BatchResponseContent.js.map b/test/dist/es/src/content/BatchResponseContent.js.map deleted file mode 100644 index ced2c98e9..000000000 --- a/test/dist/es/src/content/BatchResponseContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../src/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAWhC;;;;;;OAMG;IACH,YAAmB,QAA2B;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACK,oBAAoB,CAAC,YAAgC;QAC5D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAC/B,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QACrC,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;YAC1C,OAAO,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;SAC7C;QACD,OAAO,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,SAAS,EAAE;YACnF,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,kBAAkB,EAAE;gBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACxC,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;aACzC;SACD;QACD,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAA2B;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YACjD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC7E;IACF,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,SAAiB;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,CAAC,oBAAoB;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE;YACjB,MAAM,GAAG,CAAC,KAAK,CAAC;YAChB,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;SACtB;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/index.d.ts b/test/dist/es/src/index.d.ts deleted file mode 100644 index 759a5bfc2..000000000 --- a/test/dist/es/src/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export * from "./content/BatchRequestContent"; -export * from "./content/BatchResponseContent"; -export * from "./middleware/AuthenticationHandler"; -export * from "./middleware/HTTPMessageHandler"; -export * from "./middleware/IMiddleware"; -export * from "./middleware/RetryHandler"; -export * from "./middleware/RedirectHandler"; -export * from "./middleware/TelemetryHandler"; -export * from "./middleware/MiddlewareFactory"; -export * from "./middleware/options/AuthenticationHandlerOptions"; -export * from "./middleware/options/IMiddlewareOptions"; -export * from "./middleware/options/RetryHandlerOptions"; -export * from "./middleware/options/RedirectHandlerOptions"; -export * from "./middleware/options/TelemetryHandlerOptions"; -export * from "./middleware/options/ChaosHandlerOptions"; -export * from "./middleware/options/ChaosStrategy"; -export * from "./middleware/ChaosHandler"; -export * from "./tasks/LargeFileUploadTask"; -export * from "./tasks/OneDriveLargeFileUploadTask"; -export * from "./tasks/PageIterator"; -export * from "./Client"; -export * from "./CustomAuthenticationProvider"; -export * from "./GraphError"; -export * from "./GraphRequest"; -export * from "./IAuthProvider"; -export * from "./IAuthenticationProvider"; -export * from "./IAuthenticationProviderOptions"; -export * from "./IAuthProviderCallback"; -export * from "./IClientOptions"; -export * from "./IContext"; -export * from "./IFetchOptions"; -export * from "./IGraphRequestCallback"; -export * from "./ImplicitMSALAuthenticationProvider"; -export * from "./IOptions"; -export * from "./MSALAuthenticationProviderOptions"; -export * from "./ResponseType"; diff --git a/test/dist/es/src/index.js b/test/dist/es/src/index.js deleted file mode 100644 index 04556ba60..000000000 --- a/test/dist/es/src/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export * from "./content/BatchRequestContent"; -export * from "./content/BatchResponseContent"; -export * from "./middleware/AuthenticationHandler"; -export * from "./middleware/HTTPMessageHandler"; -export * from "./middleware/RetryHandler"; -export * from "./middleware/RedirectHandler"; -export * from "./middleware/TelemetryHandler"; -export * from "./middleware/MiddlewareFactory"; -export * from "./middleware/options/AuthenticationHandlerOptions"; -export * from "./middleware/options/RetryHandlerOptions"; -export * from "./middleware/options/RedirectHandlerOptions"; -export * from "./middleware/options/TelemetryHandlerOptions"; -export * from "./middleware/options/ChaosHandlerOptions"; -export * from "./middleware/options/ChaosStrategy"; -export * from "./middleware/ChaosHandler"; -export * from "./tasks/LargeFileUploadTask"; -export * from "./tasks/OneDriveLargeFileUploadTask"; -export * from "./tasks/PageIterator"; -export * from "./Client"; -export * from "./CustomAuthenticationProvider"; -export * from "./GraphError"; -export * from "./GraphRequest"; -export * from "./ImplicitMSALAuthenticationProvider"; -export * from "./MSALAuthenticationProviderOptions"; -export * from "./ResponseType"; -//# sourceMappingURL=index.js.map diff --git a/test/dist/es/src/index.js.map b/test/dist/es/src/index.js.map deleted file mode 100644 index baebcdd1c..000000000 --- a/test/dist/es/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAEhD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mDAAmD,CAAC;AAElE,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAE1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AAErC,cAAc,UAAU,CAAC;AACzB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAS/B,cAAc,sCAAsC,CAAC;AAErD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/AuthenticationHandler.d.ts b/test/dist/es/src/middleware/AuthenticationHandler.d.ts deleted file mode 100644 index fab577e3c..000000000 --- a/test/dist/es/src/middleware/AuthenticationHandler.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module AuthenticationHandler - */ -import { AuthenticationProvider } from "../IAuthenticationProvider"; -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -/** - * @class - * @implements Middleware - * Class representing AuthenticationHandler - */ -export declare class AuthenticationHandler implements Middleware { - /** - * @private - * A member representing the authorization header name - */ - private static AUTHORIZATION_HEADER; - /** - * @private - * A member to hold an AuthenticationProvider instance - */ - private authenticationProvider; - /** - * @private - * A member to hold next middleware in the middleware chain - */ - private nextMiddleware; - /** - * @public - * @constructor - * Creates an instance of AuthenticationHandler - * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler - */ - constructor(authenticationProvider: AuthenticationProvider); - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context: Context): Promise; - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next: Middleware): void; -} diff --git a/test/dist/es/src/middleware/AuthenticationHandler.js b/test/dist/es/src/middleware/AuthenticationHandler.js deleted file mode 100644 index 7f754ea4d..000000000 --- a/test/dist/es/src/middleware/AuthenticationHandler.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { MiddlewareControl } from "./MiddlewareControl"; -import { appendRequestHeader } from "./MiddlewareUtil"; -import { AuthenticationHandlerOptions } from "./options/AuthenticationHandlerOptions"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; -/** - * @class - * @implements Middleware - * Class representing AuthenticationHandler - */ -export class AuthenticationHandler { - /** - * @public - * @constructor - * Creates an instance of AuthenticationHandler - * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler - */ - constructor(authenticationProvider) { - this.authenticationProvider = authenticationProvider; - } - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions); - } - let authenticationProvider; - let authenticationProviderOptions; - if (typeof options !== "undefined") { - authenticationProvider = options.authenticationProvider; - authenticationProviderOptions = options.authenticationProviderOptions; - } - if (typeof authenticationProvider === "undefined") { - authenticationProvider = this.authenticationProvider; - } - const token = yield authenticationProvider.getAccessToken(authenticationProviderOptions); - const bearerKey = `Bearer ${token}`; - appendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey); - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - return yield this.nextMiddleware.execute(context); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next) { - this.nextMiddleware = next; - } -} -/** - * @private - * A member representing the authorization header name - */ -AuthenticationHandler.AUTHORIZATION_HEADER = "Authorization"; -//# sourceMappingURL=AuthenticationHandler.js.map diff --git a/test/dist/es/src/middleware/AuthenticationHandler.js.map b/test/dist/es/src/middleware/AuthenticationHandler.js.map deleted file mode 100644 index fabc234cc..000000000 --- a/test/dist/es/src/middleware/AuthenticationHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuthenticationHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/AuthenticationHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAmBjC;;;;;OAKG;IACH,YAAmB,sBAA8C;QAChE,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,IAAI,OAAqC,CAAC;gBAC1C,IAAI,OAAO,CAAC,iBAAiB,YAAY,iBAAiB,EAAE;oBAC3D,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,4BAA4B,CAAiC,CAAC;iBACvH;gBACD,IAAI,sBAA8C,CAAC;gBACnD,IAAI,6BAA4D,CAAC;gBACjE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;oBACnC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;oBACxD,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,CAAC;iBACtE;gBACD,IAAI,OAAO,sBAAsB,KAAK,WAAW,EAAE;oBAClD,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;iBACrD;gBACD,MAAM,KAAK,GAAW,MAAM,sBAAsB,CAAC,cAAc,CAAC,6BAA6B,CAAC,CAAC;gBACjG,MAAM,SAAS,GAAW,UAAU,KAAK,EAAE,CAAC;gBAC5C,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;gBAC7G,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACzG,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAClD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AApED;;;GAGG;AACY,0CAAoB,GAAW,eAAe,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/ChaosHandler.d.ts b/test/dist/es/src/middleware/ChaosHandler.d.ts deleted file mode 100644 index 4b687c9f5..000000000 --- a/test/dist/es/src/middleware/ChaosHandler.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosHandler - */ -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -import { ChaosHandlerOptions } from "./options/ChaosHandlerOptions"; -/** - * Class representing ChaosHandler - * @class - * Class - * @implements Middleware - */ -export declare class ChaosHandler implements Middleware { - /** - * A member holding options to customize the handler behavior - * - * @private - */ - private options; - /** - * container for the manual map that has been written by the client - * - * @private - */ - private manualMap; - /** - * @private - * A member to hold next middleware in the middleware chain - */ - private nextMiddleware; - /** - * @public - * @constructor - * To create an instance of Testing Handler - * @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The testing handler options instance - * @param manualMap - The Map passed by user containing url-statusCode info - * @returns An instance of Testing Handler - */ - constructor(options?: ChaosHandlerOptions, manualMap?: Map>); - /** - * Generates responseHeader - * @private - * @param {number} statusCode - the status code to be returned for the request - * @param {string} requestID - request id - * @param {string} requestDate - date of the request - * @returns response Header - */ - private createResponseHeaders; - /** - * Generates responseBody - * @private - * @param {number} statusCode - the status code to be returned for the request - * @param {string} statusMessage - the status message to be returned for the request - * @param {string} requestID - request id - * @param {string} requestDate - date of the request - * @param {any?} requestBody - the request body to be returned for the request - * @returns response body - */ - private createResponseBody; - /** - * creates a response - * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object - * @param {Context} context - Contains the context of the request - */ - private createResponse; - /** - * Decides whether to send the request to the graph or not - * @private - * @param {ChaosHandlerOptions} chaosHandlerOptions - A ChaosHandlerOptions object - * @param {Context} context - Contains the context of the request - * @returns nothing - */ - private sendRequest; - /** - * Fetches a random status code for the RANDOM mode from the predefined array - * @private - * @param {string} requestMethod - the API method for the request - * @returns a random status code from a given set of status codes - */ - private getRandomStatusCode; - /** - * To fetch the relative URL out of the complete URL using a predefined regex pattern - * @private - * @param {string} urlMethod - the complete URL - * @returns the string as relative URL - */ - private getRelativeURL; - /** - * To fetch the status code from the map(if needed), then returns response by calling createResponse - * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object - * @param {string} requestURL - the URL for the request - * @param {string} requestMethod - the API method for the request - */ - private setStatusCode; - /** - * To get the options for execution of the middleware - * @private - * @param {Context} context - The context object - * @returns options for middleware execution - */ - private getOptions; - /** - * To execute the current middleware - * @public - * @async - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context: Context): Promise; - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next: Middleware): void; -} diff --git a/test/dist/es/src/middleware/ChaosHandler.js b/test/dist/es/src/middleware/ChaosHandler.js deleted file mode 100644 index bbd41aea9..000000000 --- a/test/dist/es/src/middleware/ChaosHandler.js +++ /dev/null @@ -1,246 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { MiddlewareControl } from "./MiddlewareControl"; -import { generateUUID } from "./MiddlewareUtil"; -import { httpStatusCode, methodStatusCode } from "./options/ChaosHandlerData"; -import { ChaosHandlerOptions } from "./options/ChaosHandlerOptions"; -import { ChaosStrategy } from "./options/ChaosStrategy"; -/** - * Class representing ChaosHandler - * @class - * Class - * @implements Middleware - */ -export class ChaosHandler { - /** - * @public - * @constructor - * To create an instance of Testing Handler - * @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The testing handler options instance - * @param manualMap - The Map passed by user containing url-statusCode info - * @returns An instance of Testing Handler - */ - constructor(options = new ChaosHandlerOptions(), manualMap) { - this.options = options; - this.manualMap = manualMap; - } - /** - * Generates responseHeader - * @private - * @param {number} statusCode - the status code to be returned for the request - * @param {string} requestID - request id - * @param {string} requestDate - date of the request - * @returns response Header - */ - createResponseHeaders(statusCode, requestID, requestDate) { - const responseHeader = new Headers(); - responseHeader.append("Cache-Control", "no-store"); - responseHeader.append("request-id", requestID); - responseHeader.append("client-request-id", requestID); - responseHeader.append("x-ms-ags-diagnostic", ""); - responseHeader.append("Date", requestDate); - responseHeader.append("Strict-Transport-Security", ""); - if (statusCode === 429) { - // throttling case has to have a timeout scenario - responseHeader.append("retry-after", "300"); - } - return responseHeader; - } - /** - * Generates responseBody - * @private - * @param {number} statusCode - the status code to be returned for the request - * @param {string} statusMessage - the status message to be returned for the request - * @param {string} requestID - request id - * @param {string} requestDate - date of the request - * @param {any?} requestBody - the request body to be returned for the request - * @returns response body - */ - createResponseBody(statusCode, statusMessage, requestID, requestDate, responseBody) { - if (responseBody) { - return responseBody; - } - let body; - if (statusCode >= 400) { - const codeMessage = httpStatusCode[statusCode]; - const errMessage = statusMessage; - body = { - error: { - code: codeMessage, - message: errMessage, - innerError: { - "request-id": requestID, - date: requestDate, - }, - }, - }; - } else { - body = {}; - } - return body; - } - /** - * creates a response - * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object - * @param {Context} context - Contains the context of the request - */ - createResponse(chaosHandlerOptions, context) { - try { - let responseBody; - let responseHeader; - let requestID; - let requestDate; - const requestURL = context.request; - requestID = generateUUID(); - requestDate = new Date(); - responseHeader = this.createResponseHeaders(chaosHandlerOptions.statusCode, requestID, requestDate.toString()); - responseBody = this.createResponseBody(chaosHandlerOptions.statusCode, chaosHandlerOptions.statusMessage, requestID, requestDate.toString(), chaosHandlerOptions.responseBody); - const init = { url: requestURL, status: chaosHandlerOptions.statusCode, statusText: chaosHandlerOptions.statusMessage, headers: responseHeader }; - context.response = new Response(responseBody, init); - } catch (error) { - throw error; - } - } - /** - * Decides whether to send the request to the graph or not - * @private - * @param {ChaosHandlerOptions} chaosHandlerOptions - A ChaosHandlerOptions object - * @param {Context} context - Contains the context of the request - * @returns nothing - */ - sendRequest(chaosHandlerOptions, context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - this.setStatusCode(chaosHandlerOptions, context.request, context.options.method); - if (!chaosHandlerOptions.statusCode) { - yield this.nextMiddleware.execute(context); - } else { - this.createResponse(chaosHandlerOptions, context); - } - } catch (error) { - throw error; - } - }); - } - /** - * Fetches a random status code for the RANDOM mode from the predefined array - * @private - * @param {string} requestMethod - the API method for the request - * @returns a random status code from a given set of status codes - */ - getRandomStatusCode(requestMethod) { - try { - const statusCodeArray = methodStatusCode[requestMethod]; - return statusCodeArray[Math.floor(Math.random() * statusCodeArray.length)]; - } catch (error) { - throw error; - } - } - /** - * To fetch the relative URL out of the complete URL using a predefined regex pattern - * @private - * @param {string} urlMethod - the complete URL - * @returns the string as relative URL - */ - getRelativeURL(urlMethod) { - const pattern = /https?:\/\/graph\.microsoft\.com\/[^/]+(.+?)(\?|$)/; - let relativeURL; - if (pattern.exec(urlMethod) !== null) { - relativeURL = pattern.exec(urlMethod)[1]; - } - return relativeURL; - } - /** - * To fetch the status code from the map(if needed), then returns response by calling createResponse - * @private - * @param {ChaosHandlerOptions} ChaosHandlerOptions - The ChaosHandlerOptions object - * @param {string} requestURL - the URL for the request - * @param {string} requestMethod - the API method for the request - */ - setStatusCode(chaosHandlerOptions, requestURL, requestMethod) { - try { - if (chaosHandlerOptions.chaosStrategy === ChaosStrategy.MANUAL) { - if (chaosHandlerOptions.statusCode === undefined) { - // manual mode with no status code, can be a global level or request level without statusCode - const relativeURL = this.getRelativeURL(requestURL); - if (this.manualMap.get(relativeURL) !== undefined) { - // checking Manual Map for exact match - if (this.manualMap.get(relativeURL).get(requestMethod) !== undefined) { - chaosHandlerOptions.statusCode = this.manualMap.get(relativeURL).get(requestMethod); - } - // else statusCode would be undefined - } else { - // checking for regex match if exact match doesn't work - this.manualMap.forEach((value, key) => { - const regexURL = new RegExp(key + "$"); - if (regexURL.test(relativeURL)) { - if (this.manualMap.get(key).get(requestMethod) !== undefined) { - chaosHandlerOptions.statusCode = this.manualMap.get(key).get(requestMethod); - } - // else statusCode would be undefined - } - }); - } - // Case of redirection or request url not in map ---> statusCode would be undefined - } - } else { - // Handling the case of Random here - if (Math.floor(Math.random() * 100) < chaosHandlerOptions.chaosPercentage) { - chaosHandlerOptions.statusCode = this.getRandomStatusCode(requestMethod); - } - // else statusCode would be undefined - } - } catch (error) { - throw error; - } - } - /** - * To get the options for execution of the middleware - * @private - * @param {Context} context - The context object - * @returns options for middleware execution - */ - getOptions(context) { - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(ChaosHandlerOptions); - } - if (typeof options === "undefined") { - options = Object.assign(new ChaosHandlerOptions(), this.options); - } - return options; - } - /** - * To execute the current middleware - * @public - * @async - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const chaosHandlerOptions = this.getOptions(context); - return yield this.sendRequest(chaosHandlerOptions, context); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next) { - this.nextMiddleware = next; - } -} -//# sourceMappingURL=ChaosHandler.js.map diff --git a/test/dist/es/src/middleware/ChaosHandler.js.map b/test/dist/es/src/middleware/ChaosHandler.js.map deleted file mode 100644 index b17904193..000000000 --- a/test/dist/es/src/middleware/ChaosHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ChaosHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/ChaosHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAqBxB;;;;;;;OAOG;IACH,YAAmB,UAA+B,IAAI,mBAAmB,EAAE,EAAE,SAA4C;QACxH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACK,qBAAqB,CAAC,UAAkB,EAAE,SAAiB,EAAE,WAAmB;QACvF,MAAM,cAAc,GAAY,IAAI,OAAO,EAAE,CAAC;QAE9C,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QACnD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAC/C,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;QACtD,cAAc,CAAC,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AO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.d.ts b/test/dist/es/src/middleware/HTTPMessageHandler.d.ts deleted file mode 100644 index 2a44ccdf7..000000000 --- a/test/dist/es/src/middleware/HTTPMessageHandler.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module HTTPMessageHandler - */ -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -/** - * @class - * @implements Middleware - * Class for HTTPMessageHandler - */ -export declare class HTTPMessageHandler implements Middleware { - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The request context object - * @returns A promise that resolves to nothing - */ - execute(context: Context): Promise; -} diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.js b/test/dist/es/src/middleware/HTTPMessageHandler.js deleted file mode 100644 index 1075f6d8e..000000000 --- a/test/dist/es/src/middleware/HTTPMessageHandler.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * @implements Middleware - * Class for HTTPMessageHandler - */ -export class HTTPMessageHandler { - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The request context object - * @returns A promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - context.response = yield fetch(context.request, context.options); - return; - } catch (error) { - throw error; - } - }); - } -} -//# sourceMappingURL=HTTPMessageHandler.js.map diff --git a/test/dist/es/src/middleware/HTTPMessageHandler.js.map b/test/dist/es/src/middleware/HTTPMessageHandler.js.map deleted file mode 100644 index dc045e810..000000000 --- a/test/dist/es/src/middleware/HTTPMessageHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTTPMessageHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/HTTPMessageHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAUH;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,OAAO,CAAC,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBACjE,OAAO;aACP;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/IMiddleware.d.ts b/test/dist/es/src/middleware/IMiddleware.d.ts deleted file mode 100644 index 0ae1f6bde..000000000 --- a/test/dist/es/src/middleware/IMiddleware.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { Context } from "../IContext"; -/** - * @interface - * @property {Function} execute - The method to execute the middleware - * @property {Function} [setNext] - A method to set the next middleware in the chain - */ -export interface Middleware { - execute: (context: Context) => Promise; - setNext?: (middleware: Middleware) => void; -} diff --git a/test/dist/es/src/middleware/IMiddleware.js b/test/dist/es/src/middleware/IMiddleware.js deleted file mode 100644 index 7d850edb5..000000000 --- a/test/dist/es/src/middleware/IMiddleware.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IMiddleware.js.map diff --git a/test/dist/es/src/middleware/IMiddleware.js.map b/test/dist/es/src/middleware/IMiddleware.js.map deleted file mode 100644 index 75092c1da..000000000 --- a/test/dist/es/src/middleware/IMiddleware.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IMiddleware.js","sourceRoot":"","sources":["../../../../../src/middleware/IMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareControl.d.ts b/test/dist/es/src/middleware/MiddlewareControl.d.ts deleted file mode 100644 index f040abcb3..000000000 --- a/test/dist/es/src/middleware/MiddlewareControl.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module MiddlewareControl - */ -import { MiddlewareOptions } from "./options/IMiddlewareOptions"; -/** - * @class - * Class representing MiddlewareControl - */ -export declare class MiddlewareControl { - /** - * @private - * A member holding map of MiddlewareOptions - */ - private middlewareOptions; - /** - * @public - * @constructor - * Creates an instance of MiddlewareControl - * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions - * @returns The instance of MiddlewareControl - */ - constructor(middlewareOptions?: MiddlewareOptions[]); - /** - * @public - * To get the middleware option using the class of the option - * @param {Function} fn - The class of the strongly typed option class - * @returns The middleware option - * @example - * // if you wanted to return the middleware option associated with this class (MiddlewareControl) - * // call this function like this: - * getMiddlewareOptions(MiddlewareControl) - */ - getMiddlewareOptions(fn: Function): MiddlewareOptions; - /** - * @public - * To set the middleware options using the class of the option - * @param {Function} fn - The class of the strongly typed option class - * @param {MiddlewareOptions} option - The strongly typed middleware option - * @returns nothing - */ - setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void; -} diff --git a/test/dist/es/src/middleware/MiddlewareControl.js b/test/dist/es/src/middleware/MiddlewareControl.js deleted file mode 100644 index ccc3fdf62..000000000 --- a/test/dist/es/src/middleware/MiddlewareControl.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * Class representing MiddlewareControl - */ -export class MiddlewareControl { - /** - * @public - * @constructor - * Creates an instance of MiddlewareControl - * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions - * @returns The instance of MiddlewareControl - */ - constructor(middlewareOptions = []) { - // tslint:disable-next-line:ban-types - this.middlewareOptions = new Map(); - for (const option of middlewareOptions) { - const fn = option.constructor; - this.middlewareOptions.set(fn, option); - } - } - /** - * @public - * To get the middleware option using the class of the option - * @param {Function} fn - The class of the strongly typed option class - * @returns The middleware option - * @example - * // if you wanted to return the middleware option associated with this class (MiddlewareControl) - * // call this function like this: - * getMiddlewareOptions(MiddlewareControl) - */ - // tslint:disable-next-line:ban-types - getMiddlewareOptions(fn) { - return this.middlewareOptions.get(fn); - } - /** - * @public - * To set the middleware options using the class of the option - * @param {Function} fn - The class of the strongly typed option class - * @param {MiddlewareOptions} option - The strongly typed middleware option - * @returns nothing - */ - // tslint:disable-next-line:ban-types - setMiddlewareOptions(fn, option) { - this.middlewareOptions.set(fn, option); - } -} -//# sourceMappingURL=MiddlewareControl.js.map diff --git a/test/dist/es/src/middleware/MiddlewareControl.js.map b/test/dist/es/src/middleware/MiddlewareControl.js.map deleted file mode 100644 index 060675319..000000000 --- a/test/dist/es/src/middleware/MiddlewareControl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareControl.js","sourceRoot":"","sources":["../../../../../src/middleware/MiddlewareControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAQ7B;;;;;;OAMG;IACH,YAAmB,oBAAyC,EAAE;QAC7D,qCAAqC;QACrC,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAA+B,CAAC;QAChE,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE;YACvC,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;YAC9B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SACvC;IACF,CAAC;IAED;;;;;;;;;OASG;IACH,qCAAqC;IAC9B,oBAAoB,CAAC,EAAY;QACvC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACH,qCAAqC;IAC9B,oBAAoB,CAAC,EAAY,EAAE,MAAyB;QAClE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareFactory.d.ts b/test/dist/es/src/middleware/MiddlewareFactory.d.ts deleted file mode 100644 index db45e331e..000000000 --- a/test/dist/es/src/middleware/MiddlewareFactory.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module MiddlewareFactory - */ -import { AuthenticationProvider } from "../IAuthenticationProvider"; -import { Middleware } from "./IMiddleware"; -/** - * @class - * Class containing function(s) related to the middleware pipelines. - */ -export declare class MiddlewareFactory { - /** - * @public - * @static - * Returns the default middleware chain an array with the middleware handlers - * @param {AuthenticationProvider} authProvider - The authentication provider instance - * @returns an array of the middleware handlers of the default middleware chain - */ - static getDefaultMiddlewareChain(authProvider: AuthenticationProvider): Middleware[]; -} diff --git a/test/dist/es/src/middleware/MiddlewareFactory.js b/test/dist/es/src/middleware/MiddlewareFactory.js deleted file mode 100644 index 4cd58cef2..000000000 --- a/test/dist/es/src/middleware/MiddlewareFactory.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { AuthenticationHandler } from "./AuthenticationHandler"; -import { HTTPMessageHandler } from "./HTTPMessageHandler"; -import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; -import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; -import { RedirectHandler } from "./RedirectHandler"; -import { RetryHandler } from "./RetryHandler"; -import { TelemetryHandler } from "./TelemetryHandler"; -/** - * @private - * To check whether the environment is node or not - * @returns A boolean representing the environment is node or not - */ -const isNodeEnvironment = () => { - return typeof process === "object" && typeof require === "function"; -}; -/** - * @class - * Class containing function(s) related to the middleware pipelines. - */ -export class MiddlewareFactory { - /** - * @public - * @static - * Returns the default middleware chain an array with the middleware handlers - * @param {AuthenticationProvider} authProvider - The authentication provider instance - * @returns an array of the middleware handlers of the default middleware chain - */ - static getDefaultMiddlewareChain(authProvider) { - const middleware = []; - const authenticationHandler = new AuthenticationHandler(authProvider); - const retryHandler = new RetryHandler(new RetryHandlerOptions()); - const telemetryHandler = new TelemetryHandler(); - const httpMessageHandler = new HTTPMessageHandler(); - middleware.push(authenticationHandler); - middleware.push(retryHandler); - if (isNodeEnvironment()) { - const redirectHandler = new RedirectHandler(new RedirectHandlerOptions()); - middleware.push(redirectHandler); - } - middleware.push(telemetryHandler); - middleware.push(httpMessageHandler); - return middleware; - } -} -//# sourceMappingURL=MiddlewareFactory.js.map diff --git a/test/dist/es/src/middleware/MiddlewareFactory.js.map b/test/dist/es/src/middleware/MiddlewareFactory.js.map deleted file mode 100644 index 084b2b733..000000000 --- a/test/dist/es/src/middleware/MiddlewareFactory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareFactory.js","sourceRoot":"","sources":["../../../../../src/middle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CAAC,gBAAgB,CAAC,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpC,OAAO,UAAU,CAAC;IACnB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/MiddlewareUtil.d.ts b/test/dist/es/src/middleware/MiddlewareUtil.d.ts deleted file mode 100644 index 8c26a066a..000000000 --- a/test/dist/es/src/middleware/MiddlewareUtil.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module MiddlewareUtil - */ -import { FetchOptions } from "../IFetchOptions"; -/** - * @constant - * To generate the UUID - * @returns The UUID string - */ -export declare const generateUUID: () => string; -/** - * @constant - * To get the request header from the request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @returns A header value for the given key from the request - */ -export declare const getRequestHeader: (request: RequestInfo, options: FetchOptions, key: string) => string; -/** - * @constant - * To set the header value to the given request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @param {string } value - The header value string - * @returns Nothing - */ -export declare const setRequestHeader: (request: RequestInfo, options: FetchOptions, key: string, value: string) => void; -/** - * @constant - * To append the header value to the given request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @param {string } value - The header value string - * @returns Nothing - */ -export declare const appendRequestHeader: (request: RequestInfo, options: FetchOptions, key: string, value: string) => void; -/** - * @constant - * To clone the request with the new url - * @param {string} url - The new url string - * @param {Request} request - The request object - * @returns A promise that resolves to request object - */ -export declare const cloneRequestWithNewUrl: (newUrl: string, request: Request) => Promise; diff --git a/test/dist/es/src/middleware/MiddlewareUtil.js b/test/dist/es/src/middleware/MiddlewareUtil.js deleted file mode 100644 index 6fa1dbd01..000000000 --- a/test/dist/es/src/middleware/MiddlewareUtil.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @constant - * To generate the UUID - * @returns The UUID string - */ -export const generateUUID = () => { - let uuid = ""; - for (let j = 0; j < 32; j++) { - if (j === 8 || j === 12 || j === 16 || j === 20) { - uuid += "-"; - } - uuid += Math.floor(Math.random() * 16).toString(16); - } - return uuid; -}; -/** - * @constant - * To get the request header from the request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @returns A header value for the given key from the request - */ -export const getRequestHeader = (request, options, key) => { - let value = null; - if (typeof Request !== "undefined" && request instanceof Request) { - value = request.headers.get(key); - } else if (typeof options !== "undefined" && options.headers !== undefined) { - if (typeof Headers !== "undefined" && options.headers instanceof Headers) { - value = options.headers.get(key); - } else if (options.headers instanceof Array) { - const headers = options.headers; - for (let i = 0, l = headers.length; i < l; i++) { - if (headers[i][0] === key) { - value = headers[i][1]; - break; - } - } - } else if (options.headers[key] !== undefined) { - value = options.headers[key]; - } - } - return value; -}; -/** - * @constant - * To set the header value to the given request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @param {string } value - The header value string - * @returns Nothing - */ -export const setRequestHeader = (request, options, key, value) => { - if (typeof Request !== "undefined" && request instanceof Request) { - request.headers.set(key, value); - } else if (typeof options !== "undefined") { - if (options.headers === undefined) { - options.headers = new Headers({ - [key]: value, - }); - } else { - if (typeof Headers !== "undefined" && options.headers instanceof Headers) { - options.headers.set(key, value); - } else if (options.headers instanceof Array) { - let i = 0; - const l = options.headers.length; - for (; i < l; i++) { - const header = options.headers[i]; - if (header[0] === key) { - header[1] = value; - break; - } - } - if (i === l) { - options.headers.push([key, value]); - } - } else { - Object.assign(options.headers, { [key]: value }); - } - } - } -}; -/** - * @constant - * To append the header value to the given request - * @param {RequestInfo} request - The request object or the url string - * @param {FetchOptions|undefined} options - The request options object - * @param {string} key - The header key string - * @param {string } value - The header value string - * @returns Nothing - */ -export const appendRequestHeader = (request, options, key, value) => { - if (typeof Request !== "undefined" && request instanceof Request) { - request.headers.append(key, value); - } else if (typeof options !== "undefined") { - if (options.headers === undefined) { - options.headers = new Headers({ - [key]: value, - }); - } else { - if (typeof Headers !== "undefined" && options.headers instanceof Headers) { - options.headers.append(key, value); - } else if (options.headers instanceof Array) { - options.headers.push([key, value]); - } else if (options.headers === undefined) { - options.headers = { [key]: value }; - } else if (options.headers[key] === undefined) { - options.headers[key] = value; - } else { - options.headers[key] += `, ${value}`; - } - } - } -}; -/** - * @constant - * To clone the request with the new url - * @param {string} url - The new url string - * @param {Request} request - The request object - * @returns A promise that resolves to request object - */ -export const cloneRequestWithNewUrl = (newUrl, request) => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const body = request.headers.get("Content-Type") ? yield request.blob() : yield Promise.resolve(undefined); - const { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request; - return new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal }); - }); -//# sourceMappingURL=MiddlewareUtil.js.map diff --git a/test/dist/es/src/middleware/MiddlewareUtil.js.map b/test/dist/es/src/middleware/MiddlewareUtil.js.map deleted file mode 100644 index 0ac4039e0..000000000 --- a/test/dist/es/src/middleware/MiddlewareUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareUtil.js","sourceRoot":"","sources":["../../../../../src/middleware/MiddlewareUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAW,EAAE;IACxC,IAAI,IAAI,GAAW,EAAE,CAAC;IACtB,KAAK,IAAI,C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C;aACnC;iBAAM,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBAC9C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;iBAAM;gBACN,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;aACrC;SACD;KACD;AACF,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAO,MAAc,EAAE,OAAgB,EAAoB,EAAE;IAClG,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3G,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;AACnJ,CAAC,CAAA,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/RedirectHandler.d.ts b/test/dist/es/src/middleware/RedirectHandler.d.ts deleted file mode 100644 index 4f808676c..000000000 --- a/test/dist/es/src/middleware/RedirectHandler.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module RedirectHandler - */ -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; -/** - * @class - * Class - * @implements Middleware - * Class representing RedirectHandler - */ -export declare class RedirectHandler implements Middleware { - /** - * @private - * @static - * A member holding the array of redirect status codes - */ - private static REDIRECT_STATUS_CODES; - /** - * @private - * @static - * A member holding SeeOther status code - */ - private static STATUS_CODE_SEE_OTHER; - /** - * @private - * @static - * A member holding the name of the location header - */ - private static LOCATION_HEADER; - /** - * @private - * @static - * A member representing the authorization header name - */ - private static AUTHORIZATION_HEADER; - /** - * @private - * @static - * A member holding the manual redirect value - */ - private static MANUAL_REDIRECT; - /** - * @private - * A member holding options to customize the handler behavior - */ - private options; - /** - * @private - * A member to hold next middleware in the middleware chain - */ - private nextMiddleware; - /** - * @public - * @constructor - * To create an instance of RedirectHandler - * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance - * @returns An instance of RedirectHandler - */ - constructor(options?: RedirectHandlerOptions); - /** - * @private - * To check whether the response has the redirect status code or not - * @param {Response} response - The response object - * @returns A boolean representing whether the response contains the redirect status code or not - */ - private isRedirect; - /** - * @private - * To check whether the response has location header or not - * @param {Response} response - The response object - * @returns A boolean representing the whether the response has location header or not - */ - private hasLocationHeader; - /** - * @private - * To get the redirect url from location header in response object - * @param {Response} response - The response object - * @returns A redirect url from location header - */ - private getLocationHeader; - /** - * @private - * To check whether the given url is a relative url or not - * @param {string} url - The url string value - * @returns A boolean representing whether the given url is a relative url or not - */ - private isRelativeURL; - /** - * @private - * To check whether the authorization header in the request should be dropped for consequent redirected requests - * @param {string} requestUrl - The request url value - * @param {string} redirectUrl - The redirect url value - * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests - */ - private shouldDropAuthorizationHeader; - /** - * @private - * @async - * To update a request url with the redirect url - * @param {string} redirectUrl - The redirect url value - * @param {Context} context - The context object value - * @returns Nothing - */ - private updateRequestUrl; - /** - * @private - * To get the options for execution of the middleware - * @param {Context} context - The context object - * @returns A options for middleware execution - */ - private getOptions; - /** - * @private - * @async - * To execute the next middleware and to handle in case of redirect response returned by the server - * @param {Context} context - The context object - * @param {number} redirectCount - The redirect count value - * @param {RedirectHandlerOptions} options - The redirect handler options instance - * @returns A promise that resolves to nothing - */ - private executeWithRedirect; - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context: Context): Promise; - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next: Middleware): void; -} diff --git a/test/dist/es/src/middleware/RedirectHandler.js b/test/dist/es/src/middleware/RedirectHandler.js deleted file mode 100644 index 1458d753e..000000000 --- a/test/dist/es/src/middleware/RedirectHandler.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { RequestMethod } from "../RequestMethod"; -import { MiddlewareControl } from "./MiddlewareControl"; -import { cloneRequestWithNewUrl, setRequestHeader } from "./MiddlewareUtil"; -import { RedirectHandlerOptions } from "./options/RedirectHandlerOptions"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; -/** - * @class - * Class - * @implements Middleware - * Class representing RedirectHandler - */ -export class RedirectHandler { - /** - * @public - * @constructor - * To create an instance of RedirectHandler - * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance - * @returns An instance of RedirectHandler - */ - constructor(options = new RedirectHandlerOptions()) { - this.options = options; - } - /** - * @private - * To check whether the response has the redirect status code or not - * @param {Response} response - The response object - * @returns A boolean representing whether the response contains the redirect status code or not - */ - isRedirect(response) { - return RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1; - } - /** - * @private - * To check whether the response has location header or not - * @param {Response} response - The response object - * @returns A boolean representing the whether the response has location header or not - */ - hasLocationHeader(response) { - return response.headers.has(RedirectHandler.LOCATION_HEADER); - } - /** - * @private - * To get the redirect url from location header in response object - * @param {Response} response - The response object - * @returns A redirect url from location header - */ - getLocationHeader(response) { - return response.headers.get(RedirectHandler.LOCATION_HEADER); - } - /** - * @private - * To check whether the given url is a relative url or not - * @param {string} url - The url string value - * @returns A boolean representing whether the given url is a relative url or not - */ - isRelativeURL(url) { - return url.indexOf("://") === -1; - } - /** - * @private - * To check whether the authorization header in the request should be dropped for consequent redirected requests - * @param {string} requestUrl - The request url value - * @param {string} redirectUrl - The redirect url value - * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests - */ - shouldDropAuthorizationHeader(requestUrl, redirectUrl) { - const schemeHostRegex = /^[A-Za-z].+?:\/\/.+?(?=\/|$)/; - const requestMatches = schemeHostRegex.exec(requestUrl); - let requestAuthority; - let redirectAuthority; - if (requestMatches !== null) { - requestAuthority = requestMatches[0]; - } - const redirectMatches = schemeHostRegex.exec(redirectUrl); - if (redirectMatches !== null) { - redirectAuthority = redirectMatches[0]; - } - return typeof requestAuthority !== "undefined" && typeof redirectAuthority !== "undefined" && requestAuthority !== redirectAuthority; - } - /** - * @private - * @async - * To update a request url with the redirect url - * @param {string} redirectUrl - The redirect url value - * @param {Context} context - The context object value - * @returns Nothing - */ - updateRequestUrl(redirectUrl, context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - context.request = typeof context.request === "string" ? redirectUrl : yield cloneRequestWithNewUrl(redirectUrl, context.request); - }); - } - /** - * @private - * To get the options for execution of the middleware - * @param {Context} context - The context object - * @returns A options for middleware execution - */ - getOptions(context) { - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions); - } - if (typeof options === "undefined") { - options = Object.assign(new RedirectHandlerOptions(), this.options); - } - return options; - } - /** - * @private - * @async - * To execute the next middleware and to handle in case of redirect response returned by the server - * @param {Context} context - The context object - * @param {number} redirectCount - The redirect count value - * @param {RedirectHandlerOptions} options - The redirect handler options instance - * @returns A promise that resolves to nothing - */ - executeWithRedirect(context, redirectCount, options) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - yield this.nextMiddleware.execute(context); - const response = context.response; - if (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) { - ++redirectCount; - if (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) { - context.options.method = RequestMethod.GET; - delete context.options.body; - } else { - const redirectUrl = this.getLocationHeader(response); - if (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) { - setRequestHeader(context.request, context.options, RedirectHandler.AUTHORIZATION_HEADER, undefined); - } - yield this.updateRequestUrl(redirectUrl, context); - } - yield this.executeWithRedirect(context, redirectCount, options); - } else { - return; - } - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const redirectCount = 0; - const options = this.getOptions(context); - context.options.redirect = RedirectHandler.MANUAL_REDIRECT; - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED); - return yield this.executeWithRedirect(context, redirectCount, options); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next) { - this.nextMiddleware = next; - } -} -/** - * @private - * @static - * A member holding the array of redirect status codes - */ -RedirectHandler.REDIRECT_STATUS_CODES = [301, 302, 303, 307, 308]; -/** - * @private - * @static - * A member holding SeeOther status code - */ -RedirectHandler.STATUS_CODE_SEE_OTHER = 303; -/** - * @private - * @static - * A member holding the name of the location header - */ -RedirectHandler.LOCATION_HEADER = "Location"; -/** - * @private - * @static - * A member representing the authorization header name - */ -RedirectHandler.AUTHORIZATION_HEADER = "Authorization"; -/** - * @private - * @static - * A member holding the manual redirect value - */ -RedirectHandler.MANUAL_REDIRECT = "manual"; -//# sourceMappingURL=RedirectHandler.js.map diff --git a/test/dist/es/src/middleware/RedirectHandler.js.map b/test/dist/es/src/middleware/RedirectHandler.js.map deleted file mode 100644 index cbc823d73..000000000 --- a/test/dist/es/src/middleware/RedirectHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RedirectHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/RedirectHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAsD3B;;;;;;OAMG;IAEH,YAAmB,UAAkC,IAAI,sBAAsB,EAAE;QAChF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACK,UAAU,CAAC,QAAkB;QACpC,OAAO,eAAe,CAAC,qBAAqB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,QAAkB;QAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,QAAkB;QAC3C,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,eAAe,CAAC,CAA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;qBAAM;oBACN,OAAO;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,MAAM,aAAa,GAAW,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACzC,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC;gBAC3D,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;gBACnG,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;aACvE;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AAzND;;;;GAIG;AACY,qCAAqB,GAAa;IAChD,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACH,CAAC;AAEF;;;;GAIG;AACY,qCAAqB,GAAW,GAAG,CAAC;AAEnD;;;;GAIG;AACY,+BAAe,GAAW,UAAU,CAAC;AAEpD;;;;GAIG;AACY,oCAAoB,GAAW,eAAe,CAAC;AAE9D;;;;GAIG;AACY,+BAAe,GAAoB,QAAQ,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/RetryHandler.d.ts b/test/dist/es/src/middleware/RetryHandler.d.ts deleted file mode 100644 index ffaa37eed..000000000 --- a/test/dist/es/src/middleware/RetryHandler.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module RetryHandler - */ -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; -/** - * @class - * @implements Middleware - * Class for RetryHandler - */ -export declare class RetryHandler implements Middleware { - /** - * @private - * @static - * A list of status codes that needs to be retried - */ - private static RETRY_STATUS_CODES; - /** - * @private - * @static - * A member holding the name of retry attempt header - */ - private static RETRY_ATTEMPT_HEADER; - /** - * @private - * @static - * A member holding the name of retry after header - */ - private static RETRY_AFTER_HEADER; - /** - * @private - * A member to hold next middleware in the middleware chain - */ - private nextMiddleware; - /** - * @private - * A member holding the retry handler options - */ - private options; - /** - * @public - * @constructor - * To create an instance of RetryHandler - * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value - * @returns An instance of RetryHandler - */ - constructor(options?: RetryHandlerOptions); - /** - * - * @private - * To check whether the response has the retry status code - * @param {Response} response - The response object - * @returns Whether the response has retry status code or not - */ - private isRetry; - /** - * @private - * To check whether the payload is buffered or not - * @param {RequestInfo} request - The url string or the request object value - * @param {FetchOptions} options - The options of a request - * @returns Whether the payload is buffered or not - */ - private isBuffered; - /** - * @private - * To get the delay for a retry - * @param {Response} response - The response object - * @param {number} retryAttempts - The current attempt count - * @param {number} delay - The delay value in seconds - * @returns A delay for a retry - */ - private getDelay; - /** - * @private - * To get an exponential back off value - * @param {number} attempts - The current attempt count - * @returns An exponential back off value - */ - private getExponentialBackOffTime; - /** - * @private - * @async - * To add delay for the execution - * @param {number} delaySeconds - The delay value in seconds - * @returns Nothing - */ - private sleep; - private getOptions; - /** - * @private - * @async - * To execute the middleware with retries - * @param {Context} context - The context object - * @param {number} retryAttempts - The current attempt count - * @param {RetryHandlerOptions} options - The retry middleware options instance - * @returns A Promise that resolves to nothing - */ - private executeWithRetry; - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context: Context): Promise; - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next: Middleware): void; -} diff --git a/test/dist/es/src/middleware/RetryHandler.js b/test/dist/es/src/middleware/RetryHandler.js deleted file mode 100644 index abc5c76c9..000000000 --- a/test/dist/es/src/middleware/RetryHandler.js +++ /dev/null @@ -1,189 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { RequestMethod } from "../RequestMethod"; -import { MiddlewareControl } from "./MiddlewareControl"; -import { getRequestHeader, setRequestHeader } from "./MiddlewareUtil"; -import { RetryHandlerOptions } from "./options/RetryHandlerOptions"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; -/** - * @class - * @implements Middleware - * Class for RetryHandler - */ -export class RetryHandler { - /** - * @public - * @constructor - * To create an instance of RetryHandler - * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value - * @returns An instance of RetryHandler - */ - constructor(options = new RetryHandlerOptions()) { - this.options = options; - } - /** - * - * @private - * To check whether the response has the retry status code - * @param {Response} response - The response object - * @returns Whether the response has retry status code or not - */ - isRetry(response) { - return RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1; - } - /** - * @private - * To check whether the payload is buffered or not - * @param {RequestInfo} request - The url string or the request object value - * @param {FetchOptions} options - The options of a request - * @returns Whether the payload is buffered or not - */ - isBuffered(request, options) { - const method = typeof request === "string" ? options.method : request.method; - const isPutPatchOrPost = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST; - if (isPutPatchOrPost) { - const isStream = getRequestHeader(request, options, "Content-Type") === "application/octet-stream"; - if (isStream) { - return false; - } - } - return true; - } - /** - * @private - * To get the delay for a retry - * @param {Response} response - The response object - * @param {number} retryAttempts - The current attempt count - * @param {number} delay - The delay value in seconds - * @returns A delay for a retry - */ - getDelay(response, retryAttempts, delay) { - const getRandomness = () => Number(Math.random().toFixed(3)); - const retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null; - let newDelay; - if (retryAfter !== null) { - // tslint:disable: prefer-conditional-expression - if (Number.isNaN(Number(retryAfter))) { - newDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000); - } else { - newDelay = Number(retryAfter); - } - // tslint:enable: prefer-conditional-expression - } else { - // Adding randomness to avoid retrying at a same - newDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness(); - } - return Math.min(newDelay, this.options.getMaxDelay() + getRandomness()); - } - /** - * @private - * To get an exponential back off value - * @param {number} attempts - The current attempt count - * @returns An exponential back off value - */ - getExponentialBackOffTime(attempts) { - return Math.round((1 / 2) * (Math.pow(2, attempts) - 1)); - } - /** - * @private - * @async - * To add delay for the execution - * @param {number} delaySeconds - The delay value in seconds - * @returns Nothing - */ - sleep(delaySeconds) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const delayMilliseconds = delaySeconds * 1000; - return new Promise((resolve) => setTimeout(resolve, delayMilliseconds)); - }); - } - getOptions(context) { - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(this.options.constructor); - } - if (typeof options === "undefined") { - options = Object.assign(new RetryHandlerOptions(), this.options); - } - return options; - } - /** - * @private - * @async - * To execute the middleware with retries - * @param {Context} context - The context object - * @param {number} retryAttempts - The current attempt count - * @param {RetryHandlerOptions} options - The retry middleware options instance - * @returns A Promise that resolves to nothing - */ - executeWithRetry(context, retryAttempts, options) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - yield this.nextMiddleware.execute(context); - if (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) { - ++retryAttempts; - setRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString()); - const delay = this.getDelay(context.response, retryAttempts, options.delay); - yield this.sleep(delay); - return yield this.executeWithRetry(context, retryAttempts, options); - } else { - return; - } - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const retryAttempts = 0; - const options = this.getOptions(context); - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED); - return yield this.executeWithRetry(context, retryAttempts, options); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next) { - this.nextMiddleware = next; - } -} -/** - * @private - * @static - * A list of status codes that needs to be retried - */ -RetryHandler.RETRY_STATUS_CODES = [429, 503, 504]; -/** - * @private - * @static - * A member holding the name of retry attempt header - */ -RetryHandler.RETRY_ATTEMPT_HEADER = "Retry-Attempt"; -/** - * @private - * @static - * A member holding the name of retry after header - */ -RetryHandler.RETRY_AFTER_HEADER = "Retry-After"; -//# sourceMappingURL=RetryHandler.js.map diff --git a/test/dist/es/src/middleware/RetryHandler.js.map b/test/dist/es/src/middleware/RetryHandler.js.map deleted file mode 100644 index 3c4964721..000000000 --- a/test/dist/es/src/middleware/RetryHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RetryHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/RetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE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E;qBAAM;oBACN,OAAO;iBACP;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,IAAI;gBACH,MAAM,aAAa,GAAW,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAwB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,uBAAuB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;gBAChG,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;aACpE;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAgB;QAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;;AA9LD;;;;GAIG;AACY,+BAAkB,GAAa;IAC7C,GAAG;IACH,GAAG;IACH,GAAG;CACH,CAAC;AAEF;;;;GAIG;AACY,iCAAoB,GAAW,eAAe,CAAC;AAE9D;;;;GAIG;AACY,+BAAkB,GAAW,aAAa,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/TelemetryHandler.d.ts b/test/dist/es/src/middleware/TelemetryHandler.d.ts deleted file mode 100644 index 238381fa7..000000000 --- a/test/dist/es/src/middleware/TelemetryHandler.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module TelemetryHandler - */ -import { Context } from "../IContext"; -import { Middleware } from "./IMiddleware"; -/** - * @class - * @implements Middleware - * Class for TelemetryHandler - */ -export declare class TelemetryHandler implements Middleware { - /** - * @private - * @static - * A member holding the name of the client request id header - */ - private static CLIENT_REQUEST_ID_HEADER; - /** - * @private - * @static - * A member holding the name of the sdk version header - */ - private static SDK_VERSION_HEADER; - /** - * @private - * @static - * A member holding the language prefix for the sdk version header value - */ - private static PRODUCT_NAME; - /** - * @private - * @static - * A member holding the key for the feature usage metrics - */ - private static FEATURE_USAGE_STRING; - /** - * @private - * A member to hold next middleware in the middleware chain - */ - private nextMiddleware; - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context: Context): Promise; - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next: Middleware): void; -} diff --git a/test/dist/es/src/middleware/TelemetryHandler.js b/test/dist/es/src/middleware/TelemetryHandler.js deleted file mode 100644 index 97799773e..000000000 --- a/test/dist/es/src/middleware/TelemetryHandler.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { PACKAGE_VERSION } from "../Version"; -import { MiddlewareControl } from "./MiddlewareControl"; -import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "./MiddlewareUtil"; -import { TelemetryHandlerOptions } from "./options/TelemetryHandlerOptions"; -/** - * @class - * @implements Middleware - * Class for TelemetryHandler - */ -export class TelemetryHandler { - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The context object of the request - * @returns A Promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - let clientRequestId = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER); - if (clientRequestId === null) { - clientRequestId = generateUUID(); - setRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId); - } - let sdkVersionValue = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`; - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); - } - if (typeof options !== "undefined") { - const featureUsage = options.getFeatureUsage(); - sdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`; - } - appendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue); - return yield this.nextMiddleware.execute(context); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To set the next middleware in the chain - * @param {Middleware} next - The middleware instance - * @returns Nothing - */ - setNext(next) { - this.nextMiddleware = next; - } -} -/** - * @private - * @static - * A member holding the name of the client request id header - */ -TelemetryHandler.CLIENT_REQUEST_ID_HEADER = "client-request-id"; -/** - * @private - * @static - * A member holding the name of the sdk version header - */ -TelemetryHandler.SDK_VERSION_HEADER = "SdkVersion"; -/** - * @private - * @static - * A member holding the language prefix for the sdk version header value - */ -TelemetryHandler.PRODUCT_NAME = "graph-js"; -/** - * @private - * @static - * A member holding the key for the feature usage metrics - */ -TelemetryHandler.FEATURE_USAGE_STRING = "featureUsage"; -//# sourceMappingURL=TelemetryHandler.js.map diff --git a/test/dist/es/src/middleware/TelemetryHandler.js.map b/test/dist/es/src/middleware/TelemetryHandler.js.map deleted file mode 100644 index 762ec9cde..000000000 --- a/test/dist/es/src/middleware/TelemetryHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TelemetryHandler.js","sourceRoot":"","sources":["../../../../../src/middleware/TelemetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAA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Y,yCAAwB,GAAG,mBAAmB,CAAC;AAE9D;;;;GAIG;AACY,mCAAkB,GAAG,YAAY,CAAC;AAEjD;;;;GAIG;AACY,6BAAY,GAAG,UAAU,CAAC;AAEzC;;;;GAIG;AACY,qCAAoB,GAAG,cAAc,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts deleted file mode 100644 index cab6d3b8a..000000000 --- a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module AuthenticationHandlerOptions - */ -import { AuthenticationProvider } from "../../IAuthenticationProvider"; -import { AuthenticationProviderOptions } from "../../IAuthenticationProviderOptions"; -import { MiddlewareOptions } from "./IMiddlewareOptions"; -/** - * @class - * @implements MiddlewareOptions - * Class representing AuthenticationHandlerOptions - */ -export declare class AuthenticationHandlerOptions implements MiddlewareOptions { - /** - * @public - * A member holding an instance of an authentication provider - */ - authenticationProvider: AuthenticationProvider; - /** - * @public - * A member holding an instance of authentication provider options - */ - authenticationProviderOptions: AuthenticationProviderOptions; - /** - * @public - * @constructor - * To create an instance of AuthenticationHandlerOptions - * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance - * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance - * @returns An instance of AuthenticationHandlerOptions - */ - constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions); -} diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js deleted file mode 100644 index e7c0a3391..000000000 --- a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * @implements MiddlewareOptions - * Class representing AuthenticationHandlerOptions - */ -export class AuthenticationHandlerOptions { - /** - * @public - * @constructor - * To create an instance of AuthenticationHandlerOptions - * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance - * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance - * @returns An instance of AuthenticationHandlerOptions - */ - constructor(authenticationProvider, authenticationProviderOptions) { - this.authenticationProvider = authenticationProvider; - this.authenticationProviderOptions = authenticationProviderOptions; - } -} -//# sourceMappingURL=AuthenticationHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map b/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map deleted file mode 100644 index 5903c3b3f..000000000 --- a/test/dist/es/src/middleware/options/AuthenticationHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuthenticationHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/AuthenticationHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;;;GAIG;AACH,MAAM,OAAO,4BAA4B;IAaxC;;;;;;;OAOG;IACH,YAAmB,sBAA+C,EAAE,6BAA6D;QAChI,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;IACpE,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts b/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts deleted file mode 100644 index 715c7021b..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerData.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosHandlerData - */ -/** - * Contains RequestMethod to corresponding array of possible status codes, used for Random mode - */ -export declare const methodStatusCode: { - [key: string]: number[]; -}; -/** - * Contains statusCode to statusMessage map - */ -export declare const httpStatusCode: { - [key: number]: string; -}; diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.js b/test/dist/es/src/middleware/options/ChaosHandlerData.js deleted file mode 100644 index d3452a647..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerData.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosHandlerData - */ -/** - * Contains RequestMethod to corresponding array of possible status codes, used for Random mode - */ -export const methodStatusCode = { - GET: [429, 500, 502, 503, 504], - POST: [429, 500, 502, 503, 504, 507], - PUT: [429, 500, 502, 503, 504, 507], - PATCH: [429, 500, 502, 503, 504], - DELETE: [429, 500, 502, 503, 504, 507], -}; -/** - * Contains statusCode to statusMessage map - */ -export const httpStatusCode = { - 100: "Continue", - 101: "Switching Protocols", - 102: "Processing", - 103: "Early Hints", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 208: "Already Reported", - 226: "IM Used", - 300: "Multiple Choices", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 308: "Permanent Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Payload Too Large", - 414: "URI Too Long", - 415: "Unsupported Media Type", - 416: "Range Not Satisfiable", - 417: "Expectation Failed", - 421: "Misdirected Request", - 422: "Unprocessable Entity", - 423: "Locked", - 424: "Failed Dependency", - 425: "Too Early", - 426: "Upgrade Required", - 428: "Precondition Required", - 429: "Too Many Requests", - 431: "Request Header Fields Too Large", - 451: "Unavailable For Legal Reasons", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported", - 506: "Variant Also Negotiates", - 507: "Insufficient Storage", - 508: "Loop Detected", - 510: "Not Extended", - 511: "Network Authentication Required", -}; -//# sourceMappingURL=ChaosHandlerData.js.map diff --git a/test/dist/es/src/middleware/options/ChaosHandlerData.js.map b/test/dist/es/src/middleware/options/ChaosHandlerData.js.map deleted file mode 100644 index a05acfba9..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerData.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ChaosHandlerData.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosHandlerData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgC;IAC5D,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC9B,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACpC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,C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,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,iCAAiC;IACtC,GAAG,EAAE,+BAA+B;IACpC,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,4BAA4B;IACjC,GAAG,EAAE,yBAAyB;IAC9B,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,iCAAiC;CACtC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts b/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts deleted file mode 100644 index 2b16ba627..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerOptions.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosHandlerOptions - */ -import { ChaosStrategy } from "./ChaosStrategy"; -import { MiddlewareOptions } from "./IMiddlewareOptions"; -/** - * Class representing ChaosHandlerOptions - * @class - * Class - * @implements MiddlewareOptions - */ -export declare class ChaosHandlerOptions implements MiddlewareOptions { - /** - * Specifies the startegy used for the Testing Handler -> RANDOM/MANUAL - * - * @public - */ - chaosStrategy: ChaosStrategy; - /** - * Status code to be returned in the response - * - * @public - */ - statusCode: number; - /** - * The Message to be returned in the response - * - * @public - */ - statusMessage: string; - /** - * The percentage of randomness/chaos in the handler - * - * Setting the default value as 10% - * @public - */ - chaosPercentage: number; - /** - * The response body to be returned in the response - * - * @public - */ - responseBody: any; - /** - * @public - * @constructor - * To create an instance of Testing Handler Options - * @param {ChaosStrategy} ChaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL - * @param {string} statusMessage - The Message to be returned in the response - * @param {number?} statusCode - The statusCode to be returned in the response - * @param {number?} chaosPercentage - The percentage of randomness/chaos in the handler - * @param {any?} responseBody - The response body to be returned in the response - * @returns An instance of ChaosHandlerOptions - */ - constructor(chaosStrategy?: ChaosStrategy, statusMessage?: string, statusCode?: number, chaosPercentage?: number, responseBody?: any); -} diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js deleted file mode 100644 index 1003f10d4..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosHandlerOptions - */ -import { ChaosStrategy } from "./ChaosStrategy"; -/** - * Class representing ChaosHandlerOptions - * @class - * Class - * @implements MiddlewareOptions - */ -export class ChaosHandlerOptions { - /** - * @public - * @constructor - * To create an instance of Testing Handler Options - * @param {ChaosStrategy} ChaosStrategy - Specifies the startegy used for the Testing Handler -> RAMDOM/MANUAL - * @param {string} statusMessage - The Message to be returned in the response - * @param {number?} statusCode - The statusCode to be returned in the response - * @param {number?} chaosPercentage - The percentage of randomness/chaos in the handler - * @param {any?} responseBody - The response body to be returned in the response - * @returns An instance of ChaosHandlerOptions - */ - constructor(chaosStrategy = ChaosStrategy.RANDOM, statusMessage = "Some error Happened", statusCode, chaosPercentage, responseBody) { - this.chaosStrategy = chaosStrategy; - this.statusCode = statusCode; - this.statusMessage = statusMessage; - this.chaosPercentage = chaosPercentage !== undefined ? chaosPercentage : 10; - this.responseBody = responseBody; - if (this.chaosPercentage > 100) { - throw new Error("Error Pecentage can not be more than 100"); - } - } -} -//# sourceMappingURL=ChaosHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map b/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map deleted file mode 100644 index 7ad1d9877..000000000 --- a/test/dist/es/src/middleware/options/ChaosHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ChaosHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAqC/B;;;;;;;;;;OAUG;IACH,YAAmB,gBAA+B,aAAa,CAAC,MAAM,EAAE,gBAAwB,qBAAqB,EAAE,UAAmB,EAAE,eAAwB,EAAE,YAAkB;QACvL,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,IAAI,CAAC,eAAe,GAAG,GAAG,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC5D;IACF,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.d.ts b/test/dist/es/src/middleware/options/ChaosStrategy.d.ts deleted file mode 100644 index 6d6d3f38f..000000000 --- a/test/dist/es/src/middleware/options/ChaosStrategy.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosStrategy - */ -/** - * Strategy used for Testing Handler - * @enum - */ -export declare enum ChaosStrategy { - MANUAL = 0, - RANDOM = 1, -} diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.js b/test/dist/es/src/middleware/options/ChaosStrategy.js deleted file mode 100644 index 986a693a6..000000000 --- a/test/dist/es/src/middleware/options/ChaosStrategy.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module ChaosStrategy - */ -/** - * Strategy used for Testing Handler - * @enum - */ -export var ChaosStrategy; -(function(ChaosStrategy) { - ChaosStrategy[(ChaosStrategy["MANUAL"] = 0)] = "MANUAL"; - ChaosStrategy[(ChaosStrategy["RANDOM"] = 1)] = "RANDOM"; -})(ChaosStrategy || (ChaosStrategy = {})); -//# sourceMappingURL=ChaosStrategy.js.map diff --git a/test/dist/es/src/middleware/options/ChaosStrategy.js.map b/test/dist/es/src/middleware/options/ChaosStrategy.js.map deleted file mode 100644 index 927bc5846..000000000 --- a/test/dist/es/src/middleware/options/ChaosStrategy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ChaosStrategy.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/ChaosStrategy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACxB,qDAAM,CAAA;IACN,qDAAM,CAAA;AACP,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts b/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts deleted file mode 100644 index 277236bdc..000000000 --- a/test/dist/es/src/middleware/options/IMiddlewareOptions.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @interface - * Signature representing the middleware options - */ -export interface MiddlewareOptions {} diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.js b/test/dist/es/src/middleware/options/IMiddlewareOptions.js deleted file mode 100644 index 6af75b995..000000000 --- a/test/dist/es/src/middleware/options/IMiddlewareOptions.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -//# sourceMappingURL=IMiddlewareOptions.js.map diff --git a/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map b/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map deleted file mode 100644 index 560447882..000000000 --- a/test/dist/es/src/middleware/options/IMiddlewareOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IMiddlewareOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/IMiddlewareOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts b/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts deleted file mode 100644 index c3bde4cae..000000000 --- a/test/dist/es/src/middleware/options/RedirectHandlerOptions.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module RedirectHandlerOptions - */ -import { MiddlewareOptions } from "./IMiddlewareOptions"; -/** - * @type - * A type declaration for shouldRetry callback - */ -export declare type ShouldRedirect = (response: Response) => boolean; -/** - * @class - * @implements MiddlewareOptions - * A class representing RedirectHandlerOptions - */ -export declare class RedirectHandlerOptions implements MiddlewareOptions { - /** - * @private - * @static - * A member holding default max redirects value - */ - private static DEFAULT_MAX_REDIRECTS; - /** - * @private - * @static - * A member holding maximum max redirects value - */ - private static MAX_MAX_REDIRECTS; - /** - * @public - * A member holding max redirects value - */ - maxRedirects: number; - /** - * @public - * A member holding shouldRedirect callback - */ - shouldRedirect: ShouldRedirect; - /** - * @private - * A member holding default shouldRedirect callback - */ - private static DEFAULT_SHOULD_RETRY; - /** - * @public - * @constructor - * To create an instance of RedirectHandlerOptions - * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value - * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback - * @returns An instance of RedirectHandlerOptions - */ - constructor(maxRedirects?: number, shouldRedirect?: ShouldRedirect); -} diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js deleted file mode 100644 index cac35599f..000000000 --- a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * @implements MiddlewareOptions - * A class representing RedirectHandlerOptions - */ -export class RedirectHandlerOptions { - /** - * @public - * @constructor - * To create an instance of RedirectHandlerOptions - * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value - * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback - * @returns An instance of RedirectHandlerOptions - */ - constructor(maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY) { - if (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) { - const error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`); - error.name = "MaxLimitExceeded"; - throw error; - } - if (maxRedirects < 0) { - const error = new Error(`MaxRedirects should not be negative`); - error.name = "MinExpectationNotMet"; - throw error; - } - this.maxRedirects = maxRedirects; - this.shouldRedirect = shouldRedirect; - } -} -/** - * @private - * @static - * A member holding default max redirects value - */ -RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS = 5; -/** - * @private - * @static - * A member holding maximum max redirects value - */ -RedirectHandlerOptions.MAX_MAX_REDIRECTS = 20; -/** - * @private - * A member holding default shouldRedirect callback - */ -RedirectHandlerOptions.DEFAULT_SHOULD_RETRY = () => true; -//# sourceMappingURL=RedirectHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map b/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map deleted file mode 100644 index 2bb2a79a4..000000000 --- a/test/dist/es/src/middleware/options/RedirectHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RedirectHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/RedirectHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAiClC;;;;;;;OAOG;IACH,YAAmB,eAAuB,sBAAsB,CAAC,qBAAqB,EAAE,iBAAiC,sBAAsB,CAAC,oBAAoB;QACnK,IAAI,YAAY,GAAG,sBAAsB,CAAC,iBAAiB,EAAE;YAC5D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,wCAAwC,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,CAAC;YAC5G,KAAK,CAAC,IAAI,GAAG,kBAAkB,CAAC;YAChC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,YAAY,GAAG,CAAC,EAAE;YACrB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YAC/D,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACtC,CAAC;;AArDD;;;;GAIG;AACY,4CAAqB,GAAW,CAAC,CAAC;AAEjD;;;;GAIG;AACY,wCAAiB,GAAW,EAAE,CAAC;AAc9C;;;GAGG;AACY,2CAAoB,GAAmB,GAAG,EAAE,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts b/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts deleted file mode 100644 index 0f0359697..000000000 --- a/test/dist/es/src/middleware/options/RetryHandlerOptions.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module RetryHandlerOptions - */ -import { FetchOptions } from "../../IFetchOptions"; -import { MiddlewareOptions } from "./IMiddlewareOptions"; -/** - * @type - * A type declaration for shouldRetry callback - */ -export declare type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean; -/** - * @class - * @implements MiddlewareOptions - * Class for RetryHandlerOptions - */ -export declare class RetryHandlerOptions implements MiddlewareOptions { - /** - * @private - * @static - * A member holding default delay value in seconds - */ - private static DEFAULT_DELAY; - /** - * @private - * @static - * A member holding default maxRetries value - */ - private static DEFAULT_MAX_RETRIES; - /** - * @private - * @static - * A member holding maximum delay value in seconds - */ - private static MAX_DELAY; - /** - * @private - * @static - * A member holding maximum maxRetries value - */ - private static MAX_MAX_RETRIES; - /** - * @public - * A member holding delay value in seconds - */ - delay: number; - /** - * @public - * A member holding maxRetries value - */ - maxRetries: number; - /** - * @public - * A member holding shouldRetry callback - */ - shouldRetry: ShouldRetry; - /** - * @private - * A member holding default shouldRetry callback - */ - private static DEFAULT_SHOULD_RETRY; - /** - * @public - * @constructor - * To create an instance of RetryHandlerOptions - * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds - * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value - * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function - * @returns An instance of RetryHandlerOptions - */ - constructor(delay?: number, maxRetries?: number, shouldRetry?: ShouldRetry); - /** - * @public - * To get the maximum delay - * @returns A maximum delay - */ - getMaxDelay(): number; -} diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.js b/test/dist/es/src/middleware/options/RetryHandlerOptions.js deleted file mode 100644 index 79bfa9b6f..000000000 --- a/test/dist/es/src/middleware/options/RetryHandlerOptions.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * @implements MiddlewareOptions - * Class for RetryHandlerOptions - */ -export class RetryHandlerOptions { - /** - * @public - * @constructor - * To create an instance of RetryHandlerOptions - * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds - * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value - * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function - * @returns An instance of RetryHandlerOptions - */ - constructor(delay = RetryHandlerOptions.DEFAULT_DELAY, maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY) { - if (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) { - const error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`); - error.name = "MaxLimitExceeded"; - throw error; - } else if (delay > RetryHandlerOptions.MAX_DELAY) { - const error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`); - error.name = "MaxLimitExceeded"; - throw error; - } else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) { - const error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`); - error.name = "MaxLimitExceeded"; - throw error; - } else if (delay < 0 && maxRetries < 0) { - const error = new Error(`Delay and MaxRetries should not be negative`); - error.name = "MinExpectationNotMet"; - throw error; - } else if (delay < 0) { - const error = new Error(`Delay should not be negative`); - error.name = "MinExpectationNotMet"; - throw error; - } else if (maxRetries < 0) { - const error = new Error(`MaxRetries should not be negative`); - error.name = "MinExpectationNotMet"; - throw error; - } - this.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY); - this.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES); - this.shouldRetry = shouldRetry; - } - /** - * @public - * To get the maximum delay - * @returns A maximum delay - */ - getMaxDelay() { - return RetryHandlerOptions.MAX_DELAY; - } -} -/** - * @private - * @static - * A member holding default delay value in seconds - */ -RetryHandlerOptions.DEFAULT_DELAY = 3; -/** - * @private - * @static - * A member holding default maxRetries value - */ -RetryHandlerOptions.DEFAULT_MAX_RETRIES = 3; -/** - * @private - * @static - * A member holding maximum delay value in seconds - */ -RetryHandlerOptions.MAX_DELAY = 180; -/** - * @private - * @static - * A member holding maximum maxRetries value - */ -RetryHandlerOptions.MAX_MAX_RETRIES = 10; -/** - * @private - * A member holding default shouldRetry callback - */ -RetryHandlerOptions.DEFAULT_SHOULD_RETRY = () => true; -//# sourceMappingURL=RetryHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map b/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map deleted file mode 100644 index e5f12069b..000000000 --- a/test/dist/es/src/middleware/options/RetryHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"R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KAAK,GAAG,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YACxD,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;aAAM,IAAI,UAAU,GAAG,CAAC,EAAE;YAC1B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAC7D,KAAK,CAAC,IAAI,GAAG,sBAAsB,CAAC;YACpC,MAAM,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;QAC5E,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,WAAW;QACjB,OAAO,mBAAmB,CAAC,SAAS,CAAC;IACtC,CAAC;;AAnGD;;;;GAIG;AACY,iCAAa,GAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACY,uCAAmB,GAAW,CAAC,CAAC;AAE/C;;;;GAIG;AACY,6BAAS,GAAW,GAAG,CAAC;AAEvC;;;;GAIG;AACY,mCAAe,GAAW,EAAE,CAAC;AAoB5C;;;GAGG;AACY,wCAAoB,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts deleted file mode 100644 index 4331b4feb..000000000 --- a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module TelemetryHandlerOptions - */ -import { Context } from "../../IContext"; -import { MiddlewareOptions } from "./IMiddlewareOptions"; -/** - * @enum - * @property {number} NONE - The hexadecimal flag value for nothing enabled - * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled - * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled - * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled - */ -export declare enum FeatureUsageFlag { - NONE = 0, - REDIRECT_HANDLER_ENABLED = 1, - RETRY_HANDLER_ENABLED = 2, - AUTHENTICATION_HANDLER_ENABLED = 4, -} -/** - * @class - * @implements MiddlewareOptions - * Class for TelemetryHandlerOptions - */ -export declare class TelemetryHandlerOptions implements MiddlewareOptions { - /** - * @private - * A member to hold the OR of feature usage flags - */ - private featureUsage; - /** - * @public - * @static - * To update the feature usage in the context object - * @param {Context} context - The request context object containing middleware options - * @param {FeatureUsageFlag} flag - The flag value - * @returns nothing - */ - static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void; - /** - * @private - * To set the feature usage flag - * @param {FeatureUsageFlag} flag - The flag value - * @returns nothing - */ - private setFeatureUsage; - /** - * @public - * To get the feature usage - * @returns A feature usage flag as hexadecimal string - */ - getFeatureUsage(): string; -} diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js deleted file mode 100644 index 9d3b929ac..000000000 --- a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { MiddlewareControl } from "../MiddlewareControl"; -/** - * @enum - * @property {number} NONE - The hexadecimal flag value for nothing enabled - * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled - * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled - * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled - */ -export var FeatureUsageFlag; -(function(FeatureUsageFlag) { - FeatureUsageFlag[(FeatureUsageFlag["NONE"] = 0)] = "NONE"; - FeatureUsageFlag[(FeatureUsageFlag["REDIRECT_HANDLER_ENABLED"] = 1)] = "REDIRECT_HANDLER_ENABLED"; - FeatureUsageFlag[(FeatureUsageFlag["RETRY_HANDLER_ENABLED"] = 2)] = "RETRY_HANDLER_ENABLED"; - FeatureUsageFlag[(FeatureUsageFlag["AUTHENTICATION_HANDLER_ENABLED"] = 4)] = "AUTHENTICATION_HANDLER_ENABLED"; -})(FeatureUsageFlag || (FeatureUsageFlag = {})); -/** - * @class - * @implements MiddlewareOptions - * Class for TelemetryHandlerOptions - */ -export class TelemetryHandlerOptions { - constructor() { - /** - * @private - * A member to hold the OR of feature usage flags - */ - this.featureUsage = FeatureUsageFlag.NONE; - } - /** - * @public - * @static - * To update the feature usage in the context object - * @param {Context} context - The request context object containing middleware options - * @param {FeatureUsageFlag} flag - The flag value - * @returns nothing - */ - static updateFeatureUsageFlag(context, flag) { - let options; - if (context.middlewareControl instanceof MiddlewareControl) { - options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); - } else { - context.middlewareControl = new MiddlewareControl(); - } - if (typeof options === "undefined") { - options = new TelemetryHandlerOptions(); - context.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options); - } - options.setFeatureUsage(flag); - } - /** - * @private - * To set the feature usage flag - * @param {FeatureUsageFlag} flag - The flag value - * @returns nothing - */ - setFeatureUsage(flag) { - /* tslint:disable: no-bitwise */ - this.featureUsage = this.featureUsage | flag; - /* tslint:enable: no-bitwise */ - } - /** - * @public - * To get the feature usage - * @returns A feature usage flag as hexadecimal string - */ - getFeatureUsage() { - return this.featureUsage.toString(16); - } -} -//# sourceMappingURL=TelemetryHandlerOptions.js.map diff --git a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map b/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map deleted file mode 100644 index beff023b0..000000000 --- a/test/dist/es/src/middleware/options/TelemetryHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TelemetryHandlerOptions.js","sourceRoot":"","sources":["../../../../../../src/middleware/options/TelemetryHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,uDAAU,CAAA;IACV,+FAA8B,CAAA;IAC9B,yFAA2B,CAAA;IAC3B,2GAAoC,CAAA;AACrC,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;;;GAIG;AAEH,MAAM,OAAO,uBAAuB;IAApC;QACC;;;WAGG;QACK,iBAAY,GAAqB,gBAAgB,CAAC,IAAI,CAAC;IA4ChE,CAAC;IA1CA;;;;;;;OAOG;IACI,MAAM,CAAC,sBAAsB,CAAC,OAAgB,EAAE,IAAsB;QAC5E,IAAI,OAAgC,CAAC;QACrC,IAAI,OAAO,CAAC,iBAAiB,YAAY,iBAAiB,EAAE;YAC3D,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,uBAAuB,CAA4B,CAAC;SAC7G;aAAM;YACN,OAAO,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;SACpD;QACD,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;YACnC,OAAO,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACxC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;SACjF;QACD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACK,eAAe,CAAC,IAAsB;QAC7C,gCAAgC;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7C,+BAA+B;IAChC,CAAC;IAED;;;;OAIG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.d.ts b/test/dist/es/src/tasks/LargeFileUploadTask.d.ts deleted file mode 100644 index abcff1cf5..000000000 --- a/test/dist/es/src/tasks/LargeFileUploadTask.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module LargeFileUploadTask - */ -import { Client } from "../index"; -import { Range } from "../Range"; -/** - * @interface - * Signature to representing key value pairs - * @property {[key: string] : string | number} - The Key value pair - */ -interface KeyValuePairObjectStringNumber { - [key: string]: string | number; -} -/** - * @interface - * Signature to define options for upload task - * @property {number} [rangeSize = LargeFileUploadTask.DEFAULT_FILE_SIZE] - Specifies the range chunk size - */ -export interface LargeFileUploadTaskOptions { - rangeSize?: number; -} -/** - * @interface - * Signature to represent upload session resulting from the session creation in the server - * @property {string} url - The URL to which the file upload is made - * @property {Date} expiry - The expiration of the time of the upload session - */ -export interface LargeFileUploadSession { - url: string; - expiry: Date; -} -/** - * @interface - * Signature to define the properties and content of the file in upload task - * @property {ArrayBuffer | File} content - The actual file content - * @property {string} name - Specifies the file name with extension - * @property {number} size - Specifies size of the file - */ -export interface FileObject { - content: ArrayBuffer | File; - name: string; - size: number; -} -/** - * @class - * Class representing LargeFileUploadTask - */ -export declare class LargeFileUploadTask { - /** - * @private - * Default value for the rangeSize - */ - private DEFAULT_FILE_SIZE; - /** - * @protected - * The GraphClient instance - */ - protected client: Client; - /** - * @protected - * The object holding file details - */ - protected file: FileObject; - /** - * @protected - * The object holding options for the task - */ - protected options: LargeFileUploadTaskOptions; - /** - * @protected - * The object for upload session - */ - protected uploadSession: LargeFileUploadSession; - /** - * @protected - * The next range needs to be uploaded - */ - protected nextRange: Range; - /** - * @public - * @static - * @async - * Makes request to the server to create an upload session - * @param {Client} client - The GraphClient instance - * @param {any} payload - The payload that needs to be sent - * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent - * @returns The promise that resolves to LargeFileUploadSession - */ - static createUploadSession(client: Client, requestUrl: string, payload: any, headers?: KeyValuePairObjectStringNumber): Promise; - /** - * @public - * @constructor - * Constructs a LargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded - * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done - * @param {LargeFileUploadTaskOptions} options - The upload task options - * @returns An instance of LargeFileUploadTask - */ - constructor(client: Client, file: FileObject, uploadSession: LargeFileUploadSession, options?: LargeFileUploadTaskOptions); - /** - * @private - * Parses given range string to the Range instance - * @param {string[]} ranges - The ranges value - * @returns The range instance - */ - private parseRange; - /** - * @private - * Updates the expiration date and the next range - * @param {UploadStatusResponse} response - The response of the upload status - * @returns Nothing - */ - private updateTaskStatus; - /** - * @public - * Gets next range that needs to be uploaded - * @returns The range instance - */ - getNextRange(): Range; - /** - * @public - * Slices the file content to the given range - * @param {Range} range - The range value - * @returns The sliced ArrayBuffer or Blob - */ - sliceFile(range: Range): ArrayBuffer | Blob; - /** - * @public - * @async - * Uploads file to the server in a sequential order by slicing the file - * @returns The promise resolves to uploaded response - */ - upload(): Promise; - /** - * @public - * @async - * Uploads given slice to the server - * @param {ArrayBuffer | Blob | File} fileSlice - The file slice - * @param {Range} range - The range value - * @param {number} totalSize - The total size of a complete file - */ - uploadSlice(fileSlice: ArrayBuffer | Blob | File, range: Range, totalSize: number): Promise; - /** - * @public - * @async - * Deletes upload session in the server - * @returns The promise resolves to cancelled response - */ - cancel(): Promise; - /** - * @public - * @async - * Gets status for the upload session - * @returns The promise resolves to the status enquiry response - */ - getStatus(): Promise; - /** - * @public - * @async - * Resumes upload session and continue uploading the file from the last sent range - * @returns The promise resolves to the uploaded response - */ - resume(): Promise; -} -export {}; diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.js b/test/dist/es/src/tasks/LargeFileUploadTask.js deleted file mode 100644 index 8db182747..000000000 --- a/test/dist/es/src/tasks/LargeFileUploadTask.js +++ /dev/null @@ -1,223 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { Range } from "../Range"; -/** - * @class - * Class representing LargeFileUploadTask - */ -export class LargeFileUploadTask { - /** - * @public - * @constructor - * Constructs a LargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded - * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done - * @param {LargeFileUploadTaskOptions} options - The upload task options - * @returns An instance of LargeFileUploadTask - */ - constructor(client, file, uploadSession, options = {}) { - /** - * @private - * Default value for the rangeSize - */ - this.DEFAULT_FILE_SIZE = 5 * 1024 * 1024; - this.client = client; - this.file = file; - if (options.rangeSize === undefined) { - options.rangeSize = this.DEFAULT_FILE_SIZE; - } - this.options = options; - this.uploadSession = uploadSession; - this.nextRange = new Range(0, this.options.rangeSize - 1); - } - /** - * @public - * @static - * @async - * Makes request to the server to create an upload session - * @param {Client} client - The GraphClient instance - * @param {any} payload - The payload that needs to be sent - * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent - * @returns The promise that resolves to LargeFileUploadSession - */ - static createUploadSession(client, requestUrl, payload, headers = {}) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const session = yield client - .api(requestUrl) - .headers(headers) - .post(payload); - const largeFileUploadSession = { - url: session.uploadUrl, - expiry: new Date(session.expirationDateTime), - }; - return largeFileUploadSession; - } catch (err) { - throw err; - } - }); - } - /** - * @private - * Parses given range string to the Range instance - * @param {string[]} ranges - The ranges value - * @returns The range instance - */ - parseRange(ranges) { - const rangeStr = ranges[0]; - if (typeof rangeStr === "undefined" || rangeStr === "") { - return new Range(); - } - const firstRange = rangeStr.split("-"); - const minVal = parseInt(firstRange[0], 10); - let maxVal = parseInt(firstRange[1], 10); - if (Number.isNaN(maxVal)) { - maxVal = this.file.size - 1; - } - return new Range(minVal, maxVal); - } - /** - * @private - * Updates the expiration date and the next range - * @param {UploadStatusResponse} response - The response of the upload status - * @returns Nothing - */ - updateTaskStatus(response) { - this.uploadSession.expiry = new Date(response.expirationDateTime); - this.nextRange = this.parseRange(response.nextExpectedRanges); - } - /** - * @public - * Gets next range that needs to be uploaded - * @returns The range instance - */ - getNextRange() { - if (this.nextRange.minValue === -1) { - return this.nextRange; - } - const minVal = this.nextRange.minValue; - let maxValue = minVal + this.options.rangeSize - 1; - if (maxValue >= this.file.size) { - maxValue = this.file.size - 1; - } - return new Range(minVal, maxValue); - } - /** - * @public - * Slices the file content to the given range - * @param {Range} range - The range value - * @returns The sliced ArrayBuffer or Blob - */ - sliceFile(range) { - const blob = this.file.content.slice(range.minValue, range.maxValue + 1); - return blob; - } - /** - * @public - * @async - * Uploads file to the server in a sequential order by slicing the file - * @returns The promise resolves to uploaded response - */ - upload() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - while (true) { - const nextRange = this.getNextRange(); - if (nextRange.maxValue === -1) { - const err = new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file"); - err.name = "Invalid Session"; - throw err; - } - const fileSlice = this.sliceFile(nextRange); - const response = yield this.uploadSlice(fileSlice, nextRange, this.file.size); - // Upon completion of upload process incase of onedrive, driveItem is returned, which contains id - if (response.id !== undefined) { - return response; - } else { - this.updateTaskStatus(response); - } - } - } catch (err) { - throw err; - } - }); - } - /** - * @public - * @async - * Uploads given slice to the server - * @param {ArrayBuffer | Blob | File} fileSlice - The file slice - * @param {Range} range - The range value - * @param {number} totalSize - The total size of a complete file - */ - uploadSlice(fileSlice, range, totalSize) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return yield this.client - .api(this.uploadSession.url) - .headers({ - "Content-Length": `${range.maxValue - range.minValue + 1}`, - "Content-Range": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`, - }) - .put(fileSlice); - } catch (err) { - throw err; - } - }); - } - /** - * @public - * @async - * Deletes upload session in the server - * @returns The promise resolves to cancelled response - */ - cancel() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return yield this.client.api(this.uploadSession.url).delete(); - } catch (err) { - throw err; - } - }); - } - /** - * @public - * @async - * Gets status for the upload session - * @returns The promise resolves to the status enquiry response - */ - getStatus() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const response = yield this.client.api(this.uploadSession.url).get(); - this.updateTaskStatus(response); - return response; - } catch (err) { - throw err; - } - }); - } - /** - * @public - * @async - * Resumes upload session and continue uploading the file from the last sent range - * @returns The promise resolves to the uploaded response - */ - resume() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - yield this.getStatus(); - return yield this.upload(); - } catch (err) { - throw err; - } - }); - } -} -//# sourceMappingURL=LargeFileUploadTask.js.map diff --git a/test/dist/es/src/tasks/LargeFileUploadTask.js.map b/test/dist/es/src/tasks/LargeFileUploadTask.js.map deleted file mode 100644 index 2cca17b24..000000000 --- a/test/dist/es/src/tasks/LargeFileUploadTask.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../src/tasks/LargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAOH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAuDjC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA+D/B;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,IAAgB,EAAE,aAAqC,EAAE,UAAsC,EAAE;QAxEpI;;;W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CAAC;qBACD,GAAG,CAAC,SAAS,CAAC,CAAC;aACjB;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM;;YAClB,IAAI;gBACH,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;aAC9D;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,SAAS;;YACrB,IAAI;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;gBACrE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBAChC,OAAO,QAAQ,CAAC;aAChB;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;IAED;;;;;OAKG;IACU,MAAM;;YAClB,IAAI;gBACH,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;gBACvB,OAAO,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;aAC3B;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts deleted file mode 100644 index 5726eeebd..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/// -/** - * @module OneDriveLargeFileUploadTask - */ -import { Client } from "../index"; -import { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from "./LargeFileUploadTask"; -/** - * @interface - * Signature to define options when creating an upload task - * @property {string} fileName - Specifies the name of a file to be uploaded (with extension) - * @property {string} [path] - The path to which the file needs to be uploaded - * @property {number} [rangeSize] - Specifies the range chunk size - */ -interface OneDriveLargeFileUploadOptions { - fileName: string; - path?: string; - rangeSize?: number; -} -/** - * @class - * Class representing OneDriveLargeFileUploadTask - */ -export declare class OneDriveLargeFileUploadTask extends LargeFileUploadTask { - /** - * @private - * @static - * Default path for the file being uploaded - */ - private static DEFAULT_UPLOAD_PATH; - /** - * @private - * @static - * Constructs the create session url for Onedrive - * @param {string} fileName - The name of the file - * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload - * @returns The constructed create session url - */ - private static constructCreateSessionUrl; - /** - * @public - * @static - * @async - * Creates a OneDriveLargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {Blob | Buffer | File} file - File represented as Blob, Buffer or File - * @param {OneDriveLargeFileUploadOptions} options - The options for upload task - * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance - */ - static create(client: Client, file: Blob | Buffer | File, options: OneDriveLargeFileUploadOptions): Promise; - /** - * @public - * @static - * @async - * Makes request to the server to create an upload session - * @param {Client} client - The GraphClient instance - * @param {string} requestUrl - The URL to create the upload session - * @param {string} fileName - The name of a file to upload, (with extension) - * @returns The promise that resolves to LargeFileUploadSession - */ - static createUploadSession(client: Client, requestUrl: string, fileName: string): Promise; - /** - * @public - * @constructor - * Constructs a OneDriveLargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded - * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done - * @param {LargeFileUploadTaskOptions} options - The upload task options - * @returns An instance of OneDriveLargeFileUploadTask - */ - constructor(client: Client, file: FileObject, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions); - /** - * @public - * Commits upload session to end uploading - * @param {string} requestUrl - The URL to commit the upload session - * @returns The promise resolves to committed response - */ - commit(requestUrl: string): Promise; -} -export {}; diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js deleted file mode 100644 index 489db2d22..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { LargeFileUploadTask } from "./LargeFileUploadTask"; -import { getValidRangeSize } from "./OneDriveLargeFileUploadTaskUtil"; -/** - * @class - * Class representing OneDriveLargeFileUploadTask - */ -export class OneDriveLargeFileUploadTask extends LargeFileUploadTask { - /** - * @public - * @constructor - * Constructs a OneDriveLargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded - * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done - * @param {LargeFileUploadTaskOptions} options - The upload task options - * @returns An instance of OneDriveLargeFileUploadTask - */ - constructor(client, file, uploadSession, options) { - super(client, file, uploadSession, options); - } - /** - * @private - * @static - * Constructs the create session url for Onedrive - * @param {string} fileName - The name of the file - * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload - * @returns The constructed create session url - */ - static constructCreateSessionUrl(fileName, path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH) { - fileName = fileName.trim(); - path = path.trim(); - if (path === "") { - path = "/"; - } - if (path[0] !== "/") { - path = `/${path}`; - } - if (path[path.length - 1] !== "/") { - path = `${path}/`; - } - // we choose to encode each component of the file path separately because when encoding full URI - // with encodeURI, special characters like # or % in the file name doesn't get encoded as desired - return `/me/drive/root:${path - .split("/") - .map((p) => encodeURIComponent(p)) - .join("/")}${encodeURIComponent(fileName)}:/createUploadSession`; - } - /** - * @public - * @static - * @async - * Creates a OneDriveLargeFileUploadTask - * @param {Client} client - The GraphClient instance - * @param {Blob | Buffer | File} file - File represented as Blob, Buffer or File - * @param {OneDriveLargeFileUploadOptions} options - The options for upload task - * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance - */ - static create(client, file, options) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const name = options.fileName; - let content; - let size; - if (typeof Blob !== "undefined" && file instanceof Blob) { - content = new File([file], name); - size = content.size; - } else if (typeof File !== "undefined" && file instanceof File) { - content = file; - size = content.size; - } else if (typeof Buffer !== "undefined" && file instanceof Buffer) { - const b = file; - size = b.byteLength - b.byteOffset; - content = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength); - } - try { - const requestUrl = OneDriveLargeFileUploadTask.constructCreateSessionUrl(options.fileName, options.path); - const session = yield OneDriveLargeFileUploadTask.createUploadSession(client, requestUrl, options.fileName); - const rangeSize = getValidRangeSize(options.rangeSize); - const fileObj = { - name, - content, - size, - }; - return new OneDriveLargeFileUploadTask(client, fileObj, session, { - rangeSize, - }); - } catch (err) { - throw err; - } - }); - } - /** - * @public - * @static - * @async - * Makes request to the server to create an upload session - * @param {Client} client - The GraphClient instance - * @param {string} requestUrl - The URL to create the upload session - * @param {string} fileName - The name of a file to upload, (with extension) - * @returns The promise that resolves to LargeFileUploadSession - */ - static createUploadSession(client, requestUrl, fileName) { - const _super = Object.create(null, { - createUploadSession: { get: () => super.createUploadSession }, - }); - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const payload = { - item: { - "@microsoft.graph.conflictBehavior": "rename", - name: fileName, - }, - }; - try { - return _super.createUploadSession.call(this, client, requestUrl, payload); - } catch (err) { - throw err; - } - }); - } - /** - * @public - * Commits upload session to end uploading - * @param {string} requestUrl - The URL to commit the upload session - * @returns The promise resolves to committed response - */ - commit(requestUrl) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const payload = { - name: this.file.name, - "@microsoft.graph.conflictBehavior": "rename", - "@microsoft.graph.sourceUrl": this.uploadSession.url, - }; - return yield this.client.api(requestUrl).put(payload); - } catch (err) { - throw err; - } - }); - } -} -/** - * @private - * @static - * Default path for the file being uploaded - */ -OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH = "/"; -//# sourceMappingURL=OneDriveLargeFileUploadTask.js.map diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map b/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map deleted file mode 100644 index 4da5c589b..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTask.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"OneDriveLargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../src/tasks/OneDriveLargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH,OAAO,EAAsC,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAetE;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,mBAAmB;IAuGnE;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,IAAgB,EAAE,aAAqC,EAAE,OAAmC;QAC9H,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IA3GD;;;;;;;OAOG;IACK,MAAM,CAAC,yBAAyB,CAAC,QAAgB,EAAE,OAAe,2BAA2B,CAAC,mBAAmB;QACxH,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,IAAI,KAAK,EAAE,EAAE;YAChB,IAAI,GAAG,GAAG,CAAC;SACX;QACD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACpB,IAA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C,GAAG,CAAC,OAAO,CAAC,CAAC;aACtD;YAAC,OAAO,GAAG,EAAE;gBACb,MAAM,GAAG,CAAC;aACV;QACF,CAAC;KAAA;;AArID;;;;GAIG;AACY,+CAAmB,GAAW,GAAG,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts deleted file mode 100644 index 5f59e5e20..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @constant - * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here - * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session}) - * - * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value. - * @returns The valid rangeSize - */ -export declare const getValidRangeSize: (rangeSize?: number) => number; diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js deleted file mode 100644 index b7999dfee..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module OneDriveLargeFileUploadTaskUtil - */ -/** - * @constant - * Default value for the rangeSize - * Recommended size is between 5 - 10 MB {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#best-practices} - */ -const DEFAULT_FILE_SIZE = 5 * 1024 * 1024; -/** - * @constant - * Rounds off the given value to a multiple of 320 KB - * @param {number} value - The value - * @returns The rounded off value - */ -const roundTo320KB = (value) => { - if (value > 320 * 1024) { - value = Math.floor(value / (320 * 1024)) * 320 * 1024; - } - return value; -}; -/** - * @constant - * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here - * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session}) - * - * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value. - * @returns The valid rangeSize - */ -export const getValidRangeSize = (rangeSize = DEFAULT_FILE_SIZE) => { - const sixtyMB = 60 * 1024 * 1024; - if (rangeSize > sixtyMB) { - rangeSize = sixtyMB; - } - return roundTo320KB(rangeSize); -}; -//# sourceMappingURL=OneDriveLargeFileUploadTaskUtil.js.map diff --git a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map b/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map deleted file mode 100644 index a0f48e2eb..000000000 --- a/test/dist/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"OneDriveLargeFileUploadTaskUtil.js","sourceRoot":"","sources":["../../../../../src/tasks/OneDriveLargeFileUploadTaskUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,MAAM,iBAAiB,GAAW,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IAC9C,IAAI,KAAK,GAAG,GAAG,GAAG,IAAI,EAAE;QACvB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;KACtD;IACD,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAoB,iBAAiB,EAAU,EAAE;IAClF,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC,IAAI,SAAS,GAAG,OAAO,EAAE;QACxB,SAAS,GAAG,OAAO,CAAC;KACpB;IACD,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AAChC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/src/tasks/PageIterator.d.ts b/test/dist/es/src/tasks/PageIterator.d.ts deleted file mode 100644 index f795aea55..000000000 --- a/test/dist/es/src/tasks/PageIterator.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module PageIterator - */ -import { FetchOptions } from "../IFetchOptions"; -import { Client } from "../index"; -import { MiddlewareOptions } from "../middleware/options/IMiddlewareOptions"; -/** - * Signature representing PageCollection - * @property {any[]} value - The collection value - * @property {string} [@odata.nextLink] - The nextLink value - * @property {string} [@odata.deltaLink] - The deltaLink value - * @property {any} Additional - Any number of additional properties (This is to accept the any additional data returned by in the response to the nextLink request) - */ -export interface PageCollection { - value: any[]; - "@odata.nextLink"?: string; - "@odata.deltaLink"?: string; - [Key: string]: any; -} -/** - * Signature to define the request options to be sent during request. - * The values of the GraphRequestOptions properties are passed to the Graph Request object. - * @property {HeadersInit} headers - the header options for the request - * @property {MiddlewareOptions[]} middlewareoptions - The middleware options for the request - * @property {FetchOptions} options - The fetch options for the request - */ -export interface GraphRequestOptions { - headers?: HeadersInit; - middlewareOptions?: MiddlewareOptions[]; - options?: FetchOptions; -} -/** - * Signature representing callback for page iterator - * @property {Function} callback - The callback function which should return boolean to continue the continue/stop the iteration. - */ -export declare type PageIteratorCallback = (data: any) => boolean; -/** - * @class - * Class for PageIterator - */ -export declare class PageIterator { - /** - * @private - * Member holding the GraphClient instance - */ - private client; - /** - * @private - * Member holding the page collection - */ - private collection; - /** - * @private - * Member variable referring to nextLink of the page collection - */ - private nextLink; - /** - * @private - * Member variable referring to deltaLink of the request - */ - private deltaLink; - /** - * @private - * Holding callback for Iteration. - */ - private callback; - /** - * @private - * Member holding a complete/incomplete status of an iterator - */ - private complete; - /** - * Information to be added to the request - */ - private requestOptions; - /** - * @public - * @constructor - * Creates new instance for PageIterator - * @param {Client} client - The graph client instance - * @param {PageCollection} pageCollection - The page collection object - * @param {PageIteratorCallback} callBack - The callback function - * @param {GraphRequestOptions} requestOptions - The request options - * @returns An instance of a PageIterator - */ - constructor(client: Client, pageCollection: PageCollection, callback: PageIteratorCallback, requestOptions?: GraphRequestOptions); - /** - * @private - * Iterates over a collection by enqueuing entries one by one and kicking the callback with the enqueued entry - * @returns A boolean indicating the continue flag to process next page - */ - private iterationHelper; - /** - * @private - * @async - * Helper to make a get request to fetch next page with nextLink url and update the page iterator instance with the returned response - * @returns A promise that resolves to a response data with next page collection - */ - private fetchAndUpdateNextPageData; - /** - * @public - * Getter to get the deltaLink in the current response - * @returns A deltaLink which is being used to make delta requests in future - */ - getDeltaLink(): string | undefined; - /** - * @public - * @async - * Iterates over the collection and kicks callback for each item on iteration. Fetches next set of data through nextLink and iterates over again - * This happens until the nextLink is drained out or the user responds with a red flag to continue from callback - * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy. - */ - iterate(): Promise; - /** - * @public - * @async - * To resume the iteration - * Note: This internally calls the iterate method, It's just for more readability. - * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy - */ - resume(): Promise; - /** - * @public - * To get the completeness status of the iterator - * @returns Boolean indicating the completeness - */ - isComplete(): boolean; -} diff --git a/test/dist/es/src/tasks/PageIterator.js b/test/dist/es/src/tasks/PageIterator.js deleted file mode 100644 index e56f47a8e..000000000 --- a/test/dist/es/src/tasks/PageIterator.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * Class for PageIterator - */ -export class PageIterator { - /** - * @public - * @constructor - * Creates new instance for PageIterator - * @param {Client} client - The graph client instance - * @param {PageCollection} pageCollection - The page collection object - * @param {PageIteratorCallback} callBack - The callback function - * @param {GraphRequestOptions} requestOptions - The request options - * @returns An instance of a PageIterator - */ - constructor(client, pageCollection, callback, requestOptions) { - this.client = client; - this.collection = pageCollection.value; - this.nextLink = pageCollection["@odata.nextLink"]; - this.deltaLink = pageCollection["@odata.deltaLink"]; - this.callback = callback; - this.complete = false; - this.requestOptions = requestOptions; - } - /** - * @private - * Iterates over a collection by enqueuing entries one by one and kicking the callback with the enqueued entry - * @returns A boolean indicating the continue flag to process next page - */ - iterationHelper() { - if (this.collection === undefined) { - return false; - } - let advance = true; - while (advance && this.collection.length !== 0) { - const item = this.collection.shift(); - advance = this.callback(item); - } - return advance; - } - /** - * @private - * @async - * Helper to make a get request to fetch next page with nextLink url and update the page iterator instance with the returned response - * @returns A promise that resolves to a response data with next page collection - */ - fetchAndUpdateNextPageData() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - let graphRequest = this.client.api(this.nextLink); - if (this.requestOptions) { - if (this.requestOptions.headers) { - graphRequest = graphRequest.headers(this.requestOptions.headers); - } - if (this.requestOptions.middlewareOptions) { - graphRequest = graphRequest.middlewareOptions(this.requestOptions.middlewareOptions); - } - if (this.requestOptions.options) { - graphRequest = graphRequest.options(this.requestOptions.options); - } - } - const response = yield graphRequest.get(); - this.collection = response.value; - this.nextLink = response["@odata.nextLink"]; - this.deltaLink = response["@odata.deltaLink"]; - } catch (error) { - throw error; - } - }); - } - /** - * @public - * Getter to get the deltaLink in the current response - * @returns A deltaLink which is being used to make delta requests in future - */ - getDeltaLink() { - return this.deltaLink; - } - /** - * @public - * @async - * Iterates over the collection and kicks callback for each item on iteration. Fetches next set of data through nextLink and iterates over again - * This happens until the nextLink is drained out or the user responds with a red flag to continue from callback - * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy. - */ - iterate() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - let advance = this.iterationHelper(); - while (advance) { - if (this.nextLink !== undefined) { - yield this.fetchAndUpdateNextPageData(); - advance = this.iterationHelper(); - } else { - advance = false; - } - } - if (this.nextLink === undefined && this.collection.length === 0) { - this.complete = true; - } - } catch (error) { - throw error; - } - }); - } - /** - * @public - * @async - * To resume the iteration - * Note: This internally calls the iterate method, It's just for more readability. - * @returns A Promise that resolves to nothing on completion and throws error incase of any discrepancy - */ - resume() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - return this.iterate(); - } catch (error) { - throw error; - } - }); - } - /** - * @public - * To get the completeness status of the iterator - * @returns Boolean indicating the completeness - */ - isComplete() { - return this.complete; - } -} -//# sourceMappingURL=PageIterator.js.map diff --git a/test/dist/es/src/tasks/PageIterator.js.map b/test/dist/es/src/tasks/PageIterator.js.map deleted file mode 100644 index 4e3c4c44e..000000000 --- a/test/dist/es/src/tasks/PageIterator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"PageIterator.js","sourceRoot":"","sources":["../../../../../src/tasks/PageIterator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AA4CH;;;GAGG;AACH,MAAM,OAAO,YAAY;IA2CxB;;;;;;;;;OASG;IACH,YAAmB,MAAc,EAAE,cAA8B,EAAE,QAA8B,EAAE,cAAoC;QACtI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI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Q,CAAC,iBAAiB,CAAC,CAAC;gBAC5C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;aAC9C;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACU,OAAO;;YACnB,IAAI;gBACH,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrC,OAAO,OAAO,EAAE;oBACf,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;wBAChC,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;wBACxC,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;qBACjC;yBAAM;wBACN,OAAO,GAAG,KAAK,CAAC;qBAChB;iBACD;gBACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;oBAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;iBACrB;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;;;OAMG;IACU,MAAM;;YAClB,IAAI;gBACH,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;aACtB;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC;KAAA;IAED;;;;OAIG;IACI,UAAU;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/DummyAuthenticationProvider.d.ts b/test/dist/es/test/DummyAuthenticationProvider.d.ts deleted file mode 100644 index c0a51386d..000000000 --- a/test/dist/es/test/DummyAuthenticationProvider.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module DummyAuthenticationProvider - */ -import { AuthenticationProvider } from "../src/IAuthenticationProvider"; -/** - * @class - * @implements AuthenticationProvider - * Class representing DummyAuthenticationProvider - */ -export declare class DummyAuthenticationProvider implements AuthenticationProvider { - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken(): Promise; -} diff --git a/test/dist/es/test/DummyAuthenticationProvider.js b/test/dist/es/test/DummyAuthenticationProvider.js deleted file mode 100644 index 7c0f06fc7..000000000 --- a/test/dist/es/test/DummyAuthenticationProvider.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * @implements AuthenticationProvider - * Class representing DummyAuthenticationProvider - */ -export class DummyAuthenticationProvider { - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const token = "DUMMY_TOKEN"; - return Promise.resolve(token); - }); - } -} -//# sourceMappingURL=DummyAuthenticationProvider.js.map diff --git a/test/dist/es/test/DummyAuthenticationProvider.js.map b/test/dist/es/test/DummyAuthenticationProvider.js.map deleted file mode 100644 index 8abdb1b4a..000000000 --- a/test/dist/es/test/DummyAuthenticationProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DummyAuthenticationProvider.js","sourceRoot":"","sources":["../../../DummyAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IACvC;;;;;OAKG;IACU,cAAc;;YAC1B,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.d.ts b/test/dist/es/test/common/DummyAuthenticationProvider.d.ts deleted file mode 100644 index 7f458e752..000000000 --- a/test/dist/es/test/common/DummyAuthenticationProvider.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module DummyAuthenticationProvider - */ -import { AuthenticationProvider } from "../../src/IAuthenticationProvider"; -/** - * @class - * @implements AuthenticationProvider - * Class representing DummyAuthenticationProvider - */ -export declare class DummyAuthenticationProvider implements AuthenticationProvider { - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken(): Promise; -} diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.js b/test/dist/es/test/common/DummyAuthenticationProvider.js deleted file mode 100644 index 7c0f06fc7..000000000 --- a/test/dist/es/test/common/DummyAuthenticationProvider.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * @implements AuthenticationProvider - * Class representing DummyAuthenticationProvider - */ -export class DummyAuthenticationProvider { - /** - * @public - * @async - * To get the access token - * @returns The promise that resolves to an access token - */ - getAccessToken() { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - const token = "DUMMY_TOKEN"; - return Promise.resolve(token); - }); - } -} -//# sourceMappingURL=DummyAuthenticationProvider.js.map diff --git a/test/dist/es/test/common/DummyAuthenticationProvider.js.map b/test/dist/es/test/common/DummyAuthenticationProvider.js.map deleted file mode 100644 index ab14869e9..000000000 --- a/test/dist/es/test/common/DummyAuthenticationProvider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DummyAuthenticationProvider.js","sourceRoot":"","sources":["../../../../common/DummyAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAQH;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IACvC;;;;;OAKG;IACU,cAAc;;YAC1B,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts b/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts deleted file mode 100644 index 4df35323d..000000000 --- a/test/dist/es/test/common/DummyHTTPMessageHandler.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module DummyHTTPMessageHandler - */ -import { Context } from "../../src/IContext"; -import { Middleware } from "../../src/middleware/IMiddleware"; -/** - * @class - * @implements Middleware - * Class representing DummyHTTPMessageHandler - */ -export declare class DummyHTTPMessageHandler implements Middleware { - /** - * @private - * A member holding the array of response objects - */ - private responses; - /** - * @public - * @constructor - * To create an instance of DummyHTTPMessageHandler - * @param {Response[]} [responses = []] - The array of response objects - * @returns An instance of DummyHTTPMessageHandler - */ - constructor(responses?: Response[]); - /** - * @public - * To set the array of responses - * @param {Response[]} response - The array of responses - * @returns Nothing - */ - setResponses(responses: Response[]): void; - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The request context object - * @returns A promise that resolves to nothing - */ - execute(context: Context): Promise; -} diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.js b/test/dist/es/test/common/DummyHTTPMessageHandler.js deleted file mode 100644 index 01ee72001..000000000 --- a/test/dist/es/test/common/DummyHTTPMessageHandler.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -/** - * @class - * @implements Middleware - * Class representing DummyHTTPMessageHandler - */ -export class DummyHTTPMessageHandler { - /** - * @public - * @constructor - * To create an instance of DummyHTTPMessageHandler - * @param {Response[]} [responses = []] - The array of response objects - * @returns An instance of DummyHTTPMessageHandler - */ - constructor(responses = []) { - this.responses = responses; - } - /** - * @public - * To set the array of responses - * @param {Response[]} response - The array of responses - * @returns Nothing - */ - setResponses(responses) { - this.responses = responses; - } - /** - * @public - * @async - * To execute the current middleware - * @param {Context} context - The request context object - * @returns A promise that resolves to nothing - */ - execute(context) { - return tslib_1.__awaiter(this, void 0, void 0, function*() { - context.response = this.responses.shift(); - return; - }); - } -} -//# sourceMappingURL=DummyHTTPMessageHandler.js.map diff --git a/test/dist/es/test/common/DummyHTTPMessageHandler.js.map b/test/dist/es/test/common/DummyHTTPMessageHandler.js.map deleted file mode 100644 index 8f9b9b5f0..000000000 --- a/test/dist/es/test/common/DummyHTTPMessageHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DummyHTTPMessageHandler.js","sourceRoot":"","sources":["../../../../common/DummyHTTPMessageHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AASH;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAOnC;;;;;;OAMG;IACH,YAAmB,YAAwB,EAAE;QAC5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,SAAqB;QACxC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACU,OAAO,CAAC,OAAgB;;YACpC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC1C,OAAO;QACR,CAAC;KAAA;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/DummyHandlerOptions.d.ts b/test/dist/es/test/common/DummyHandlerOptions.d.ts deleted file mode 100644 index 44253ffe6..000000000 --- a/test/dist/es/test/common/DummyHandlerOptions.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module DummyHandlerOptions - */ -import { MiddlewareOptions } from "../../src/middleware/options/IMiddlewareOptions"; -/** - * @class - * @implements MiddlewareOptions - * Class for DummyHandlerOptions - */ -export declare class DummyHandlerOptions implements MiddlewareOptions { - /** - * @public - * A member holding a dummy string - */ - dummyString: string; - /** - * @public - * @async - * To create an instance of DummyHandlerOptions - * @param {string} dummyString - The dummy string - * @returns An instance of DummyHandlerOptions - */ - constructor(dummyString?: string); -} diff --git a/test/dist/es/test/common/DummyHandlerOptions.js b/test/dist/es/test/common/DummyHandlerOptions.js deleted file mode 100644 index 4c269450f..000000000 --- a/test/dist/es/test/common/DummyHandlerOptions.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @class - * @implements MiddlewareOptions - * Class for DummyHandlerOptions - */ -export class DummyHandlerOptions { - /** - * @public - * @async - * To create an instance of DummyHandlerOptions - * @param {string} dummyString - The dummy string - * @returns An instance of DummyHandlerOptions - */ - constructor(dummyString = "dummy") { - this.dummyString = dummyString; - } -} -//# sourceMappingURL=DummyHandlerOptions.js.map diff --git a/test/dist/es/test/common/DummyHandlerOptions.js.map b/test/dist/es/test/common/DummyHandlerOptions.js.map deleted file mode 100644 index ce7628dee..000000000 --- a/test/dist/es/test/common/DummyHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DummyHandlerOptions.js","sourceRoot":"","sources":["../../../../common/DummyHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;GAIG;AAEH,MAAM,OAAO,mBAAmB;IAO/B;;;;;;OAMG;IACH,YAAmB,cAAsB,OAAO;QAC/C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;CACD"} \ No newline at end of file diff --git a/test/dist/es/test/common/content/BatchRequestContent.d.ts b/test/dist/es/test/common/content/BatchRequestContent.d.ts deleted file mode 100644 index ac7981909..000000000 --- a/test/dist/es/test/common/content/BatchRequestContent.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/content/BatchRequestContent.js b/test/dist/es/test/common/content/BatchRequestContent.js deleted file mode 100644 index 67548e6fc..000000000 --- a/test/dist/es/test/common/content/BatchRequestContent.js +++ /dev/null @@ -1,601 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import * as fs from "fs"; -import "isomorphic-fetch"; -import { BatchRequestContent } from "../../../src/content/BatchRequestContent"; -import { randomString } from "../test-helper"; -const folderName = randomString(); -const folderDetails = { - name: folderName, - folder: {}, -}; -const createFolderRequest = new Request("/me/drive/root/children", { - method: "POST", - headers: { - "Content-type": "application/json", - }, - body: JSON.stringify(folderDetails), -}); -const getCreateFolderRequestCopy = () => { - return { - id: "1", - request: createFolderRequest, - }; -}; -const getCreateFolderRequestWithDependsOnCopy = () => { - const data = { - id: "1", - request: createFolderRequest, - dependsOn: undefined, - }; - data.dependsOn = []; - return data; -}; -describe("BatchRequestContent.ts", () => { - describe("Create", function() { - this.timeout(20 * 1000); - it("Should Create BatchRequestContent instance with no requests", (done) => { - const batchReq = new BatchRequestContent(); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - it("Should create BatchRequestContent instance with empty array", (done) => { - const batchReq = new BatchRequestContent([]); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - it("Should create BatchRequestContent instance with requests", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - const createFolderDuplicate2 = getCreateFolderRequestCopy(); - createFolderDuplicate2.id = "2"; - const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); - assert.equal(batchReq.requests.size, 2); - done(); - }); - it("Should throw error for empty request id", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - createFolderDuplicate1.id = ""; - try { - const batchReq = new BatchRequestContent([createFolderDuplicate1]); - throw new Error("Something wrong with the empty id check"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - } - done(); - }); - it("Should return error incase of number of requests limit exceeding", (done) => { - const requests = []; - for (let i = 0; i < 25; i++) { - const req = getCreateFolderRequestCopy(); - req.id = "" + i; - requests.push(req); - } - try { - const batchReq = new BatchRequestContent(requests); - throw new Error("Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - }); - describe("addRequest", function() { - this.timeout(20 * 1000); - it("Should emit size exceed error", (done) => { - const requests = []; - for (let i = 0; i < 20; i++) { - const r = getCreateFolderRequestCopy(); - r.id = "" + i; - requests.push(r); - } - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(requests); - try { - batchReq.addRequest(req); - throw new Error("Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - it("Should add Request JSON to the BatchRequestContent instance", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(); - const id = batchReq.addRequest(req); - assert.equal(req.id, id); - done(); - }); - it("Should throw duplicate id error", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addRequest(req2); - throw new Error("Something wrong with duplicate id validation"); - } catch (error) { - assert.equal(error.name, "Duplicate RequestId Error"); - done(); - } - }); - it("Should throw duplicate id error", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = ""; - const batchReq = new BatchRequestContent(); - try { - batchReq.addRequest(req); - throw new Error("Something wrong with empty id validation"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - done(); - } - }); - }); - describe("removeRequest", () => { - it("Should delete the request present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, batchReq.removeRequest(req.id)); - done(); - }); - it("Should return false for the request that is not present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(false, batchReq.removeRequest("1000")); - done(); - }); - it("Should remove dependencies in case dependencies present", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - const req4 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - batchReq.addDependency("2", "1"); - batchReq.addDependency("3", "2"); - batchReq.addDependency("4", "1"); - batchReq.addDependency("4", "2"); - batchReq.addDependency("4", "3"); - batchReq.removeRequest("2"); - assert.isUndefined(batchReq.requests.get("1").dependsOn); - assert.isUndefined(batchReq.requests.get("3").dependsOn); - assert.equal(batchReq.requests.get("4").dependsOn.length, 2); - done(); - }); - }); - describe("addDependency", function() { - this.timeout(20 * 1000); - it("Should return error for request with dependent id not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1"); - throw new Error("Dependent validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency Addition"); - done(); - } - }); - it("Should return error for the request with given dependency id is not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1", "100"); - throw new Error("Dependency validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency"); - done(); - } - }); - it("Should add dependency for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2", "1"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("2", "3"); - assert.equal(batchReq.requests.get("2").dependsOn.length, 2); - done(); - }); - it("Should return error for adding duplicate dependency", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2", "1"); - try { - batchReq.addDependency("2", "1"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - it("Should add dependency for dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("3"); - assert.isDefined(batchReq.requests.get("3").dependsOn); - done(); - }); - it("Should return error for adding duplicate dependency when dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - try { - batchReq.addDependency("2"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addDependency("1"); - } catch (e) { - assert.equal(e.name, "Invalid Dependency Addition"); - done(); - } - }); - }); - describe("getContent", () => { - it("Should return error for empty requests", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const batchReq = new BatchRequestContent(); - try { - const content = yield batchReq.getContent(); - throw new Error("Something wrong with the empty requests validation"); - } catch (error) { - assert.equal(error.name, "Empty Payload"); - } - })); - it("Should return json content", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - const content = yield batchReq.getContent(); - assert.isDefined(content.requests[0].body); - assert.equal(typeof content.requests[0].body, "object"); - } catch (error) { - throw error; - } - })); - it("Should return image's base64 string", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const fileName = "sample_image.jpg"; - fs.readFile(`./spec/sample_files/${fileName}`, {}, (err, file) => - tslib_1.__awaiter(this, void 0, void 0, function*() { - if (err) { - throw err; - } - const uploadOneDriveFile = { - id: "1", - request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { - method: "PUT", - headers: { - "Content-type": "image/jpg", - }, - body: file, - }), - }; - const batchReq = new BatchRequestContent([uploadOneDriveFile]); - try { - const content = yield batchReq.getContent(); - assert.isDefined(content.requests[0].body); - } catch (error) { - throw error; - } - }), - ); - })); - it("Should throw error for request does not have content-type header if it does have a body", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { - method: "POST", - body: JSON.stringify(folderDetails), - }); - const batchReq = new BatchRequestContent([ - { - id: "1", - request: createFolderReqWithoutHeader, - }, - ]); - try { - const content = yield batchReq.getContent(); - throw new Error("Something wrong with the header checking"); - } catch (error) { - assert.equal(error.name, "Invalid Content-type header"); - } - })); - }); - describe("removeDependency", function() { - this.timeout(20 * 1000); - it("Should return false for dependent not present", (done) => { - const batchReq = new BatchRequestContent(); - assert.equal(false, batchReq.removeDependency("1")); - done(); - }); - it("Should return false for dependency array not present in the request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(false, batchReq.removeDependency("2")); - done(); - }); - it("Should return false for given dependency id is not present in the dependent request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(false, batchReq.removeDependency("2", "5")); - done(); - }); - it("Should delete the given dependency and dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(true, batchReq.removeDependency("2", "1")); - done(); - }); - it("Should delete all dependencies for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("3", "1"); - batchReq.addDependency("3", "2"); - assert.equal(true, batchReq.removeDependency("3")); - done(); - }); - }); - describe("validateDependencies", () => { - /* tslint:disable: no-string-literal */ - it("Should throw error for empty request object", (done) => { - try { - BatchRequestContent["validateDependencies"](new Map()); - throw new Error("Something wrong with the empty requests check"); - } catch (error) { - assert.equal(error.name, "Empty Requests Error"); - done(); - } - }); - it("isParallel - Should validate for single request", () => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for multiple requests", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for requests with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for requests with empty dependsOn array", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for first request having dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = undefined; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for a request does not depend on anything", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for a request does not depend on previous request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["4"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for requests having more than one dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["2", "3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for proper serial dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for first request having dependency on itself", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["1"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for first request having dependency on non existing request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["10"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["10"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["10"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for requests dependsOn some middle order request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request with empty dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["2"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - /* tslint:enable: no-string-literal */ - }); -}); -//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/test/common/content/BatchRequestContent.js.map b/test/dist/es/test/common/content/BatchRequestContent.js.map deleted file mode 100644 index cc2ff470e..000000000 --- a/test/dist/es/test/common/content/BatchRequestContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Bat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,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uHAAuH,EAAE,GAAG,EAAE;YAChI,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/content/BatchResponseContent.d.ts b/test/dist/es/test/common/content/BatchResponseContent.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/content/BatchResponseContent.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/content/BatchResponseContent.js b/test/dist/es/test/common/content/BatchResponseContent.js deleted file mode 100644 index 78f9dc62f..000000000 --- a/test/dist/es/test/common/content/BatchResponseContent.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; -const redirect = { - id: "1", - status: 302, - headers: { - location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", - }, -}; -const forbidden = { - id: "3", - status: 401, - body: { - error: { - code: "Forbidden", - message: "...", - }, - }, -}; -const okWithBody = { - id: "2", - status: 200, - body: { - "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", - value: [], - }, -}; -const okWithoutBody = { - id: "4", - status: 204, - body: null, -}; -describe("BatchResponseContent.ts", () => { - describe("update", function() { - this.timeout(20 * 1000); - it("Should update instance with nextLink responses", (done) => { - const responses = [redirect, forbidden]; - const batchRes = new BatchResponseContent({ - responses, - "@odata.nextLink": "dummy nextlink", - }); - batchRes.update({ - responses: [okWithoutBody, okWithBody], - }); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - describe("createResponseObject", function() { - this.timeout(20 * 1000); - it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - assert.isDefined(batchRes.getResponseById("1")); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("3")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - describe("getResponseById", function() { - this.timeout(20 * 1000); - it("Should return response object for given id", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponseById("1")); - done(); - }); - it("Should return undefined for given id for which the response is not present", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isUndefined(batchRes.getResponseById("100")); - done(); - }); - }); - describe("getResponses", function() { - this.timeout(20 * 1000); - it("Should return responses map", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponses()); - done(); - }); - }); - describe("getResponsesIterator", function() { - this.timeout(20 * 1000); - it("Should return iterator", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - let count = 0; - const iterator = batchRes.getResponsesIterator(); - let data = iterator.next(); - while (!data.done) { - data = iterator.next(); - count++; - } - assert.equal(count, 4); - done(); - }); - }); -}); -//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/test/common/content/BatchResponseContent.js.map b/test/dist/es/test/common/content/BatchResponseContent.js.map deleted file mode 100644 index 911f71f36..000000000 --- a/test/dist/es/test/common/content/BatchResponseContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../common/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,QAAQ,GAAG;IAChB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,OAAO,EAAE;QACR,QAAQ,EAAE,uEAAuE;KACjF;CACD,CAAC;AACF,MAAM,SAAS,GAAG;IACjB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,KAAK,EAAE;YACN,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,KAAK;SACd;KACD;CACD,CAAC;AACF,MAAM,UAAU,GAAG;IAClB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,E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ACrB,CAAC,CAAC;YACH,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAExB,EAAE,CAAC,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;YACrC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACzC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC;aAC3D,CAAC,CAAC;YACH,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,QAAQ,GAAG,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YACjD,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBAClB,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACvB,KAAK,EAAE,CAAC;aACR;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/Client.d.ts b/test/dist/es/test/common/core/Client.d.ts deleted file mode 100644 index ac7981909..000000000 --- a/test/dist/es/test/common/core/Client.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/core/Client.js b/test/dist/es/test/common/core/Client.js deleted file mode 100644 index 5b41681f6..000000000 --- a/test/dist/es/test/common/core/Client.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import "isomorphic-fetch"; -import { CustomAuthenticationProvider, TelemetryHandler } from "../../../src"; -import { Client } from "../../../src/Client"; -import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; -import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; -import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; -import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -describe("Client.ts", () => { - /* tslint:disable: no-string-literal */ - describe("initWithMiddleware", () => { - const dummyAuthProvider = new DummyAuthenticationProvider(); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - it("Should throw an error in case if both auth provider and custom middleware is passed", () => { - try { - const options = { - authProvider: dummyAuthProvider, - middleware: dummyHTTPHandler, - }; - const client = Client.initWithMiddleware(options); - throw new Error("Something wrong with the ambiguity check"); - } catch (error) { - assert.equal(error.name, "AmbiguityInInitialization"); - } - }); - it("Should return client instance for an authentication provider", () => { - const options = { - authProvider: dummyAuthProvider, - }; - const client = Client.initWithMiddleware(options); - assert.isTrue(client instanceof Client); - assert.isDefined(client["httpClient"]); - }); - it("Should return client instance for a custom middleware chain", () => { - const options = { - middleware: dummyHTTPHandler, - }; - const client = Client.initWithMiddleware(options); - assert.isTrue(client instanceof Client); - assert.isDefined(client["httpClient"]); - }); - it("Should throw error in case of neither auth provider nor custom middleware is passed", () => { - try { - const options = {}; - Client.initWithMiddleware(options); - throw new Error("Something wrong with the client initialization check"); - } catch (error) { - assert.equal(error.name, "InvalidMiddlewareChain"); - } - }); - it("Init middleware using a middleware array", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const provider = (done) => { - done(null, "dummy_token"); - }; - const authHandler = new AuthenticationHandler(new CustomAuthenticationProvider(provider)); - const responseBody = "Test response body"; - const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Testing middleware array", 200, 0, responseBody); - const middlewareArray = [authHandler, new ChaosHandler(options)]; - const client = Client.initWithMiddleware({ middleware: middlewareArray }); - const response = yield client.api("me").get(); - assert.equal(response, responseBody); - })); - it("Init middleware using a chained middleware array", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const provider = (done) => { - done(null, "dummy_token"); - }; - const authHandler = new AuthenticationHandler(new CustomAuthenticationProvider(provider)); - const responseBody = "Test response body"; - const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Testing chained middleware array", 200, 0, responseBody); - const chaosHandler = new ChaosHandler(options); - const telemetryHandler = new TelemetryHandler(); - authHandler.setNext(telemetryHandler); - telemetryHandler.setNext(chaosHandler); - const middlewareArray = [authHandler]; - const client = Client.initWithMiddleware({ middleware: middlewareArray }); - const response = yield client.api("me").get(); - assert.equal(response, responseBody); - })); - }); - describe("init", () => { - it("Should return a client instance with default authentication provider and default middleware chain", () => { - const provider = (done) => { - done(null, "dummy_token"); - }; - const options = { - authProvider: provider, - }; - const client = Client.init(options); - assert.isDefined(client["httpClient"]); - }); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=Client.js.map diff --git a/test/dist/es/test/common/core/Client.js.map b/test/dist/es/test/common/core/Client.js.map deleted file mode 100644 index 790f0c5a0..000000000 --- a/test/dist/es/test/common/core/Client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../../../common/core/Client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,4BAA4B,EAAE,gBAAg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QAAQ,EAAE,YAAY,CAAC,CAAC;QACtC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,mGAAmG,EAAE,GAAG,EAAE;YAC5G,MAAM,QAAQ,GAAiB,CAAC,IAAI,EAAE,EAAE;gBACvC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;YAC3B,CAAC,CAAC;YACF,MAAM,OAAO,GAAY;gBACxB,YAAY,EAAE,QAAQ;aACtB,CAAC;YACF,MAAM,MAAM,GAAW,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphErrorHandler.d.ts b/test/dist/es/test/common/core/GraphErrorHandler.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/GraphErrorHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/GraphErrorHandler.js b/test/dist/es/test/common/core/GraphErrorHandler.js deleted file mode 100644 index 80e2fbe1e..000000000 --- a/test/dist/es/test/common/core/GraphErrorHandler.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { GraphErrorHandler } from "../../../src/GraphErrorHandler"; -describe("GraphErrorHandler.ts", () => { - /* tslint:disable: no-string-literal */ - describe("constructError", () => { - it("Should return custom error without code", () => { - const message = "test"; - const error = new Error(message); - const gError = GraphErrorHandler["constructError"](error); - assert.equal(gError.message, message); - }); - it("Should return custom error with code and message", () => { - const message = "test"; - const name = "test_name"; - const error = new Error(message); - error.name = name; - const gError = GraphErrorHandler["constructError"](error); - assert.equal(gError.message, message); - assert.equal(gError.code, name); - }); - }); - describe("constructErrorFromResponse", () => { - const statusCode = 400; - const error = { - error: { - code: "DataNotAvailable", - message: "The data that is being requested is not present", - }, - }; - it("Should construct error for error response without innerError property", () => { - const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); - assert.equal(gError.statusCode, statusCode); - assert.equal(gError.requestId, null); - }); - it("Should construct error for the response missing one or more properties in innerError property", () => { - error.error.innerError = { - "request-id": "some random id", - }; - const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); - assert.equal(gError.statusCode, statusCode); - assert.equal(gError.requestId, "some random id"); - }); - it("Should construct error for the complete error response", () => { - const date = new Date(); - const requestId = "some random id"; - error.error.innerError = { - "request-id": requestId, - date, - }; - const gError = GraphErrorHandler["constructErrorFromResponse"](error, statusCode); - assert.equal(gError.statusCode, statusCode); - assert.equal(gError.requestId, "some random id"); - assert.equal(gError.date.toUTCString(), date.toUTCString()); - }); - }); - /* tslint:enable: no-string-literal */ - describe("getError", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - it("Should construct error from response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const errorResponse = { - error: { - code: "500", - message: "Internal Server Error", - innerError: { - "request-id": "some random id", - }, - }, - }; - const gError = yield GraphErrorHandler.getError(errorResponse); - assert.equal(gError.requestId, "some random id"); - assert.equal(gError.code, "500"); - assert.equal(gError.message, "Internal Server Error"); - })); - it("Should construct error from error object", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const error = new Error("Some Error"); - error.name = "InvalidError"; - const gError = yield GraphErrorHandler.getError(error); - assert.equal(gError.requestId, null); - assert.equal(gError.message, "Some Error"); - assert.equal(gError.code, "InvalidError"); - })); - it("Should construct some default error", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const gError = yield GraphErrorHandler.getError(); - assert.equal(gError.message, ""); - assert.equal(gError.statusCode, -1); - assert.equal(gError.code, null); - assert.equal(gError.body, null); - assert.equal(gError.requestId, null); - })); - })); -}); -//# sourceMappingURL=GraphErrorHandler.js.map diff --git a/test/dist/es/test/common/core/GraphErrorHandler.js.map b/test/dist/es/test/common/core/GraphErrorHandler.js.map deleted file mode 100644 index cfb9c8ea2..000000000 --- a/test/dist/es/test/common/core/GraphErrorHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphErrorHandler.js","sourceRoot":"","sources":["../../../../../common/core/GraphErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,uCAAuC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YAClD,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC3D,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,IAAI,GAAG,WAAW,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;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,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YACtC,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;YAC5B,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAC3C,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;YACpD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAClD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACjC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphRequestUtil.d.ts b/test/dist/es/test/common/core/GraphRequestUtil.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/GraphRequestUtil.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/GraphRequestUtil.js b/test/dist/es/test/common/core/GraphRequestUtil.js deleted file mode 100644 index d0bd25f46..000000000 --- a/test/dist/es/test/common/core/GraphRequestUtil.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { serializeContent, urlJoin } from "../../../src/GraphRequestUtil"; -describe("GraphRequestUtil.ts", () => { - describe("urlJoin", () => { - const output = "host/version/path"; - it("Should append parts with /", () => { - const joined = urlJoin(["host", "version", "path"]); - assert.equal(joined, output); - }); - it("Should append parts with / by removing / from start", () => { - const joined = urlJoin(["host", "/version", "/path"]); - assert.equal(joined, output); - }); - it("Should append parts with / by removing / from end", () => { - const joined = urlJoin(["host/", "version/", "path"]); - assert.equal(joined, output); - }); - it("Should append parts with / by removing / from start and end", () => { - const joined = urlJoin(["host/", "/version/", "/path"]); - assert.equal(joined, output); - }); - }); - describe("serializeContent", () => { - it("Should return Buffer/Blob/File/FormData/String as it is", () => { - const str = "Content"; - assert.equal(serializeContent(str), str); - const buffer = new Buffer("Buffer"); - assert.equal(serializeContent(buffer), buffer); - }); - it("Should convert it to string", () => { - const data = 123; - const str = "123"; - assert.equal(serializeContent(data), str); - }); - it("Should throw error for objects that cannot be converted to string", () => { - const node1 = { - data: 1, - link: undefined, - }; - const node2 = { - data: 2, - link: undefined, - }; - node1.link = node2; - node2.link = node1; - try { - serializeContent(node1); - throw new Error("Something wrong with the serialize content, it should not stringify cyclic referenced objects"); - } catch (error) { - assert.equal(error.message, "Unable to stringify the content"); - } - }); - it("Should return undefined for the case of undefined content value", () => { - const val = undefined; - assert.equal(serializeContent(val), undefined); - }); - it("Should return 'null' for the case of null content value", () => { - const val = null; - assert.equal(serializeContent(val), "null"); - }); - }); -}); -//# sourceMappingURL=GraphRequestUtil.js.map diff --git a/test/dist/es/test/common/core/GraphRequestUtil.js.map b/test/dist/es/test/common/core/GraphRequestUtil.js.map deleted file mode 100644 index 4d4ed23ea..000000000 --- a/test/dist/es/test/common/core/GraphRequestUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphRequestUtil.js","sourceRoot":"","sources":["../../../../../common/core/GraphRequestUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE1E,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACxB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6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O,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAC;aAC/D;QACF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;YAC1E,MAAM,GAAG,GAAG,SAAS,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YAClE,MAAM,GAAG,GAAG,IAAI,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/GraphResponseHandler.d.ts b/test/dist/es/test/common/core/GraphResponseHandler.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/GraphResponseHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/GraphResponseHandler.js b/test/dist/es/test/common/core/GraphResponseHandler.js deleted file mode 100644 index 7bb3780dc..000000000 --- a/test/dist/es/test/common/core/GraphResponseHandler.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { DocumentType, GraphResponseHandler } from "../../../src/GraphResponseHandler"; -import { ResponseType } from "../../../src/ResponseType"; -describe("GraphResponseHandler.ts", () => { - const htmlString = ` - - - - Testing Document - - -

Testing

- - `; - const status200 = { - status: 200, - statusText: "OK", - }; - const status204 = { - status: 204, - statusText: "OK", - }; - const status500 = { - status: 500, - statusText: "Internal Server Error", - }; - const status202 = { - status: 202, - statusText: "OK", - }; - const status200Text = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "text/plain", - }, - }; - const status200Json = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "application/json", - }, - }; - const status200Image = { - status: 200, - stautsText: "OK", - headers: { - "Content-Type": "image/jpeg", - }, - }; - const status200Unknown = { - status: 200, - statusText: "OK", - headers: { - "Content-Type": "dummy/unknown", - }, - }; - /* tslint:disable: no-string-literal */ - describe("parseDocumentResponse", () => { - it("Should return the html string", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const dom = yield GraphResponseHandler["parseDocumentResponse"](response, DocumentType.TEXT_HTML); - assert.isDefined(dom); - assert.equal(typeof dom, "string"); - })); - }); - describe("convertResponse", () => { - it("Should return empty response for the NO CONTENT (204 response)", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(undefined, status204); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.isUndefined(responseValue); - })); - it("Should return empty text value for empty response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(undefined, status202); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.isUndefined(responseValue); - })); - it("Should return text data for text/plain content-type", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const data = "text data"; - const response = new Response(data, status200Text); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue, data); - })); - it("Should return json data for application/json content-type", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const data = { - test: "test", - }; - const response = new Response(JSON.stringify(data), status200Json); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue.test, data.test); - })); - it("Should return raw response incase of unknown content-type", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const data = "test data"; - const response = new Response(data, status200Unknown); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.equal(responseValue, data); - })); - it("Should return response value as text", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.TEXT); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); - })); - it("Should return response value as text for text/html return type", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.DOCUMENT); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); - })); - it("Should return response value as json", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const json = { test: "test" }; - const response = new Response(JSON.stringify(json), status200); - const responseValue = yield GraphResponseHandler["convertResponse"](response, ResponseType.JSON); - assert.isDefined(responseValue); - assert.equal(responseValue.test, "test"); - })); - it("Should return response value as text for default response type", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const responseValue = yield GraphResponseHandler["convertResponse"](response); - assert.isDefined(responseValue); - assert.equal(typeof responseValue, "string"); - assert.equal(responseValue, htmlString); - })); - }); - /* tslint:enable: no-string-literal */ - describe("getResponse", () => { - it("Should return a raw response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const responseValue = yield GraphResponseHandler.getResponse(response, ResponseType.RAW); - assert.isDefined(responseValue); - assert.isTrue(responseValue instanceof Response); - })); - it("Should return valid 200 OK response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const response = new Response(htmlString, status200); - const responseValue = yield GraphResponseHandler.getResponse(response, ResponseType.TEXT); - assert.isDefined(responseValue); - })); - }); -}); -//# sourceMappingURL=GraphResponseHandler.js.map diff --git a/test/dist/es/test/common/core/GraphResponseHandler.js.map b/test/dist/es/test/common/core/GraphResponseHandler.js.map deleted file mode 100644 index 6f23e1d07..000000000 --- a/test/dist/es/test/common/core/GraphResponseHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphResponseHandler.js","sourceRoot":"","sources":["../../../../../common/core/GraphResponseHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,MAAM,UAAU,GAAG;;;;;;;;;gCASY,CAAC;IAChC,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,uBAAuB;KACnC,CAAC;IACF,MAAM,SAAS,GAAG;QACjB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;KAChB,CAAC;IACF,MAAM,aAAa,GAAG;QACrB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,YAAY;SAC5B;KACD,CAAC;IACF,MAAM,aAAa,GAAG;QACrB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,kBAAkB;SAClC;KACD,CAAC;IACF,MAAM,cAAc,GAAG;QACtB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACR,cAAc,EAAE,YAAY;SAC5B;KACD,CAAC;IACF,MAAM,gBAAgB,GAAG;QACxB,MA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AAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC9E,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,OAAO,aAAa,EAAE,QAAQ,CAAC,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;IAEtC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,8BAA8B,EAAE,GAAS,EAAE;YAC7C,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;YACzF,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,aAAa,YAAY,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;YACpD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACrD,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;YAC1F,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/HTTPClient.d.ts b/test/dist/es/test/common/core/HTTPClient.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/HTTPClient.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/HTTPClient.js b/test/dist/es/test/common/core/HTTPClient.js deleted file mode 100644 index b644343de..000000000 --- a/test/dist/es/test/common/core/HTTPClient.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { HTTPClient } from "../../../src/HTTPClient"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -describe("HTTPClient.ts", () => { - const httpMessageHandler = new DummyHTTPMessageHandler(); - const httpClient = new HTTPClient(httpMessageHandler); - /* tslint:disable: no-string-literal */ - describe("constructor", () => { - it("Should create an instance and populate middleware member", () => { - assert.isDefined(httpClient["middleware"]); - assert.equal(httpClient["middleware"], httpMessageHandler); - }); - it("Should create an instance and populate middleware member when passing a middleware array", () => { - const client = new HTTPClient(...[httpMessageHandler]); - assert.isDefined(client["middleware"]); - assert.equal(client["middleware"], httpMessageHandler); - }); - it("Should throw an error if middleware is undefined", () => { - try { - const client = new HTTPClient(); - } catch (error) { - assert.equal(error.name, "InvalidMiddlewareChain"); - } - }); - it("Should throw an error if middleware is passed as null", () => { - try { - const client = new HTTPClient(null); - } catch (error) { - assert.equal(error.name, "InvalidMiddlewareChain"); - } - }); - it("Should throw an error if middleware is passed as an empty array", () => { - try { - const client = new HTTPClient(...[]); - } catch (error) { - assert.equal(error.name, "InvalidMiddlewareChain"); - } - }); - }); - /* tslint:enable: no-string-literal */ - describe("sendRequest", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - it("Should throw error for invalid request options incase if the url and options are passed", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const url = "dummy_url"; - const context = { - request: url, - }; - yield httpClient.sendRequest(context); - throw new Error("Something wrong with the context validation"); - } catch (error) { - assert.equal(error.name, "InvalidRequestOptions"); - } - })); - it("Should execute for context object with Request instance", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const request = new Request("dummy_url", { - method: "GET", - }); - const context = { - request, - }; - yield httpClient.sendRequest(context); - } catch (error) { - throw error; - } - })); - it("Should execute for context object with request uri and options", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const url = "dummy_url"; - const options = { - method: "GET", - }; - const context = { - request: url, - options, - }; - yield httpClient.sendRequest(context); - } catch (error) { - throw error; - } - })); - })); -}); -//# sourceMappingURL=HTTPClient.js.map diff --git a/test/dist/es/test/common/core/HTTPClient.js.map b/test/dist/es/test/common/core/HTTPClient.js.map deleted file mode 100644 index 3ca0ba328..000000000 --- a/test/dist/es/test/common/core/HTTPClient.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTTPClient.js","sourceRoot":"","sources":["../../../../../common/core/HTTPClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,MAAM,kBAAkB,GAA4B,IAAI,uBAAuB,EAAE,CAAC;IAClF,MAAM,UAAU,GAAe,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAClE,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YACnE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,UA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GAAS,EAAE;YACxG,IAAI;gBACH,MAAM,GAAG,GAAG,WAAW,CAAC;gBACxB,MAAM,OAAO,GAAY;oBACxB,OAAO,EAAE,GAAG;iBACZ,CAAC;gBACF,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAC/D;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;aAClD;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAS,EAAE;YACxE,IAAI;gBACH,MAAM,OAAO,GAAY,IAAI,OAAO,CAAC,WAAW,EAAE;oBACjD,MAAM,EAAE,KAAK;iBACb,CAAC,CAAC;gBACH,MAAM,OAAO,GAAY;oBACxB,OAAO;iBACP,CAAC;gBACF,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAS,EAAE;YAC/E,IAAI;gBACH,MAAM,GAAG,GAAG,WAAW,CAAC;gBACxB,MAAM,OAAO,GAAiB;oBAC7B,MAAM,EAAE,KAAK;iBACb,CAAC;gBACF,MAAM,OAAO,GAAY;oBACxB,OAAO,EAAE,GAAG;oBACZ,OAAO;iBACP,CAAC;gBACF,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;aACtC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/HTTPClientFactory.d.ts b/test/dist/es/test/common/core/HTTPClientFactory.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/HTTPClientFactory.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/HTTPClientFactory.js b/test/dist/es/test/common/core/HTTPClientFactory.js deleted file mode 100644 index 17fd3c903..000000000 --- a/test/dist/es/test/common/core/HTTPClientFactory.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { HTTPClient } from "../../../src/HTTPClient"; -import { HTTPClientFactory } from "../../../src/HTTPClientFactory"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -describe("HTTPClientFactory.ts", () => { - /* tslint:disable: no-string-literal */ - describe("createWithAuthenticationProvider", () => { - const dummyAuthProvider = new DummyAuthenticationProvider(); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - it("Should create an HTTPClient instance with default middleware chain", () => { - const client = HTTPClientFactory.createWithAuthenticationProvider(dummyAuthProvider); - assert.isTrue(client instanceof HTTPClient); - assert.isDefined(client["middleware"]); - }); - it("Should create an HTTPClient with given middleware chain", () => { - const client = HTTPClientFactory.createWithMiddleware(dummyHTTPHandler); - assert.isTrue(client instanceof HTTPClient); - assert.isDefined(client["middleware"]); - }); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=HTTPClientFactory.js.map diff --git a/test/dist/es/test/common/core/HTTPClientFactory.js.map b/test/dist/es/test/common/core/HTTPClientFactory.js.map deleted file mode 100644 index c7db6058a..000000000 --- a/test/dist/es/test/common/core/HTTPClientFactory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"HTTPClientFactory.js","sourceRoot":"","sources":["../../../../../common/core/HTTPClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,uCAAuC;IACvC,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACjD,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;QAC5D,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;QACvD,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;YAC7E,MAAM,MAAM,GAAe,iBAAiB,CAAC,gCAAgC,CAAC,iBAAiB,CAAC,CAAC;YACjG,MAAM,CAAC,MAAM,CAAC,MAAM,YAAY,UAAU,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YAClE,MAAM,MAAM,GAAe,iBAAiB,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;YACpF,MAAM,CAAC,MAAM,CAAC,MAAM,YAAY,UAAU,CAAC,CAAC;YAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/Range.d.ts b/test/dist/es/test/common/core/Range.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/Range.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/Range.js b/test/dist/es/test/common/core/Range.js deleted file mode 100644 index 5d17115ce..000000000 --- a/test/dist/es/test/common/core/Range.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { Range } from "../../../src/Range"; -describe("Range.ts", () => { - describe("Constructor", () => { - const defaultValue = -1; - it("Should create a Range instance with given min and max values", () => { - const min = 1; - const max = 10; - const range = new Range(min, max); - assert.equal(range.minValue, min); - assert.equal(range.maxValue, max); - }); - it("Should create a range instance with default values", () => { - const range = new Range(); - assert.equal(range.minValue, defaultValue); - assert.equal(range.maxValue, defaultValue); - }); - it("Should create a range instance with default max value", () => { - const min = 1; - const range = new Range(min); - assert.equal(range.minValue, min); - assert.equal(range.maxValue, defaultValue); - }); - }); -}); -//# sourceMappingURL=Range.js.map diff --git a/test/dist/es/test/common/core/Range.js.map b/test/dist/es/test/common/core/Range.js.map deleted file mode 100644 index 7fb927417..000000000 --- a/test/dist/es/test/common/core/Range.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../../../common/core/Range.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACzB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC;QAExB,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;YACvE,MAAM,GAAG,GAAG,CAAC,CAAC;YACd,MAAM,GAAG,GAAG,EAAE,CAAC;YACf,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAChE,MAAM,GAAG,GAAG,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/urlGeneration.d.ts b/test/dist/es/test/common/core/urlGeneration.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/urlGeneration.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/urlGeneration.js b/test/dist/es/test/common/core/urlGeneration.js deleted file mode 100644 index a9788cc25..000000000 --- a/test/dist/es/test/common/core/urlGeneration.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { getClient } from "../test-helper"; -const client = getClient(); -const cases = []; -cases.push({ - url: "https://graph.microsoft.com/v1.0/me?$select=displayName", - request: client.api("/me").select("displayName"), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me?$select=displayName", - request: client.api("/me").select(["displayName"]), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle", - request: client.api("me").select(["displayName", "jobTitle"]), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me?$select=displayName,jobTitle", - request: client - .api("/me") - .select(["displayName"]) - .select("jobTitle"), -}); -cases.push({ - url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle", - request: client - .api("/me") - .version("beta") - .select(["displayName"]) - .select("jobTitle"), -}); -cases.push({ - url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle", - request: client - .api("/me") - .version("beta") - .select(["displayName"]) - .select("jobTitle"), -}); -// Need to figure out type signature of select() to allow string, array of strings, and unlimited string parameters -// cases.push({ -// url: "https://graph.microsoft.com/beta/me?$select=displayName,jobTitle,mailNickname", -// request: client.api("/me") -// .version("beta") -// .select("displayName", "jobTitle", "mailNickname") -// }) -cases.push({ - url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true", - request: client - .api("/me/people") - .version("beta") - .select(["displayName"]) - .select("title") - .count(true), -}); -cases.push({ - url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true&$search=senior", - request: client - .api("/me/people") - .version("beta") - .select(["displayName", "title"]) - .count(true) - .query({ $search: "senior" }), -}); -cases.push({ - url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title&$count=true&$search=senior", - request: client - .api("/me/people") - .version("beta") - .select(["displayName", "title"]) - .count(true) - .query("$search=senior"), -}); -cases.push({ - url: "https://graph.microsoft.com/beta/me/people?$select=displayName,title,id&$count=false&$expand=a($expand=a,b)", - request: client - .api("/me/people") - .version("beta") - .select(["displayName", "title"]) - .count(true) - .expand("a($expand=a,b)") - .query("$select=id") - .query("$count=false"), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/people?$select=displayName,title,id&select=value", - request: client - .api("/me/people") - .version("v1.0") - .select(["displayName", "title"]) - .query({ select: "value" }) - .query({ $select: "id" }), -}); -// handling an invalid input -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/people?$select=displayName,title&select=value&test", - request: client - .api("/me/people") - .version("v1.0") - .select(["displayName", "title"]) - .query({ select: "value" }) - .query("test"), -}); -// handling an invalid input -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/people?$expand=address($select=home,$expand=city)&$select=home,displayName,title&select=value&test", - request: client - .api("/me/people?$expand=address($select=home,$expand=city)&$select=home") - .version("v1.0") - .select(["displayName", "title"]) - .query({ select: "value" }) - .query("test"), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/people?$expand=home($select=home)&name=test", - request: client.api("/me/people").query("?name=test&$expand=home($select=home)"), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/people?$expand=home($select=home)&name=test", - request: client.api("/me/people?name=test&$expand=home($select=home)"), -}); -cases.push({ - url: "https://graph.microsoft.com/v1.0/me/drive/root?$expand=children($select=name),permissions", - request: client - .api("me/drive/root") - .expand("children($select=name)") - .expand("permissions"), -}); -describe("urlGeneration.ts", () => { - /* tslint:disable: no-string-literal */ - describe("buildFullUrl", () => { - for (const testCase of cases) { - it("should correctly build " + testCase.url, () => { - assert.equal(testCase.url, testCase.request["buildFullUrl"]()); - }); - } - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=urlGeneration.js.map diff --git a/test/dist/es/test/common/core/urlGeneration.js.map b/test/dist/es/test/common/core/urlGeneration.js.map deleted file mode 100644 index dd9ccb0eb..000000000 --- a/test/dist/es/test/common/core/urlGeneration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"urlGeneration.js","sourceRoot":"","sources":["../../../../../common/core/urlGeneration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAC3B,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,yDAAyD;IAC9D,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;CAChD,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,yDAAyD;IAC9D,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;CAC7D,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,MAAM;SACb,GAAG,CAAC,KAAK,CAAC;SACV,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;SACvB,MAAM,CAAC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GAAG,CAAC,oEAAoE,CAAC;SACzE,OAAO,CAAC,MAAM,CAAC;SACf,MAAM,CAAC,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SAChC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;SAC1B,KAAK,CAAC,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,iFAAiF;IACtF,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC;CAChF,CAAC,CAAC;AACH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,iFAAiF;IACtF,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC;CACtE,CAAC,CAAC;AAEH,KAAK,CAAC,IAAI,CAAC;IACV,GAAG,EAAE,2FAA2F;IAChG,OAAO,EAAE,MAAM;SACb,GAAG,CAAC,eAAe,CAAC;SACpB,MAAM,CAAC,wBAAwB,CAAC;SAChC,MAAM,CAAC,aAAa,CAAC;CACvB,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,uCAAuC;IACvC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC7B,EAAE,CAAC,yBAAyB,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE;gBACjD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;SACH;IACF,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/core/urlParsing.d.ts b/test/dist/es/test/common/core/urlParsing.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/core/urlParsing.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/core/urlParsing.js b/test/dist/es/test/common/core/urlParsing.js deleted file mode 100644 index 249574655..000000000 --- a/test/dist/es/test/common/core/urlParsing.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { getClient } from "../test-helper"; -const client = getClient(); -const testCases = { - "/me": "https://graph.microsoft.com/v1.0/me", - "/me/": "https://graph.microsoft.com/v1.0/me/", - me: "https://graph.microsoft.com/v1.0/me", - "me/events": "https://graph.microsoft.com/v1.0/me/events", - "/me/events": "https://graph.microsoft.com/v1.0/me/events", - "https://graph.microsoft.com/v1.0/me/events": "https://graph.microsoft.com/v1.0/me/events", - "https://graph.microsoft.com/beta/me/events?$filter=startswith(subject, 'update')": "https://graph.microsoft.com/beta/me/events?$filter=startswith(subject, 'update')", - "me/events?$filter=startswith(subject, 'update')": "https://graph.microsoft.com/v1.0/me/events?$filter=startswith(subject, 'update')", - "/me?a=b": "https://graph.microsoft.com/v1.0/me?a=b", - "/me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d", - "me?$filter=b&c=d": "https://graph.microsoft.com/v1.0/me?$filter=b&c=d", - // oData params should work with and without $ - "me?$select=displayName": "https://graph.microsoft.com/v1.0/me?$select=displayName", - "me?select=displayName": "https://graph.microsoft.com/v1.0/me?select=displayName", - "https://graph.microsoft.com/beta/me?select=displayName": "https://graph.microsoft.com/beta/me?select=displayName", - // test for nested query parameters - "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/?$expand=accessPackageAssignmentPolicies,accessPackageResourceRoleScopes($expand=accessPackageResourceRole,accessPackageResourceScope)": "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/?$expand=accessPackageAssignmentPolicies,accessPackageResourceRoleScopes($expand=accessPackageResourceRole,accessPackageResourceScope)", - "me?$select=displayName&$select=id": "https://graph.microsoft.com/v1.0/me?$select=displayName,id", - "/me?$filter=b&$filter=a": "https://graph.microsoft.com/v1.0/me?$filter=a", - "https://graph.microsoft.com/v1.0/me?$top=4&$expand=4&$iscount=true&$top=2": "https://graph.microsoft.com/v1.0/me?$top=2&$expand=4&$iscount=true", - "/items?$expand=fields($select=Title)&$expand=name($select=firstName)": "https://graph.microsoft.com/v1.0/items?$expand=fields($select=Title),name($select=firstName)", - // Passing invalid parameters - "/me?test&123": "https://graph.microsoft.com/v1.0/me?test&123", - "/me?$select($select=name)": "https://graph.microsoft.com/v1.0/me?$select($select=name)", - "/me/?$filter=any(Actors, Name eq 'John Belushi')": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors, Name eq 'John Belushi')", - "/me/$filter=any(Actors, it/ID eq Director/ID)": "https://graph.microsoft.com/v1.0/me/$filter=any(Actors, it/ID eq Director/ID)", - "/me?$whatif": "https://graph.microsoft.com/v1.0/me?$whatif", - "/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))": "https://graph.microsoft.com/v1.0/me/?$filter=any(Actors a, any(a/Movies m, a/ID eq m/Director/ID))", -}; -describe("urlParsing.ts", () => { - /* tslint:disable: no-string-literal */ - describe("parsePath", () => { - for (const path in testCases) { - if (testCases.hasOwnProperty(path)) { - it("should correctly parse " + path, () => { - const request = client.api(path); - assert.equal(request["buildFullUrl"](), testCases[path]); - }); - } - } - }); -}); -/* tslint:enable: no-string-literal */ -//# sourceMappingURL=urlParsing.js.map diff --git a/test/dist/es/test/common/core/urlParsing.js.map b/test/dist/es/test/common/core/urlParsing.js.map deleted file mode 100644 index 9057611ab..000000000 --- a/test/dist/es/test/common/core/urlParsing.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C,cAAc,CAAC,IAAI,CAAC,EAAE;gBACnC,EAAE,CAAC,yBAAyB,GAAG,IAAI,EAAE,GAAG,EAAE;oBACzC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACjC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;aACH;SACD;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,sCAAsC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts b/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.js b/test/dist/es/test/common/middleware/AuthenticationHandler.js deleted file mode 100644 index 7c8a39c04..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandler.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { AuthenticationHandler } from "../../../src/middleware/AuthenticationHandler"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -const dummyAuthProvider = new DummyAuthenticationProvider(); -const authHandler = new AuthenticationHandler(dummyAuthProvider); -describe("AuthenticationHandler.ts", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - /* tslint:disable: no-string-literal */ - describe("Constructor", () => { - it("Should return an AuthenticationHandler for given AuthenticationProvider", () => { - assert.isTrue(authHandler instanceof AuthenticationHandler); - assert.equal(authHandler["authenticationProvider"], dummyAuthProvider); - }); - }); - /* tslint:enable: no-string-literal */ - })); -//# sourceMappingURL=AuthenticationHandler.js.map diff --git a/test/dist/es/test/common/middleware/AuthenticationHandler.js.map b/test/dist/es/test/common/middleware/AuthenticationHandler.js.map deleted file mode 100644 index 4db14f5d4..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuthenticationHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/AuthenticationHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;AAC5D,MAAM,WAAW,GAAG,IAAI,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;AAEjE,QAAQ,CAAC,0BAA0B,EAAE,GAAS,EAAE;IAC/C,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;YAClF,MAAM,CAAC,MAAM,CAAC,WAAW,YAAY,qBAAqB,CAAC,CAAC;YAC5D,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAA,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js deleted file mode 100644 index 5a8cf462e..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { AuthenticationHandlerOptions } from "../../../src/middleware/options/AuthenticationHandlerOptions"; -import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; -import { DummyAuthenticationProvider } from "../DummyAuthenticationProvider"; -describe("AuthenticationHandlerOptions.ts", () => { - const dummyAuthProvider = new DummyAuthenticationProvider(); - const msalAuthProviderOptions = new MSALAuthenticationProviderOptions([]); - it("Should create an instance with all the given options", () => { - const options = new AuthenticationHandlerOptions(dummyAuthProvider, msalAuthProviderOptions); - assert.equal(options.authenticationProvider, dummyAuthProvider); - assert.equal(options.authenticationProviderOptions, msalAuthProviderOptions); - }); - it("Should be undefined value if no value is passed", () => { - const options = new AuthenticationHandlerOptions(undefined, msalAuthProviderOptions); - assert.isUndefined(options.authenticationProvider); - assert.equal(options.authenticationProviderOptions, msalAuthProviderOptions); - }); -}); -//# sourceMappingURL=AuthenticationHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map b/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map deleted file mode 100644 index 3bc02302e..000000000 --- a/test/dist/es/test/common/middleware/AuthenticationHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AuthenticationHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/AuthenticationHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,8DAA8D,CAAC;AAC5G,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAChD,MAAM,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;IAC5D,MAAM,uBAAuB,GAAG,IAAI,iCAAiC,CAAC,EAAE,CAAC,CAAC;IAC1E,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC;QAC7F,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,iBAAiB,CAAC,CAAC;QAChE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC1D,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACrF,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,6BAA6B,EAAE,uBAAuB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/ChaosHandler.d.ts b/test/dist/es/test/common/middleware/ChaosHandler.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/test/dist/es/test/common/middleware/ChaosHandler.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/test/dist/es/test/common/middleware/ChaosHandler.js b/test/dist/es/test/common/middleware/ChaosHandler.js deleted file mode 100644 index 936c04971..000000000 --- a/test/dist/es/test/common/middleware/ChaosHandler.js +++ /dev/null @@ -1,225 +0,0 @@ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; -import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; -import { RequestMethod } from "../../../src/RequestMethod"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -const chaosHandlerOptions = new ChaosHandlerOptions(); -const chaosHandler = new ChaosHandler(); -describe("ChaosHandler.ts", () => { - /* tslint:disable: no-string-literal */ - describe("constructor", () => { - it("Should create an instance with given options", () => { - const handler = new ChaosHandler(chaosHandlerOptions); - assert.isDefined(handler["options"]); - }); - it("Should create an instance with default set of options", () => { - const handler = new ChaosHandler(); - assert.isDefined(handler["options"]); - }); - }); - describe("createResponseHeaders", () => { - it("Should have request-id for every random statusCode", () => { - const responseHeader = chaosHandler["createResponseHeaders"](204, "xxxxxxxxxxxxxxxx", new Date().toString()); - assert.isDefined(responseHeader.get("request-id")); - }); - it("Should have retry-after for 429 case", () => { - const responseHeader = chaosHandler["createResponseHeaders"](429, "xxxxxxxxxxxxxxxx", new Date().toString()); - assert.isDefined(responseHeader.get("retry-after")); - }); - }); - describe("createResponseBody", () => { - it("Should return error in response body for error scenarios", () => { - const responseBody = chaosHandler["createResponseBody"](404, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); - assert.isDefined(responseBody["error"]); - }); - it("Should return empty response body for success scenarios", () => { - const responseBody = chaosHandler["createResponseBody"](200, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); - assert.equal(Object.keys(responseBody).length, 0); - }); - }); - describe("createResponse", () => { - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - }; - it("Should return a valid response object for MANUAL case", () => { - chaosHandler["createResponse"](new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Manual response", 404), cxt); - assert.isDefined(cxt.response); - }); - it("Should return a valid response object for RANDOM case", () => { - chaosHandler["createResponse"](new ChaosHandlerOptions(ChaosStrategy.RANDOM), cxt); - assert.isDefined(cxt.response); - }); - }); - describe("sendRequest", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - }; - const manualMap = new Map([["/me", new Map([["GET", 500]])]]); - const tempManualOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL); - const tempChaosHandler = new ChaosHandler(tempManualOptions, manualMap); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - const handler = new ChaosHandler(); - handler.setNext(dummyHTTPHandler); - it("Should return a response after creating it", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - tempChaosHandler["sendRequest"](tempManualOptions, cxt); - assert.isDefined(cxt.response); - })); - it("Should send the request to the graph", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - handler["sendRequest"](new ChaosHandlerOptions(ChaosStrategy.RANDOM, "I generated the error", undefined, 100), cxt); - assert.isDefined(cxt.response); - })); - })); - describe("getRandomStatusCode", () => { - it("Should return a status code for GET method", () => { - assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.GET)); - }); - it("Should return a status code for POST method", () => { - assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.POST)); - }); - it("Should return a status code for PUT method", () => { - assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.PUT)); - }); - it("Should return a status code for PATCH method", () => { - assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.PATCH)); - }); - it("Should return a status code for DELETE method", () => { - assert.isDefined(chaosHandler["getRandomStatusCode"](RequestMethod.DELETE)); - }); - }); - describe("getRelativeURL", () => { - it("Should return a relative URL for the complete URL", () => { - assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me"), "/me"); - }); - it("Should return a relative URL for the complete URL with filter", () => { - assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me/messages?filter=emailAddress eq 'jon@contoso.com'"), "/me/messages"); - }); - it("Should return a relative URL for the complete URL with ids", () => { - assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/v1.0/me/messages/q1abcxx-xxxxxx-xxxxabc"), "/me/messages/q1abcxx-xxxxxx-xxxxabc"); - }); - it("Should return a relative URL for the complete URL in case of beta", () => { - assert.equal(chaosHandler["getRelativeURL"]("https://graph.microsoft.com/beta/me/messages"), "/me/messages"); - }); - }); - describe("setStatusCode", () => { - const manualMap = new Map([["/me/messages/.*", new Map([["GET", 500], ["PATCH", 201]])], ["/me", new Map([["GET", 500], ["PATCH", 201]])]]); - const tempManualOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL); - const tempManualOptionsRegex = new ChaosHandlerOptions(ChaosStrategy.MANUAL); - const tempChaosHandlerManual = new ChaosHandler(tempManualOptions, manualMap); - const tempChaosHandlerManualRegex = new ChaosHandler(tempManualOptionsRegex, manualMap); - it("Should set a statusCode for MANUAL mode", () => { - const tempOptions = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Set status code", 404); - chaosHandler["setStatusCode"](tempOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.GET); - assert.isDefined(tempOptions.statusCode); - }); - it("Should set a statusCode for RANDOM mode", () => { - const tempOptions = new ChaosHandlerOptions(ChaosStrategy.RANDOM, "I generated the error", undefined, 100); - chaosHandler["setStatusCode"](tempOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.POST); - assert.isDefined(tempOptions.statusCode); - }); - it("Should set a statusCode for MANUAL mode with manualMap", () => { - tempChaosHandlerManual["setStatusCode"](tempManualOptions, "https://graph.microsoft.com/v1.0/me", RequestMethod.PATCH); - assert.equal(tempManualOptions.statusCode, 201); - }); - it("Should set a statusCode for MANUAL mode with manualMap matching regex", () => { - tempChaosHandlerManualRegex["setStatusCode"](tempManualOptionsRegex, "https://graph.microsoft.com/v1.0/me/messages/abc123-xxxxx-xxxxx", RequestMethod.GET); - assert.equal(tempManualOptionsRegex.statusCode, 500); - }); - }); - describe("getOptions", () => { - it("Should return the options in the context object", () => { - const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Get options", 405); - const cxt = { - request: "url", - middlewareControl: new MiddlewareControl([options]), - }; - const o = chaosHandler["getOptions"](cxt); - assert.equal(o.chaosStrategy, ChaosStrategy.MANUAL); - assert.equal(o.statusCode, 405); - }); - it("Should return the default set of options with RANDOM in the middleware", () => { - const cxt = { - request: "url", - }; - const o = chaosHandler["getOptions"](cxt); - assert.equal(o.chaosStrategy, ChaosStrategy.RANDOM); - assert.equal(o.statusCode, undefined); - }); - it("Should return the default set of options with DEFAULT in the middleware", () => { - const tempChaosHandler = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.MANUAL)); - const cxt = { - request: "url", - }; - const o = tempChaosHandler["getOptions"](cxt); - assert.equal(o.chaosStrategy, ChaosStrategy.MANUAL); - assert.equal(o.statusCode, undefined); - }); - }); - describe("execute", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const manualMap = new Map([["/me", new Map([["GET", 500], ["PATCH", 201]])]]); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - const tempChaosHandlerDefault = new ChaosHandler(new ChaosHandlerOptions()); - const tempChaosHandlerRandom = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.RANDOM)); - const tempChaosHandlerManual = new ChaosHandler(new ChaosHandlerOptions(ChaosStrategy.MANUAL), manualMap); - tempChaosHandlerDefault.setNext(dummyHTTPHandler); - tempChaosHandlerRandom.setNext(dummyHTTPHandler); - tempChaosHandlerManual.setNext(dummyHTTPHandler); - it("Should return response for Default Case", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new ChaosHandlerOptions(ChaosStrategy.RANDOM); - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - middlewareControl: new MiddlewareControl([options]), - }; - assert.isDefined(tempChaosHandlerDefault["execute"](cxt)); - })); - it("Should return response for Random case", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - }; - assert.isDefined(tempChaosHandlerRandom["execute"](cxt)); - })); - it("Should return response for Manual Global case", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - }; - assert.isDefined(tempChaosHandlerManual["execute"](cxt)); - })); - it("Should return response for Manual Request Level case", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Manual Request level case", 200); - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "GET", - }, - middlewareControl: new MiddlewareControl([options]), - }; - assert.isDefined(tempChaosHandlerManual["execute"](cxt)); - })); - })); -}); -//# sourceMappingURL=ChaosHandler.js.map diff --git a/test/dist/es/test/common/middleware/ChaosHandler.js.map b/test/dist/es/test/common/middleware/ChaosHandler.js.map deleted file mode 100644 index 35318728c..000000000 --- a/test/dist/es/test/common/middleware/ChaosHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ChaosHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/ChaosHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,EAAE,aAAa,EA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AS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAS,EAAE;YACvD,MAAM,GAAG,GAAY;gBACpB,OAAO,EAAE,qCAAqC;gBAC9C,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAS,EAAE;YAC9D,MAAM,GAAG,GAAY;gBACpB,OAAO,EAAE,qCAAqC;gBAC9C,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,GAAS,EAAE;YACrE,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,aAAa,CAAC,MAAM,EAAE,2BAA2B,EAAE,GAAG,CAAC,CAAC;YAChG,MAAM,GAAG,GAAY;gBACpB,OAAO,EAAE,qCAAqC;gBAC9C,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;gBACD,iBAAiB,EAAE,IAAI,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;aACnD,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js deleted file mode 100644 index 11a4f83b0..000000000 --- a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { MSALAuthenticationProviderOptions } from "../../../src/MSALAuthenticationProviderOptions"; -describe("MSALAuthenticationProviderOptions.ts", () => { - it("Should create an instance with all the given options", () => { - const scopes = ["dummy.scope"]; - const options = new MSALAuthenticationProviderOptions(scopes); - assert.isDefined(options.scopes); - assert.equal(options.scopes, scopes); - }); -}); -//# sourceMappingURL=MSALAuthenticationProviderOptions.js.map diff --git a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map b/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map deleted file mode 100644 index fd972ff71..000000000 --- a/test/dist/es/test/common/middleware/MSALAuthenticationProviderOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MSALAuthenticationProviderOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/MSALAuthenticationProviderOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAEnG,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC/D,MAAM,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.d.ts b/test/dist/es/test/common/middleware/MiddlewareControl.d.ts deleted file mode 100644 index ac7981909..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareControl.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.js b/test/dist/es/test/common/middleware/MiddlewareControl.js deleted file mode 100644 index a00294496..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareControl.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -/** - * @module MiddlewareControl - */ -import { assert } from "chai"; -import "isomorphic-fetch"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { DummyHandlerOptions } from "../DummyHandlerOptions"; -describe("MiddlewareControl.ts", () => { - const dummyHandlerOption = new DummyHandlerOptions(); - /* tslint:disable: no-string-literal */ - describe("constructor", () => { - it("Should populate its middleware options map", () => { - const middlewareControl = new MiddlewareControl([dummyHandlerOption]); - assert.isDefined(middlewareControl["middlewareOptions"]); - assert.equal(middlewareControl["middlewareOptions"].size, 1); - }); - it("Should create empty middleware options map by default", () => { - const middlewareControl = new MiddlewareControl(); - assert.isDefined(middlewareControl["middlewareOptions"]); - assert.equal(middlewareControl["middlewareOptions"].size, 0); - }); - }); - /* tslint:enable: no-string-literal */ - describe("getMiddlewareOption", () => { - it("Should return the middleware option for a given class name", () => { - const middlewareControl = new MiddlewareControl([dummyHandlerOption]); - const retryOptions = middlewareControl.getMiddlewareOptions(dummyHandlerOption.constructor); - assert.isDefined(retryOptions); - assert.equal(dummyHandlerOption, retryOptions); - }); - it("Should return undefined for unknown class name", () => { - const middlewareControl = new MiddlewareControl([dummyHandlerOption]); - const retryOptions = middlewareControl.getMiddlewareOptions(() => "NotAvailableHandlerOption"); - assert.isUndefined(retryOptions); - }); - }); -}); -//# sourceMappingURL=MiddlewareControl.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareControl.js.map b/test/dist/es/test/common/middleware/MiddlewareControl.js.map deleted file mode 100644 index 90ccf6c7b..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareControl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareControl.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACrC,MAAM,kBAAkB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACrD,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACrD,MAAM,iBAAiB,G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AAC;QAClC,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts b/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareFactory.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.js b/test/dist/es/test/common/middleware/MiddlewareFactory.js deleted file mode 100644 index f9e1bb694..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareFactory.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { AuthenticationHandler, CustomAuthenticationProvider, HTTPMessageHandler, RedirectHandler, RetryHandler, TelemetryHandler } from "../../../src"; -import { MiddlewareFactory } from "../../../src/middleware/MiddlewareFactory"; -describe("MiddlewareFactory", () => { - it("Should return the default pipeline", () => { - const provider = (done) => { - done(null, "dummy_token"); - }; - const defaultMiddleWareArray = MiddlewareFactory.getDefaultMiddlewareChain(new CustomAuthenticationProvider(provider)); - assert.isTrue(defaultMiddleWareArray[0] instanceof AuthenticationHandler); - assert.isTrue(defaultMiddleWareArray[1] instanceof RetryHandler); - assert.isTrue(defaultMiddleWareArray[2] instanceof RedirectHandler); - assert.isTrue(defaultMiddleWareArray[3] instanceof TelemetryHandler); - assert.isTrue(defaultMiddleWareArray[4] instanceof HTTPMessageHandler); - }); -}); -//# sourceMappingURL=MiddlewareFactory.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareFactory.js.map b/test/dist/es/test/common/middleware/MiddlewareFactory.js.map deleted file mode 100644 index 4a3b2866e..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareFactory.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareFactory.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC7C,MAAM,QAAQ,GAAiB,CAAC,IAAI,EAAE,EAAE;YACvC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC3B,CAAC,CAAC;QACF,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEvH,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,qBAAqB,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,YAAY,CAAC,CAAC;QACjE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,eAAe,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,gBAAgB,CAAC,CAAC;QACrE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,kBAAkB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.d.ts b/test/dist/es/test/common/middleware/MiddlewareUtil.d.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.js b/test/dist/es/test/common/middleware/MiddlewareUtil.js deleted file mode 100644 index b02f84ac6..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareUtil.js +++ /dev/null @@ -1,306 +0,0 @@ -// /** -// * ------------------------------------------------------------------------------------------- -// * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. -// * See License in the project root for license information. -// * ------------------------------------------------------------------------------------------- -// */ -// import { assert } from "chai"; -// import { NFHeaders } from "node-fetch"; -// import { FetchOptions } from "../../src/IFetchOptions"; -// import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../src/middleware/MiddlewareUtil"; -// describe("MiddlewareUtil.ts", async () => { -// describe("getRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const url = "dummy_url"; -// it("Should get header from request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// const headerValue: string = getRequestHeader(request, undefined, key); -// assert.equal(headerValue, value); -// }); -// it("Should get header from headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); -// it("Should get header from Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ -// version: "version", -// [key]: value, -// }), -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); -// it("Should get header from array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"], [key, value]], -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); -// }); -// describe("setRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const url = "dummy_url"; -// it("Should set header in request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// }, -// }); -// setRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); -// it("Should replace header in request object if the header is already present", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// setRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); -// it("Should set header for empty headers", () => { -// const options: FetchOptions = { -// method: "test", -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); -// it("Should set header in headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// }, -// }; -// setRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); -// it("Should replace header in headers object if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// setRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); -// it("Should set header in Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version" }), -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); -// it("Should replace header in Headers instance if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: value }), -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); -// it("Should set header in array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"]], -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal(options.headers[1][1], value); -// }); -// it("Should replace header in array of headers if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, "dummy/type"]], -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 1); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], value); -// }); -// }); -// describe("appendRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const firstValue: string = "text/html"; -// const url = "dummy_url"; -// it("Should set header in request object if the header is not present", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); -// it("Should append header in request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: firstValue, -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// const values = (request.headers as NFHeaders).getAll(key); -// assert.equal(values[0], firstValue); -// assert.equal(values[1], value); -// }); -// it("Should append header in request object even if the value is duplicate", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// const values = (request.headers as NFHeaders).getAll(key); -// assert.equal(values[0], value); -// assert.equal(values[1], value); -// }); -// it("Should set header for empty headers", () => { -// const options: FetchOptions = { -// method: "test", -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as NFHeaders).get(key), value); -// }); -// it("Should set header in headers object if header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); -// it("Should append header in headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: firstValue, -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], `${firstValue}, ${value}`); -// }); -// it("Should append header in headers object even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], `${value}, ${value}`); -// }); -// it("Should set header in Headers instance if header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version" }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); -// it("Should append header in Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: firstValue }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// const values = (options.headers as NFHeaders).getAll(key); -// assert.equal(values[0], firstValue); -// assert.equal(values[1], value); -// }); -// it("Should append header in Headers instance even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: value }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// const values = (options.headers as NFHeaders).getAll(key); -// assert.equal(values[0], value); -// assert.equal(values[1], value); -// }); -// it("Should set header in array of headers if the header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal(options.headers[1][1], value); -// }); -// it("Should append header in array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, firstValue]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 2); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], firstValue); -// assert.equal(options.headers[1][0], key); -// assert.equal(options.headers[1][1], value); -// }); -// it("Should append header in array of headers even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, value]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 2); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], value); -// assert.equal(options.headers[1][0], key); -// assert.equal(options.headers[1][1], value); -// }); -// }); -// describe("generateUUID", () => { -// it("Should return the unique uuid", () => { -// const uuid = generateUUID(); -// assert.equal(uuid.length, 36); -// }); -// }); -// }); -//# sourceMappingURL=MiddlewareUtil.js.map diff --git a/test/dist/es/test/common/middleware/MiddlewareUtil.js.map b/test/dist/es/test/common/middleware/MiddlewareUtil.js.map deleted file mode 100644 index fb5231efd..000000000 --- a/test/dist/es/test/common/middleware/MiddlewareUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MiddlewareUtil.js","sourceRoot":"","sources":["../../../../../common/middleware/MiddlewareUtil.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,iGAAiG;AACjG,iGAAiG;AACjG,8DAA8D;AAC9D,iGAAiG;AACjG,MAAM;AAEN,iCAAiC;AACjC,0CAA0C;AAE1C,0DAA0D;AAC1D,+HAA+H;AAE/H,8CAA8C;AAC9C,wCAAwC;AACxC,wCAAwC;AACxC,8CAA8C;AAC9C,6BAA6B;AAC7B,wDAAwD;AACxD,iDAAiD;AACjD,sBAAsB;AACtB,iBAAiB;AACjB,2BAA2B;AAC3B,qBAAqB;AACrB,SAAS;AACT,SAAS;AACT,4EAA4E;AAC5E,uCAAuC;AACvC,QAAQ;AAER,wDAAwD;AACxD,qCAAqC;AACrC,sBAAsB;AACtB,iBAAiB;AACjB,2BAA2B;AAC3B,qBAAqB;AACrB,SAAS;AACT,QAAQ;AACR,sEAAsE;AACtE,uCAAuC;AACvC,QAAQ;AAER,0DAA0D;AAC1D,qCAAqC;AACrC,sBAAsB;AACtB,6BAA6B;AAC7B,2BAA2B;AAC3B,qBAAqB;AACrB,UAAU;AACV,QAAQ;AACR,sEAAsE;AACtE,uCAAuC;AACvC,QAAQ;AAER,0DAA0D;AAC1D,qCAAqC;AACrC,sBAAsB;AACtB,uDAAuD;AACvD,QAAQ;AACR,sEAAsE;AACtE,uCAAuC;AACvC,QAAQ;AACR,OAAO;AAEP,wCAAwC;AACxC,wCAAwC;AACxC,8CAA8C;AAC9C,6BAA6B;AAC7B,sDAAsD;AACtD,iDAAiD;AACjD,sBAAsB;AACtB,iBAAiB;AACjB,2BAA2B;AAC3B,SAAS;AACT,SAAS;AACT,uDAAuD;AACvD,oDAAoD;AACpD,QAAQ;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;AAChE,0CAA0C;AAC1C,qCAAqC;AACrC,QAAQ;AAER,0FAA0F;AAC1F,qCAAqC;AACrC,sBAAsB;AACtB,kEAAkE;AAClE,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,gEAAgE;AAChE,qCAAqC;AACrC,qCAAqC;AACrC,QAAQ;AAER,qFAAqF;AACrF,qCAAqC;AACrC,sBAAsB;AACtB,yCAAyC;AACzC,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,iDAAiD;AACjD,QAAQ;AAER,2DAA2D;AAC3D,qCAAqC;AACrC,sBAAsB;AACtB,oCAAoC;AACpC,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,8DAA8D;AAC9D,+CAA+C;AAC/C,sDAAsD;AACtD,+CAA+C;AAC/C,iDAAiD;AACjD,QAAQ;AAER,0FAA0F;AAC1F,qCAAqC;AACrC,sBAAsB;AACtB,+BAA+B;AAC/B,QAAQ;AACR,oDAAoD;AACpD,wCAAwC;AACxC,8DAA8D;AAC9D,+CAA+C;AAC/C,iDAAiD;AACjD,+CAA+C;AAC/C,iDAAiD;AACjD,QAAQ;AACR,OAAO;AAEP,oCAAoC;AACpC,gDAAgD;AAChD,kCAAkC;AAClC,oCAAoC;AACpC,QAAQ;AACR,OAAO;AACP,MAAM"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RedirectHandler.d.ts b/test/dist/es/test/common/middleware/RedirectHandler.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/RedirectHandler.js b/test/dist/es/test/common/middleware/RedirectHandler.js deleted file mode 100644 index 73f01b226..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandler.js +++ /dev/null @@ -1,323 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; -import { RedirectHandler } from "../../../src/middleware/RedirectHandler"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -const redirectHandlerOptions = new RedirectHandlerOptions(); -const redirectHandler = new RedirectHandler(); -describe("RedirectHandler.ts", () => { - /* tslint:disable: no-string-literal */ - describe("constructor", () => { - it("Should create an instance with given options", () => { - const handler = new RedirectHandler(redirectHandlerOptions); - assert.isDefined(handler["options"]); - }); - it("Should create an instance with default set of options", () => { - const handler = new RedirectHandler(); - assert.isDefined(handler["options"]); - }); - }); - describe("isRedirect", () => { - it("Should return true for response having 301 status code", () => { - const response = new Response("Dummy", { - status: 301, - }); - assert.isTrue(redirectHandler["isRedirect"](response)); - }); - it("Should return true for response having 302 status code", () => { - const response = new Response("Dummy", { - status: 302, - }); - assert.isTrue(redirectHandler["isRedirect"](response)); - }); - it("Should return true for response having 303 status code", () => { - const response = new Response("Dummy", { - status: 303, - }); - assert.isTrue(redirectHandler["isRedirect"](response)); - }); - it("Should return true for response having 307 status code", () => { - const response = new Response("Dummy", { - status: 307, - }); - assert.isTrue(redirectHandler["isRedirect"](response)); - }); - it("Should return true for response having 308 status code", () => { - const response = new Response("Dummy", { - status: 308, - }); - assert.isTrue(redirectHandler["isRedirect"](response)); - }); - it("Should return false for non redirect status codes", () => { - const response = new Response("Dummy", { - status: 200, - }); - assert.isFalse(redirectHandler["isRedirect"](response)); - }); - }); - describe("hasLocationHeader", () => { - it("Should return true for response with location header", () => { - const res = new Response("Dummy", { - status: 301, - headers: { - location: "https://dummylocation.microsoft.com", - }, - }); - assert.isTrue(redirectHandler["hasLocationHeader"](res)); - }); - it("Should return false for response without location header", () => { - const res = new Response("Dummy", { - status: 301, - }); - assert.isFalse(redirectHandler["hasLocationHeader"](res)); - }); - }); - describe("getLocationHeader", () => { - it("Should return location from response", () => { - const location = "https://dummylocation.microsoft.com"; - const res = new Response("Dummy", { - status: 301, - headers: { - location, - }, - }); - assert.equal(redirectHandler["getLocationHeader"](res), location); - }); - it("Should return null for response without location header", () => { - const res = new Response("Dummy", { - status: 301, - }); - assert.equal(redirectHandler["getLocationHeader"](res), null); - }); - }); - describe("isRelativeURL", () => { - it("Should return true for a relative url", () => { - const url = "/graphproxy/me"; - assert.isTrue(redirectHandler["isRelativeURL"](url)); - }); - it("Should return false for a absolute url", () => { - const url = "https://graph.microsoft.com/v1.0/graphproxy/me"; - assert.isFalse(redirectHandler["isRelativeURL"](url)); - }); - }); - describe("shouldDropAuthorizationHeader", () => { - it("Should return true for urls with different domain", () => { - const requestUrl = "https://graph.microsoft.com/v1.0/me"; - const redirectedUrl = "https://graphredirection.microsoft.com/v1.0/me"; - assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - it("Should return true for urls with different domain and one without path", () => { - const requestUrl = "https://graph.microsoft.com/v1.0/me"; - const redirectedUrl = "https://graphredirection.microsoft.com/"; - assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - it("Should return true for urls with different domain without path", () => { - const requestUrl = "https://graph.microsoft.com/"; - const redirectedUrl = "https://graphredirection.microsoft.com"; - assert.isTrue(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - it("Should return false relative urls", () => { - const requestUrl = "/graph/me/"; - const redirectedUrl = "/graphRedirection/me"; - assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - it("Should return false redirect url is relative", () => { - const requestUrl = "https://graph.microsoft.com/v1.0/me"; - const redirectedUrl = "/graphRedirection"; - assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - it("Should return false for urls with same domain", () => { - const requestUrl = "https://graph.microsoft.com/v1.0/me"; - const redirectedUrl = "https://graph.microsoft.com/v2.0/me"; - assert.isFalse(redirectHandler["shouldDropAuthorizationHeader"](requestUrl, redirectedUrl)); - }); - }); - describe("getOptions", () => { - it("Should return the options in the context object", () => { - const maxRedirects = 10; - const shouldRedirect = () => false; - const options = new RedirectHandlerOptions(maxRedirects, shouldRedirect); - const cxt = { - request: "url", - middlewareControl: new MiddlewareControl([options]), - }; - const o = redirectHandler["getOptions"](cxt); - assert.equal(o.maxRedirects, maxRedirects); - assert.equal(o.shouldRedirect, shouldRedirect); - }); - it("Should return the default set of options in the middleware", () => { - const cxt = { - request: "url", - }; - const o = redirectHandler["getOptions"](cxt); - assert.equal(o.maxRedirects, redirectHandler["options"].maxRedirects); - assert.equal(o.shouldRedirect, redirectHandler["options"].shouldRedirect); - }); - }); - describe("executeWithRedirect", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const context = { - request: "/me", - options: { - method: "GET", - }, - }; - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - const handler = new RedirectHandler(); - handler.setNext(dummyHTTPHandler); - it("Should not redirect for the redirect count equal to maxRedirects", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const maxRedirect = 1; - const options = new RedirectHandlerOptions(maxRedirect); - dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRedirect"](context, maxRedirect, options); - assert.equal(context.response.status, 301); - })); - it("Should not redirect for the non redirect response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - dummyHTTPHandler.setResponses([new Response("", { status: 200 })]); - yield handler["executeWithRedirect"](context, 0, options); - assert.equal(context.response.status, 200); - })); - it("Should not redirect for the redirect response without location header", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRedirect"](context, 0, options); - assert.equal(context.response.status, 301); - })); - it("Should not redirect for shouldRedirect callback returning false", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(undefined, () => false); - dummyHTTPHandler.setResponses([new Response("", { status: 301 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRedirect"](context, 0, options); - assert.equal(context.response.status, 301); - })); - it("Should drop body and change method to get for SEE_OTHER status code", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - const cxt = { - request: "/me", - options: { - method: "POST", - body: "dummy body", - }, - }; - dummyHTTPHandler.setResponses([ - new Response("", { - status: 303, - headers: { - [RedirectHandler["LOCATION_HEADER"]]: "/location", - }, - }), - new Response("ok", { status: 200 }), - ]); - yield handler["executeWithRedirect"](context, 0, options); - assert.isUndefined(context.options.body); - assert.equal(context.options.method, "GET"); - assert.equal(context.response.status, 200); - })); - it("Should not drop Authorization header for relative url redirect", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - const cxt = { - request: "/me", - options: { - method: "POST", - body: "dummy body", - headers: { - [RedirectHandler["AUTHORIZATION_HEADER"]]: "Bearer TEST", - }, - }, - }; - dummyHTTPHandler.setResponses([ - new Response("", { - status: 301, - headers: { - [RedirectHandler["LOCATION_HEADER"]]: "/location", - }, - }), - new Response("ok", { status: 200 }), - ]); - yield handler["executeWithRedirect"](cxt, 0, options); - assert.isDefined(cxt.options.headers[RedirectHandler["AUTHORIZATION_HEADER"]]); - assert.equal(cxt.response.status, 200); - })); - it("Should not drop Authorization header for same authority redirect url", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "POST", - body: "dummy body", - headers: { - [RedirectHandler["AUTHORIZATION_HEADER"]]: "Bearer TEST", - }, - }, - }; - dummyHTTPHandler.setResponses([ - new Response("", { - status: 301, - headers: { - [RedirectHandler["LOCATION_HEADER"]]: "https://graph.microsoft.com/v2.0/me", - }, - }), - new Response("ok", { status: 200 }), - ]); - yield handler["executeWithRedirect"](cxt, 0, options); - assert.isDefined(cxt.options.headers[RedirectHandler["AUTHORIZATION_HEADER"]]); - assert.equal(cxt.response.status, 200); - })); - it("Should return success response after successful redirect", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RedirectHandlerOptions(); - const cxt = { - request: "https://graph.microsoft.com/v1.0/me", - options: { - method: "POST", - body: "dummy body", - }, - }; - dummyHTTPHandler.setResponses([ - new Response(null, { - status: 301, - headers: { - [RedirectHandler["LOCATION_HEADER"]]: "https://graphredirect.microsoft.com/v1.0/me", - }, - }), - new Response("ok", { status: 200 }), - ]); - yield handler["executeWithRedirect"](cxt, 0, options); - assert.equal(cxt.response.status, 200); - })); - })); - describe("execute", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - it("Should set the redirect value in options to manual", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const context = { - request: "/me", - options: { - method: "GET", - }, - }; - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - const handler = new RedirectHandler(); - handler.setNext(dummyHTTPHandler); - dummyHTTPHandler.setResponses([new Response("", { status: 200 })]); - yield handler.execute(context); - assert.equal(context.options.redirect, RedirectHandler["MANUAL_REDIRECT"]); - })); - })); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=RedirectHandler.js.map diff --git a/test/dist/es/test/common/middleware/RedirectHandler.js.map b/test/dist/es/test/common/middleware/RedirectHandler.js.map deleted file mode 100644 index 4bc78ef8d..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RedirectHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/RedirectHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,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AM,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;YACtD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,SAAS,EAAE,GAAS,EAAE;QAC9B,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;YACnE,MAAM,OAAO,GAAY;gBACxB,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE;oBACR,MAAM,EAAE,KAAK;iBACb;aACD,CAAC;YACF,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACvD,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;YACtC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAClC,gBAAgB,CAAC,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACnE,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts b/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandlerOptions.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js deleted file mode 100644 index 322c76c45..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { RedirectHandlerOptions } from "../../../src/middleware/options/RedirectHandlerOptions"; -describe("RedirectHandlerOptions.ts", () => { - describe("constructor", () => { - it("Should initialize the instance with given options", () => { - const shouldRedirect = (response) => { - if (response.status === 301) { - return true; - } - return false; - }; - const maxRedirects = 5; - const options = new RedirectHandlerOptions(maxRedirects, shouldRedirect); - assert.equal(options.maxRedirects, maxRedirects); - assert.equal(options.shouldRedirect, shouldRedirect); - }); - it("Should throw error for setting max redirects more than allowed", () => { - try { - const options = new RedirectHandlerOptions(100); - throw new Error("Something wrong with the max redirects value redirection"); - } catch (error) { - assert.equal(error.name, "MaxLimitExceeded"); - } - }); - it("Should throw error for setting max redirects to negative", () => { - try { - const options = new RedirectHandlerOptions(-10); - throw new Error("Something wrong with the max redirects value redirection"); - } catch (error) { - assert.equal(error.name, "MinExpectationNotMet"); - } - }); - /* tslint:disable: no-string-literal */ - it("Should initialize instance with default options", () => { - const options = new RedirectHandlerOptions(); - assert.equal(options.maxRedirects, RedirectHandlerOptions["DEFAULT_MAX_REDIRECTS"]); - assert.equal(options.shouldRedirect, RedirectHandlerOptions["DEFAULT_SHOULD_RETRY"]); - }); - /* tslint:enable: no-string-literal */ - }); -}); -//# sourceMappingURL=RedirectHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map b/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map deleted file mode 100644 index f8ac5444e..000000000 --- a/test/dist/es/test/common/middleware/RedirectHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RedirectHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/RedirectHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAEhG,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC1C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC5D,MAAM,cAAc,GAAG,CAAC,QAAkB,EAAE,EAAE;gBAC7C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;oBAC5B,OAAO,IAAI,CAAC;iBACZ;gBACD,OAAO,KAAK,CAAC;YACd,CAAC,CAAC;YACF,MAAM,YAAY,GAAG,CAAC,CAAC;YACvB,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;YACzE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YACjD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;YACzE,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,GAAG,CAAC,CAAC;gBAChD,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;aAC5E;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;aAC7C;QACF,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YACnE,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC;gBAChD,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;aAC5E;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;aACjD;QACF,CAAC,CAAC,CAAC;QAEH,uCAAuC;QACvC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YAC1D,MAAM,OAAO,GAAG,IAAI,sBAAsB,EAAE,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,CAAC,CAAC;YACpF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAC,CAAC;QACtF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RetryHandler.d.ts b/test/dist/es/test/common/middleware/RetryHandler.d.ts deleted file mode 100644 index ac7981909..000000000 --- a/test/dist/es/test/common/middleware/RetryHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; diff --git a/test/dist/es/test/common/middleware/RetryHandler.js b/test/dist/es/test/common/middleware/RetryHandler.js deleted file mode 100644 index ef889693d..000000000 --- a/test/dist/es/test/common/middleware/RetryHandler.js +++ /dev/null @@ -1,221 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import "isomorphic-fetch"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { RetryHandlerOptions } from "../../../src/middleware/options/RetryHandlerOptions"; -import { RetryHandler } from "../../../src/middleware/RetryHandler"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -describe("RetryHandler.ts", function() { - this.timeout(20 * 1000); - const retryHandler = new RetryHandler(); - const retryHandlerOptions = new RetryHandlerOptions(); - const tooManyRequestsResponseWithRetryAfterDelay = new Response("", { - status: 429, - statusText: "TooManyRequests", - headers: { - "Retry-After": "10", - }, - }); - const tooManyRequestsResponseWithRetyAfterDate = new Response("", { - status: 429, - statusText: "TooManyRequests", - headers: { - "Retry-After": new Date(Date.now() + 10000).toUTCString(), - }, - }); - const serviceUnavailableResponse = new Response("", { - status: 503, - statusText: "ServiceUnavailable", - }); - const gatewayTimeoutResponse = new Response("", { - status: 504, - statusText: "GatewayTimeout", - }); - const nonRetryResponse = new Response("", { - status: 200, - statusText: "OK", - }); - /* tslint:disable: no-string-literal */ - describe("constructor", () => { - it("Should set the option member with retryHanderOptions", () => { - const handler = new RetryHandler(retryHandlerOptions); - assert.isDefined(handler["options"]); - }); - it("Should create retryHandler instance with default retryHandlerOptions", () => { - const handler = new RetryHandler(); - assert.isDefined(handler["options"]); - }); - }); - describe("isRetry", () => { - it("Should return true for 429 response", () => { - assert.isTrue(retryHandler["isRetry"](tooManyRequestsResponseWithRetryAfterDelay)); - }); - it("Should return true for 503 response", () => { - assert.isTrue(retryHandler["isRetry"](serviceUnavailableResponse)); - }); - it("Should return true for 504 response", () => { - assert.isTrue(retryHandler["isRetry"](gatewayTimeoutResponse)); - }); - it("Should return false for non retry response", () => { - assert.isFalse(retryHandler["isRetry"](nonRetryResponse)); - }); - }); - describe("isBuffered", () => { - const url = "dummy_url"; - it("Should succeed for non post, patch, put requests", () => { - const options = { - method: "GET", - }; - assert.isTrue(retryHandler["isBuffered"](url, options)); - }); - it("Should succeed for post request with non stream request", () => { - const options = { - method: "POST", - body: "test", - }; - assert.isTrue(retryHandler["isBuffered"](url, options)); - }); - it("Should fail for stream request", () => { - const options = { - method: "PUT", - headers: { - "Content-Type": "application/octet-stream", - }, - }; - assert.isFalse(retryHandler["isBuffered"](url, options)); - }); - }); - describe("getDelay", () => { - it("Should return retry delay from the response header", () => { - const delay = retryHandler["getDelay"](tooManyRequestsResponseWithRetryAfterDelay, 1, 5); - assert.equal(delay, 10); - }); - it("Should return retry delay from the response header mentioning delay time", () => { - const delay = retryHandler["getDelay"](tooManyRequestsResponseWithRetyAfterDate, 1, 5); - assert.isDefined(delay); - }); - it("Should return delay without exponential backoff", () => { - const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 1, 10); - assert.isAbove(delay, 10); - assert.isBelow(delay, 11); - }); - it("Should return delay with exponential backoff", () => { - const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 2, 10); - assert.isAbove(delay, 12); - assert.isBelow(delay, 13); - }); - it("Should return max delay for if the calculated delay is more", () => { - const delay = retryHandler["getDelay"](gatewayTimeoutResponse, 10, 100); - assert.isAbove(delay, 180); - assert.isBelow(delay, 181); - }); - }); - describe("getExponentialBackOffTime", () => { - it("Should return 0 delay for 0th attempt i.e for a fresh request", () => { - const time = retryHandler["getExponentialBackOffTime"](0); - assert.equal(time, 0); - }); - it("Should return attempt time", () => { - const time = retryHandler["getExponentialBackOffTime"](1); - assert.equal(time, 1); - }); - }); - describe("sleep", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - it("Should run the sleep method for 1 second", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - yield retryHandler["sleep"](1); - } catch (error) { - throw error; - } - })); - })); - describe("getOptions", () => { - it("Should return the options in the context object", () => { - const delay = 10; - const maxRetries = 8; - const shouldRetry = () => false; - const options = new RetryHandlerOptions(delay, maxRetries, shouldRetry); - const cxt = { - request: "url", - middlewareControl: new MiddlewareControl([options]), - }; - const o = retryHandler["getOptions"](cxt); - assert.equal(o.delay, delay); - assert.equal(o.maxRetries, maxRetries); - assert.equal(o.shouldRetry, shouldRetry); - }); - it("Should return the default set of options in the middleware", () => { - const cxt = { - request: "url", - }; - const o = retryHandler["getOptions"](cxt); - assert.equal(o.delay, retryHandler["options"].delay); - assert.equal(o.maxRetries, retryHandler["options"].maxRetries); - assert.equal(o.shouldRetry, retryHandler["options"].shouldRetry); - }); - }); - describe("executeWithRetry", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const options = new RetryHandlerOptions(); - const handler = new RetryHandler(options); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - handler.setNext(dummyHTTPHandler); - const cxt = { - request: "url", - options: { - method: "GET", - }, - }; - it("Should return non retried response incase of maxRetries busted out", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRetry"](cxt, RetryHandlerOptions["MAX_MAX_RETRIES"], options); - assert.equal(cxt.response.status, 429); - })); - it("Should return succeeded response for non retry response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - dummyHTTPHandler.setResponses([new Response("ok", { status: 200 })]); - yield handler["executeWithRetry"](cxt, 0, options); - assert.equal(cxt.response.status, 200); - })); - it("Should return non retried response for streaming request", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const c = { - request: "url", - options: { - method: "POST", - headers: { - "Content-Type": "application/octet-stream", - }, - }, - }; - dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRetry"](c, 0, options); - assert.equal(c.response.status, 429); - })); - it("Should successfully retry and return ok response", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const opts = new RetryHandlerOptions(1); - dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRetry"](cxt, 0, options); - assert.equal(cxt.response.status, 200); - })); - it("Should fail by exceeding max retries", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const opts = new RetryHandlerOptions(1, 2); - dummyHTTPHandler.setResponses([new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response(null, { status: 429 }), new Response("ok", { status: 200 })]); - yield handler["executeWithRetry"](cxt, 0, opts); - assert.equal(cxt.response.status, 429); - })); - })); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=RetryHandler.js.map diff --git a/test/dist/es/test/common/middleware/RetryHandler.js.map b/test/dist/es/test/common/middleware/RetryHandler.js.map deleted file mode 100644 index 03780a671..000000000 --- a/test/dist/es/test/common/middleware/RetryHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RetryHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/RetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAe,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,iBAAiB,EAAE;IAC3B,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACxB,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IACxC,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,MAAM,0CAA0C,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;QACnE,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,iBAAiB;QAC7B,OAAO,EAAE;YACR,aAAa,EAAE,IAAI;SACnB;KACD,CAAC,CAAC;IACH,MAAM,wCAAwC,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;QACjE,MAAM,EAAE,GAAG;QACX,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AAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACpL,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts b/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/RetryHandlerOptions.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.js b/test/dist/es/test/common/middleware/RetryHandlerOptions.js deleted file mode 100644 index d5a59d8c6..000000000 --- a/test/dist/es/test/common/middleware/RetryHandlerOptions.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { RetryHandlerOptions } from "../../../src/middleware/options/RetryHandlerOptions"; -describe("RetryHandlerOptions.ts", () => { - /* tslint:disable: no-string-literal */ - describe("Constructor", () => { - it("Should use default values if not given", () => { - try { - const options = new RetryHandlerOptions(); - assert.equal(options["delay"], RetryHandlerOptions["DEFAULT_DELAY"]); - assert.equal(options["maxRetries"], RetryHandlerOptions["DEFAULT_MAX_RETRIES"]); - assert.equal(options["shouldRetry"], RetryHandlerOptions["DEFAULT_SHOULD_RETRY"]); - } catch (error) { - throw error; - } - }); - it("Should throw error for both delay and maxRetries are higher than the limit", () => { - try { - const options = new RetryHandlerOptions(1000, 1000); - throw new Error("Something wrong with the delay and maxRetries max limit validation"); - } catch (error) { - assert.equal(error.name, "MaxLimitExceeded"); - } - }); - it("Should throw error for delay is higher than the limit", () => { - try { - const options = new RetryHandlerOptions(1000, 2); - throw new Error("Something wrong with the delay max limit validation"); - } catch (error) { - assert.equal(error.name, "MaxLimitExceeded"); - } - }); - it("Should throw error for maxRetries is higher than the limit", () => { - try { - const options = new RetryHandlerOptions(1, 2000); - throw new Error("Something wrong with the maxRetries max limit validation"); - } catch (error) { - assert.equal(error.name, "MaxLimitExceeded"); - } - }); - it("Should throw error for both delay and maxRetries are negative", () => { - try { - const options = new RetryHandlerOptions(-1, -100); - throw new Error("Something wrong with the delay and maxRetries max limit validation"); - } catch (error) { - assert.equal(error.name, "MinExpectationNotMet"); - } - }); - it("Should throw error for delay is negative", () => { - try { - const options = new RetryHandlerOptions(-5, 2); - throw new Error("Something wrong with the delay max limit validation"); - } catch (error) { - assert.equal(error.name, "MinExpectationNotMet"); - } - }); - it("Should throw error for maxRetries is negative", () => { - try { - const options = new RetryHandlerOptions(1, -10); - throw new Error("Something wrong with the maxRetries max limit validation"); - } catch (error) { - assert.equal(error.name, "MinExpectationNotMet"); - } - }); - it("Should accept all the given values", () => { - try { - const delay = 1; - const maxRetries = 3; - const shouldRetry = (d, a, req, o, res) => { - return false; - }; - const options = new RetryHandlerOptions(delay, maxRetries, shouldRetry); - assert.equal(options.delay, delay); - assert.equal(options.maxRetries, maxRetries); - assert.equal(options.shouldRetry, shouldRetry); - } catch (error) { - throw error; - } - }); - }); - describe("getMaxDelay", () => { - it("Should return the max delay value", () => { - const options = new RetryHandlerOptions(); - assert.equal(options.getMaxDelay(), RetryHandlerOptions["MAX_DELAY"]); - }); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=RetryHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map b/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map deleted file mode 100644 index 93fa877e3..000000000 --- a/test/dist/es/test/common/middleware/RetryHandlerOptions.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RetryHandlerOptions.js","sourceRoot":"","sources":["../../../../../common/middleware/RetryHandlerOptions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAe,MAAM,qDAAqD,CAAC;AAEvG,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YACjD,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;gBACrE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAAC;gBAChF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CAAC;aAClF;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;YACrF,IAAI;gBACH,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE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F,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC5C,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.d.ts b/test/dist/es/test/common/middleware/TelemetryHandler.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandler.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.js b/test/dist/es/test/common/middleware/TelemetryHandler.js deleted file mode 100644 index 88ff009f3..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandler.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; -import { TelemetryHandler } from "../../../src/middleware/TelemetryHandler"; -import { PACKAGE_VERSION } from "../../../src/Version"; -import { DummyHTTPMessageHandler } from "../DummyHTTPMessageHandler"; -describe("TelemetryHandler.ts", () => { - /* tslint:disable: no-string-literal */ - describe("execute", function() { - this.timeout(20 * 1000); - const telemetryHandler = new TelemetryHandler(); - const dummyHTTPHandler = new DummyHTTPMessageHandler(); - telemetryHandler.setNext(dummyHTTPHandler); - const okayResponse = new Response("", { - status: 200, - statusText: "OK", - }); - it("Should not disturb client-request-id in the header", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const uuid = "dummy_uuid"; - const context = { - request: "url", - options: { - headers: { - "client-request-id": uuid, - }, - }, - }; - dummyHTTPHandler.setResponses([okayResponse]); - yield telemetryHandler.execute(context); - assert.equal(context.options.headers["client-request-id"], uuid); - } catch (error) { - throw error; - } - })); - it("Should create client-request-id if one is not present in the request header", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const context = { - request: "url", - options: { - headers: { - method: "GET", - }, - }, - }; - dummyHTTPHandler.setResponses([okayResponse]); - yield telemetryHandler.execute(context); - assert.isDefined(context.options.headers["client-request-id"]); - } catch (error) { - throw error; - } - })); - it("Should set sdk version header without feature flag usage if telemetry options is not present", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const context = { - request: "url", - options: { - headers: { - method: "GET", - }, - }, - }; - dummyHTTPHandler.setResponses([okayResponse]); - yield telemetryHandler.execute(context); - assert.equal(context.options.headers["SdkVersion"], `graph-js/${PACKAGE_VERSION}`); - } catch (error) { - throw error; - } - })); - it("Should set sdk version header with feature flag", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - try { - const telemetryOptions = new TelemetryHandlerOptions(); - telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - const context = { - request: "url", - options: { - headers: { - method: "GET", - }, - }, - middlewareControl: new MiddlewareControl([telemetryOptions]), - }; - dummyHTTPHandler.setResponses([okayResponse]); - yield telemetryHandler.execute(context); - assert.equal(context.options.headers["SdkVersion"], `graph-js/${PACKAGE_VERSION} (featureUsage=${FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED.toString(16)})`); - } catch (error) { - throw error; - } - })); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=TelemetryHandler.js.map diff --git a/test/dist/es/test/common/middleware/TelemetryHandler.js.map b/test/dist/es/test/common/middleware/TelemetryHandler.js.map deleted file mode 100644 index a3f763407..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandler.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"TelemetryHandler.js","sourceRoot":"","sources":["../../../../../common/middleware/TelemetryHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AACpH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE;QACnB,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QACxB,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAChD,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;QACvD,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC3C,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,EAAE,EAAE;YACrC,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;YACnE,IAAI;gBACH,MAAM,IAAI,GAAG,YAAY,CAAC;gBAC1B,MAAM,OAAO,GAAY;oBACxB,OAAO,E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MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,YAAY,eAAe,EAAE,CAAC,CAAC;aACnF;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAS,EAAE;YAChE,IAAI;gBACH,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;gBACvD,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACrF,MAAM,OAAO,GAAY;oBACxB,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE;wBACR,OAAO,EAAE;4BACR,MAAM,EAAE,KAAK;yBACb;qBACD;oBACD,iBAAiB,EAAE,IAAI,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAC;iBAC5D,CAAC;gBACF,gBAAgB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9C,MAAM,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,YAAY,eAAe,kBAAkB,gBAAgB,CAAC,8BAA8B,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;aAClK;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js deleted file mode 100644 index 36d04deeb..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { MiddlewareControl } from "../../../src/middleware/MiddlewareControl"; -import { FeatureUsageFlag, TelemetryHandlerOptions } from "../../../src/middleware/options/TelemetryHandlerOptions"; -describe("TelemetryHandlerOptions.ts", () => { - /* tslint:disable: no-string-literal no-bitwise */ - describe("constructor", () => { - it("Should initialize the feature usage flag with NONE flag", () => { - const telemetryOptions = new TelemetryHandlerOptions(); - assert.equal(telemetryOptions["featureUsage"], FeatureUsageFlag.NONE); - }); - }); - describe("updateFeatureUsageFlag", () => { - it("Should update feature usage flag for middleware control without telemetry handler option", () => { - const context = { - request: "url", - middlewareControl: new MiddlewareControl(), - }; - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); - assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - }); - it("Should update feature usage flag for middleware control with telemetry handler option", () => { - const context = { - request: "url", - middlewareControl: new MiddlewareControl([new TelemetryHandlerOptions()]), - }; - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); - assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - }); - it("Should update feature usage flag for context object without middleware control object", () => { - const context = { - request: "url", - }; - TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - const options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions); - assert.equal(options["featureUsage"], FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - }); - }); - describe("setFeatureUsage", () => { - it("Should set a given flags", () => { - const telemetryOptions = new TelemetryHandlerOptions(); - telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - telemetryOptions["setFeatureUsage"](FeatureUsageFlag.RETRY_HANDLER_ENABLED); - assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.RETRY_HANDLER_ENABLED, FeatureUsageFlag.RETRY_HANDLER_ENABLED); - assert.equal(telemetryOptions["featureUsage"] & FeatureUsageFlag.REDIRECT_HANDLER_ENABLED, FeatureUsageFlag.NONE); - }); - }); - describe("getFeatureUsage", () => { - it("Should return the feature usage in hexadecimal string", () => { - const telemetryOptions = new TelemetryHandlerOptions(); - telemetryOptions["setFeatureUsage"](FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED); - telemetryOptions["setFeatureUsage"](FeatureUsageFlag.RETRY_HANDLER_ENABLED); - const usageFlag = telemetryOptions.getFeatureUsage(); - assert.equal(usageFlag, "6"); - }); - }); - /* tslint:enable: no-string-literal no-bitwise*/ -}); -//# sourceMappingURL=TelemetryHandlerOptions.js.map diff --git a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map b/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map deleted file mode 100644 index 790a61a04..000000000 --- a/test/dist/es/test/common/middleware/TelemetryHandlerOptions.js.map +++ /dev/null @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K,CAAC,gBAAgB,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YAChI,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACnH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAChE,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,EAAE,CAAC;YACvD,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;YACrF,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YAC5E,MAAM,SAAS,GAAG,gBAAgB,CAAC,eAAe,EAAE,CAAC;YACrD,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,gDAAgD;AACjD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts b/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/tasks/LargeFileUploadTask.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.js b/test/dist/es/test/common/tasks/LargeFileUploadTask.js deleted file mode 100644 index 6be6f5277..000000000 --- a/test/dist/es/test/common/tasks/LargeFileUploadTask.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { LargeFileUploadTask } from "../../../src/tasks/LargeFileUploadTask"; -import { getClient } from "../test-helper"; -describe("LargeFileUploadTask.ts", () => { - /* tslint:disable: no-string-literal */ - describe("Parsing Range", () => { - const name = "sample_image.jpg"; - const arrayBuffer = new ArrayBuffer(80000); - const size = 100000; - const fileObj = { - content: arrayBuffer, - name, - size, - }; - const uploadSession = { - url: "test url", - expiry: new Date(), - }; - const options = {}; - const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); - it("Should return default range for given undefined range", (done) => { - const range = uploadTask["parseRange"]([]); - assert.equal(range.minValue, -1); - assert.equal(range.maxValue, -1); - done(); - }); - it("Should return default range for given empty range", (done) => { - const range = uploadTask["parseRange"]([""]); - assert.equal(range.minValue, -1); - assert.equal(range.maxValue, -1); - done(); - }); - it("Should return valid range for given range with from and to values", (done) => { - const range = uploadTask["parseRange"](["100-200"]); - assert.equal(range.minValue, 100); - assert.equal(range.maxValue, 200); - done(); - }); - it("Should return valid range for given range without to value", (done) => { - const range = uploadTask["parseRange"](["0-"]); - assert.equal(range.minValue, 0); - assert.equal(range.maxValue, 99999); - done(); - }); - }); - describe("Update Task Status", () => { - const name = "sample_image.jpg"; - const arrayBuffer = new ArrayBuffer(80000); - const size = 100000; - const fileObj = { - content: arrayBuffer, - name, - size, - }; - const uploadSession = { - url: "test url", - expiry: new Date(), - }; - const options = {}; - const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); - it("Should update status with expiration date and next expected ranges as given", (done) => { - const statusResponse = { - expirationDateTime: "2018-08-06T09:05:45.195Z", - nextExpectedRanges: ["100-2000"], - }; - uploadTask["updateTaskStatus"](statusResponse); - assert.equal(uploadTask["nextRange"].minValue, 100); - assert.equal(uploadTask["nextRange"].maxValue, 2000); - done(); - }); - it("Should update status with given expiration date and (fileSize - 1) for next expected range maxValue", (done) => { - const statusResponse = { - expirationDateTime: "2018-08-06T09:05:45.195Z", - nextExpectedRanges: ["100-"], - }; - uploadTask["updateTaskStatus"](statusResponse); - assert.equal(uploadTask["nextRange"].minValue, 100); - assert.equal(uploadTask["nextRange"].maxValue, 99999); - done(); - }); - }); - describe("GetNextRange", () => { - const name = "sample_image.jpg"; - const arrayBuffer = new ArrayBuffer(80000); - const size = 328680; - const fileObj = { - content: arrayBuffer, - name, - size, - }; - const uploadSession = { - url: "test url", - expiry: new Date(), - }; - const options = { - rangeSize: 327680, - }; - const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); - it("Should return proper next range well within the file size", (done) => { - const nextRange = uploadTask.getNextRange(); - assert.equal(nextRange.minValue, 0); - assert.equal(nextRange.maxValue, 327679); - done(); - }); - it("Should return next range maxValue equal to the file size", (done) => { - const statusResponse = { - expirationDateTime: "2018-08-06T09:05:45.195Z", - nextExpectedRanges: ["327680-"], - }; - uploadTask["updateTaskStatus"](statusResponse); - const nextRange = uploadTask.getNextRange(); - assert.equal(nextRange.minValue, 327680); - assert.equal(nextRange.maxValue, 328679); - done(); - }); - it("Should return next range as default(empty) range, this is for the upload task completed", (done) => { - const statusResponse = { - expirationDateTime: "2018-08-06T09:05:45.195Z", - nextExpectedRanges: [], - }; - uploadTask["updateTaskStatus"](statusResponse); - const nextRange = uploadTask.getNextRange(); - assert.equal(nextRange.minValue, -1); - assert.equal(nextRange.maxValue, -1); - done(); - }); - }); - describe("Upload File", () => { - const name = "sample_image.jpg"; - const arrayBuffer = new ArrayBuffer(80000); - const size = 328680; - const fileObj = { - content: arrayBuffer, - name, - size, - }; - const uploadSession = { - url: "test url", - expiry: new Date(), - }; - const options = { - rangeSize: 327680, - }; - const uploadTask = new LargeFileUploadTask(getClient(), fileObj, uploadSession, options); - it("Should return an exception while trying to upload the file upload completed task", (done) => { - const statusResponse = { - expirationDateTime: "2018-08-06T09:05:45.195Z", - nextExpectedRanges: [], - }; - uploadTask["updateTaskStatus"](statusResponse); - uploadTask - .upload() - .then((res) => { - throw new Error("Upload is working for upload completed task"); - }) - .catch((err) => { - assert.equal(err.name, "Invalid Session"); - assert.equal(err.message, "Task with which you are trying to upload is already completed, Please check for your uploaded file"); - done(); - }); - }); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=LargeFileUploadTask.js.map diff --git a/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map b/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map deleted file mode 100644 index cb89b2ac1..000000000 --- a/test/dist/es/test/common/tasks/LargeFileUploadTask.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../common/tasks/LargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,uCAAuC;IACvC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAChC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,CAAC;QACpB,MAAM,OAAO,GAAG;YACf,OAAO,EAAE,WAAW;YACpB,IAAI;YACJ,IAAI;SACJ,CAAC;QACF,MAAM,aAAa,GAAG;YACrB,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,IAAI,IAAI,EAAE;SAClB,CAAC;QACF,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAAC,SAAS,EAAE,EAAE,OAAO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E,UAAU;YACf,MAAM,EAAE,IAAI,IAAI,EAAE;SAClB,CAAC;QACF,MAAM,OAAO,GAAG;YACf,SAAS,EAAE,MAAM;SACjB,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;QACzF,EAAE,CAAC,kFAAkF,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/F,MAAM,cAAc,GAAG;gBACtB,kBAAkB,EAAE,0BAA0B;gBAC9C,kBAAkB,EAAE,EAAE;aACtB,CAAC;YACF,UAAU,CAAC,kBAAkB,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/C,UAAU;iBACR,MAAM,EAAE;iBACR,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAChE,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,oGAAoG,CAAC,CAAC;gBAChI,IAAI,EAAE,CAAC;YACR,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js deleted file mode 100644 index ace71a6ed..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { OneDriveLargeFileUploadTask } from "../../../src/tasks/OneDriveLargeFileUploadTask"; -describe("OneDriveLargeFileUploadTask.ts", () => { - describe("constructCreateSessionUrl", () => { - const spaceFileName = " test.png "; - const fileName = "test.png"; - const specialFileName = "test file.png"; - const encodedFileName = "test%20file.png"; - /* tslint:disable: no-string-literal */ - it("Should trim the extra spaces in the filename", () => { - assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](spaceFileName)); - }); - it("Should encode space in the filename", () => { - assert.equal(`/me/drive/root:/${encodedFileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](specialFileName)); - }); - it("Should return url with default root value", () => { - assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName)); - }); - it("Should return url with default root value for an empty path string", () => { - assert.equal(`/me/drive/root:/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "")); - }); - it("Should add / in front of the path", () => { - assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "Documents/")); - }); - it("Should add / in back of the path", () => { - assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, "/Documents")); - }); - it("Should trim the extra spaces in the path", () => { - assert.equal(`/me/drive/root:/Documents/${fileName}:/createUploadSession`, OneDriveLargeFileUploadTask["constructCreateSessionUrl"](fileName, " /Documents/ ")); - }); - /* tslint:enable: no-string-literal */ - }); -}); -//# sourceMappingURL=OneDriveLargeFileUploadTask.js.map diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map deleted file mode 100644 index cd3af19d3..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTask.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"OneDriveLargeFileUploadTask.js","sourceRoot":"","sources":["../../../../../common/tasks/OneDriveLargeFileUploadTask.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAE7F,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC/C,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,MAAM,aAAa,GAAG,YAAY,CAAC;QACnC,MAAM,QAAQ,GAAG,UAAU,CAAC;QAC5B,MAAM,eAAe,GAAG,eAAe,CAAC;QACxC,MAAM,eAAe,GAAG,iBAAiB,CAAC;QAE1C,uCAAuC;QACvC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAC3I,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,KAAK,CAAC,mBAAmB,eAAe,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC;QACpJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACpD,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtI,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;YAC7E,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1I,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC5C,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9J,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC3C,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9J,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YACnD,MAAM,CAAC,KAAK,CAAC,6BAA6B,QAAQ,uBAAuB,EAAE,2BAA2B,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;QACjK,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js deleted file mode 100644 index 4a7e1ccb0..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import * as OneDriveLargeFileUploadTaskUtil from "../../../src/tasks/OneDriveLargeFileUploadTaskUtil"; -describe("OneDriveLargeFileUploadTaskUtil", () => { - describe("getValidRangeSize", () => { - it("Should return size in multiple of 320KB for the size not a multiple of 320KB", (done) => { - assert.equal(327680, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(327685)); - done(); - }); - it("Should return same size for the size less than 320 KB", (done) => { - assert.equal(100, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(100)); - done(); - }); - it("Should return size in multiple of 320KB with max range of 60 MB for file size more than 60 MB", (done) => { - assert.equal(62914560, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(104857600)); - done(); - }); - it("Should return size in multiple of 320KB for the size multiple of 320 KB", (done) => { - assert.equal(1638400, OneDriveLargeFileUploadTaskUtil.getValidRangeSize(1638400)); - done(); - }); - }); -}); -//# sourceMappingURL=OneDriveLargeFileUploadTaskUtil.js.map diff --git a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map b/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map deleted file mode 100644 index 64dc5a433..000000000 --- a/test/dist/es/test/common/tasks/OneDriveLargeFileUploadTaskUtil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"OneDriveLargeFileUploadTaskUtil.js","sourceRoot":"","sources":["../../../../../common/tasks/OneDriveLargeFileUploadTaskUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,KAAK,+BAA+B,MAAM,oDAAoD,CAAC;AAEtG,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,8EAA8E,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3F,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;YAChF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uDAAuD,EAAE,CAAC,IAAI,EAAE,EAAE;YACpE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1E,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,+FAA+F,EAAE,CAAC,IAAI,EAAE,EAAE;YAC5G,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;YACrF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,yEAAyE,EAAE,CAAC,IAAI,EAAE,EAAE;YACtF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;YAClF,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/tasks/PageIterator.d.ts b/test/dist/es/test/common/tasks/PageIterator.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/common/tasks/PageIterator.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/common/tasks/PageIterator.js b/test/dist/es/test/common/tasks/PageIterator.js deleted file mode 100644 index ce9114e85..000000000 --- a/test/dist/es/test/common/tasks/PageIterator.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import { PageIterator } from "../../../src/tasks/PageIterator"; -import { getClient } from "../test-helper"; -const client = getClient(); -const value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; -const getPageCollection = () => { - return { - value: [...value], - additionalContent: "additional content", - }; -}; -const getPageCollectionWithNext = () => { - return { - value: [...value], - "@odata.nextLink": "nextURL", - additionalContent: "additional content", - }; -}; -const getEmptyPageCollection = () => { - return { - value: [], - }; -}; -const getEmptyPageCollectionWithNext = () => { - return { - value: [], - "@odata.nextLink": "nextURL", - }; -}; -const truthyCallback = (data) => { - return true; -}; -let halfWayCallbackCounter = 5; -const halfWayCallback = (data) => { - halfWayCallbackCounter--; - if (halfWayCallbackCounter === 0) { - return false; - } else { - return true; - } -}; -describe("PageIterator.ts", () => { - describe("Constructor", () => { - it("Should create instance without nextLink", () => { - const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); - assert(pageIterator instanceof PageIterator); - }); - it("Should create instance with nextLink", () => { - const pageIterator = new PageIterator(client, getPageCollectionWithNext(), truthyCallback); - assert(pageIterator instanceof PageIterator); - }); - }); - describe("iterate", () => { - it("Should iterate over a complete collection without nextLink", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); - try { - yield pageIterator.iterate(); - assert.isTrue(pageIterator.isComplete()); - } catch (error) { - throw error; - } - })); - it("Should not iterate over an empty collection", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getEmptyPageCollection(), truthyCallback); - halfWayCallbackCounter = 1; - try { - yield pageIterator.iterate(); - assert.equal(halfWayCallbackCounter, 1); - } catch (error) { - throw error; - } - })); - it("Should break in the middle way", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); - halfWayCallbackCounter = 5; - try { - yield pageIterator.iterate(); - assert.isFalse(pageIterator.isComplete()); - } catch (error) { - throw error; - } - })); - }); - /* tslint:disable: no-string-literal */ - describe("iterationHelper", () => { - it("Should return true for empty collection with next link", () => { - const pageIterator = new PageIterator(client, getEmptyPageCollectionWithNext(), truthyCallback); - try { - const advance = pageIterator["iterationHelper"](); - assert.isTrue(advance); - } catch (error) { - throw error; - } - }); - }); - describe("resume", () => { - it("Should start from the place where it left the iteration", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); - halfWayCallbackCounter = 5; - try { - yield pageIterator.iterate(); - assert.isFalse(pageIterator.isComplete()); - yield pageIterator.resume(); - assert.isTrue(pageIterator.isComplete()); - } catch (error) { - throw error; - } - })); - }); - describe("isComplete", () => { - it("Should return false for incomplete iteration", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getPageCollection(), halfWayCallback); - halfWayCallbackCounter = 5; - try { - yield pageIterator.iterate(); - assert.isFalse(pageIterator.isComplete()); - } catch (error) { - throw error; - } - })); - it("Should return true for complete iteration", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const pageIterator = new PageIterator(client, getPageCollection(), truthyCallback); - try { - yield pageIterator.iterate(); - assert.isTrue(pageIterator.isComplete()); - } catch (error) { - throw error; - } - })); - }); - /* tslint:enable: no-string-literal */ -}); -//# sourceMappingURL=PageIterator.js.map diff --git a/test/dist/es/test/common/tasks/PageIterator.js.map b/test/dist/es/test/common/tasks/PageIterator.js.map deleted file mode 100644 index 3788d26ae..000000000 --- a/test/dist/es/test/common/tasks/PageIterator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"PageIterator.js","sourceRoot":"","sources":["../../../../../common/tasks/PageIterator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAwB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,GAAW,SAAS,EAAE,CAAC;AAEnC,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAE9C,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,OAAO;QACN,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;QACjB,iBAAiB,EAAE,oBAAoB;KACvC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACtC,OAAO;QACN,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;QACjB,iBAAiB,EAAE,SAAS;QAC5B,iBAAiB,EAAE,oBAAoB;KACvC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACnC,OAAO;QACN,KAAK,EAAE,EAAE;KACT,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,GAAG,EAAE;IAC3C,OAAO;QACN,KAAK,EAAE,EAAE;QACT,iBAAiB,EAAE,SAAS;KAC5B,CAAC;AACH,CAA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AAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;aACzC;YAAC,OAAO,KAAK,EAAE;gBACf,MAAM,KAAK,CAAC;aACZ;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,sCAAsC;AACvC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/common/test-helper.d.ts b/test/dist/es/test/common/test-helper.d.ts deleted file mode 100644 index 386620072..000000000 --- a/test/dist/es/test/common/test-helper.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; -import { Client } from "../../src/index"; -export declare function getClient(): Client; -export declare function randomString(): string; diff --git a/test/dist/es/test/common/test-helper.js b/test/dist/es/test/common/test-helper.js deleted file mode 100644 index 9aef28974..000000000 --- a/test/dist/es/test/common/test-helper.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; -import { Client } from "../../src/index"; -import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; -export function getClient() { - return Client.initWithMiddleware({ - authProvider: new DummyAuthenticationProvider(), - }); -} -export function randomString() { - return Math.random() - .toString(36) - .substring(7); -} -//# sourceMappingURL=test-helper.js.map diff --git a/test/dist/es/test/common/test-helper.js.map b/test/dist/es/test/common/test-helper.js.map deleted file mode 100644 index b59cfca4a..000000000 --- a/test/dist/es/test/common/test-helper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../../common/test-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,UAAU,SAAS;IACxB,OAAO,MAAM,CAAC,kBAAkB,CAAC;QAChC,YAAY,EAAE,IAAI,2BAA2B,EAAE;KAC/C,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC3B,OAAO,IAAI,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,EAAE,CAAC;SACZ,SAAS,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/node/content/BatchRequestContent.d.ts b/test/dist/es/test/node/content/BatchRequestContent.d.ts deleted file mode 100644 index ac7981909..000000000 --- a/test/dist/es/test/node/content/BatchRequestContent.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; diff --git a/test/dist/es/test/node/content/BatchRequestContent.js b/test/dist/es/test/node/content/BatchRequestContent.js deleted file mode 100644 index 7eb34e72c..000000000 --- a/test/dist/es/test/node/content/BatchRequestContent.js +++ /dev/null @@ -1,601 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import * as tslib_1 from "tslib"; -import { assert } from "chai"; -import * as fs from "fs"; -import "isomorphic-fetch"; -import { BatchRequestContent } from "../../../src/content/BatchRequestContent"; -import { randomString } from "../../test-helper"; -const folderName = randomString(); -const folderDetails = { - name: folderName, - folder: {}, -}; -const createFolderRequest = new Request("/me/drive/root/children", { - method: "POST", - headers: { - "Content-type": "application/json", - }, - body: JSON.stringify(folderDetails), -}); -const getCreateFolderRequestCopy = () => { - return { - id: "1", - request: createFolderRequest, - }; -}; -const getCreateFolderRequestWithDependsOnCopy = () => { - const data = { - id: "1", - request: createFolderRequest, - dependsOn: undefined, - }; - data.dependsOn = []; - return data; -}; -describe("BatchRequestContent.ts", () => { - describe("Create", function() { - this.timeout(20 * 1000); - it("Should Create BatchRequestContent instance with no requests", (done) => { - const batchReq = new BatchRequestContent(); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - it("Should create BatchRequestContent instance with empty array", (done) => { - const batchReq = new BatchRequestContent([]); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - it("Should create BatchRequestContent instance with requests", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - const createFolderDuplicate2 = getCreateFolderRequestCopy(); - createFolderDuplicate2.id = "2"; - const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); - assert.equal(batchReq.requests.size, 2); - done(); - }); - it("Should throw error for empty request id", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - createFolderDuplicate1.id = ""; - try { - const batchReq = new BatchRequestContent([createFolderDuplicate1]); - throw new Error("Something wrong with the empty id check"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - } - done(); - }); - it("Should return error incase of number of requests limit exceeding", (done) => { - const requests = []; - for (let i = 0; i < 25; i++) { - const req = getCreateFolderRequestCopy(); - req.id = "" + i; - requests.push(req); - } - try { - const batchReq = new BatchRequestContent(requests); - throw new Error("Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - }); - describe("addRequest", function() { - this.timeout(20 * 1000); - it("Should emit size exceed error", (done) => { - const requests = []; - for (let i = 0; i < 20; i++) { - const r = getCreateFolderRequestCopy(); - r.id = "" + i; - requests.push(r); - } - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(requests); - try { - batchReq.addRequest(req); - throw new Error("Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - it("Should add Request JSON to the BatchRequestContent instance", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(); - const id = batchReq.addRequest(req); - assert.equal(req.id, id); - done(); - }); - it("Should throw duplicate id error", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addRequest(req2); - throw new Error("Something wrong with duplicate id validation"); - } catch (error) { - assert.equal(error.name, "Duplicate RequestId Error"); - done(); - } - }); - it("Should throw duplicate id error", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = ""; - const batchReq = new BatchRequestContent(); - try { - batchReq.addRequest(req); - throw new Error("Something wrong with empty id validation"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - done(); - } - }); - }); - describe("removeRequest", () => { - it("Should delete the request present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, batchReq.removeRequest(req.id)); - done(); - }); - it("Should return false for the request that is not present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(false, batchReq.removeRequest("1000")); - done(); - }); - it("Should remove dependencies in case dependencies present", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - const req4 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - batchReq.addDependency("2", "1"); - batchReq.addDependency("3", "2"); - batchReq.addDependency("4", "1"); - batchReq.addDependency("4", "2"); - batchReq.addDependency("4", "3"); - batchReq.removeRequest("2"); - assert.isUndefined(batchReq.requests.get("1").dependsOn); - assert.isUndefined(batchReq.requests.get("3").dependsOn); - assert.equal(batchReq.requests.get("4").dependsOn.length, 2); - done(); - }); - }); - describe("addDependency", function() { - this.timeout(20 * 1000); - it("Should return error for request with dependent id not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1"); - throw new Error("Dependent validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency Addition"); - done(); - } - }); - it("Should return error for the request with given dependency id is not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1", "100"); - throw new Error("Dependency validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency"); - done(); - } - }); - it("Should add dependency for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2", "1"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("2", "3"); - assert.equal(batchReq.requests.get("2").dependsOn.length, 2); - done(); - }); - it("Should return error for adding duplicate dependency", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2", "1"); - try { - batchReq.addDependency("2", "1"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - it("Should add dependency for dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("3"); - assert.isDefined(batchReq.requests.get("3").dependsOn); - done(); - }); - it("Should return error for adding duplicate dependency when dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - try { - batchReq.addDependency("2"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addDependency("1"); - } catch (e) { - assert.equal(e.name, "Invalid Dependency Addition"); - done(); - } - }); - }); - describe("getContent", () => { - it("Should return error for empty requests", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const batchReq = new BatchRequestContent(); - try { - const content = yield batchReq.getContent(); - throw new Error("Something wrong with the empty requests validation"); - } catch (error) { - assert.equal(error.name, "Empty Payload"); - } - })); - it("Should return json content", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - const content = yield batchReq.getContent(); - assert.isDefined(content.requests[0].body); - assert.equal(typeof content.requests[0].body, "object"); - } catch (error) { - throw error; - } - })); - it("Should return image's base64 string", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const fileName = "sample_image.jpg"; - fs.readFile(`./spec/sample_files/${fileName}`, {}, (err, file) => - tslib_1.__awaiter(this, void 0, void 0, function*() { - if (err) { - throw err; - } - const uploadOneDriveFile = { - id: "1", - request: new Request(`/me/drive/root:/Documents/${fileName}:/content`, { - method: "PUT", - headers: { - "Content-type": "image/jpg", - }, - body: file, - }), - }; - const batchReq = new BatchRequestContent([uploadOneDriveFile]); - try { - const content = yield batchReq.getContent(); - assert.isDefined(content.requests[0].body); - } catch (error) { - throw error; - } - }), - ); - })); - it("Should throw error for request does not have content-type header if it does have a body", () => - tslib_1.__awaiter(this, void 0, void 0, function*() { - const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { - method: "POST", - body: JSON.stringify(folderDetails), - }); - const batchReq = new BatchRequestContent([ - { - id: "1", - request: createFolderReqWithoutHeader, - }, - ]); - try { - const content = yield batchReq.getContent(); - throw new Error("Something wrong with the header checking"); - } catch (error) { - assert.equal(error.name, "Invalid Content-type header"); - } - })); - }); - describe("removeDependency", function() { - this.timeout(20 * 1000); - it("Should return false for dependent not present", (done) => { - const batchReq = new BatchRequestContent(); - assert.equal(false, batchReq.removeDependency("1")); - done(); - }); - it("Should return false for dependency array not present in the request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(false, batchReq.removeDependency("2")); - done(); - }); - it("Should return false for given dependency id is not present in the dependent request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(false, batchReq.removeDependency("2", "5")); - done(); - }); - it("Should delete the given dependency and dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(true, batchReq.removeDependency("2", "1")); - done(); - }); - it("Should delete all dependencies for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("3", "1"); - batchReq.addDependency("3", "2"); - assert.equal(true, batchReq.removeDependency("3")); - done(); - }); - }); - describe("validateDependencies", () => { - /* tslint:disable: no-string-literal */ - it("Should throw error for empty request object", (done) => { - try { - BatchRequestContent["validateDependencies"](new Map()); - throw new Error("Something wrong with the empty requests check"); - } catch (error) { - assert.equal(error.name, "Empty Requests Error"); - done(); - } - }); - it("isParallel - Should validate for single request", () => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for multiple requests", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for requests with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isParallel - Should validate for requests with empty dependsOn array", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for first request having dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = undefined; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for a request does not depend on anything", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for a request does not depend on previous request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["4"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should not validate for requests having more than one dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["2", "3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSerial - Should validate for proper serial dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for first request having dependency on itself", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["1"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for first request having dependency on non existing request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["10"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["10"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["10"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should validate for requests dependsOn some middle order request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request with empty dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["2"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - /* tslint:enable: no-string-literal */ - }); -}); -//# sourceMappingURL=BatchRequestContent.js.map diff --git a/test/dist/es/test/node/content/BatchRequestContent.js.map b/test/dist/es/test/node/content/BatchRequestContent.js.map deleted file mode 100644 index f85143eeb..000000000 --- a/test/dist/es/test/node/content/BatchRequestContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BatchRequestContent.js","sourceRoot":"","sources":["../../../../../node/content/BatchRequestContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAoB,MAAM,0CAA0C,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,GAAG,YAAY,EAAE,CAAC;AAClC,MAAM,aAAa,GAAG;IACrB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,OAAO,CAAC,yBAAyB,EAAE;IAClE,MAAM,EAAE,MAAM;IACd,OAAO,EAAE;QACR,cAAc,EAAE,kBAAkB;KAClC;IACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;CACnC,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,GAAG,EAAE;IACvC,OAAO;QACN,EAAE,EAAE,GAAG;QACP,OAAO,EAAE,mBAAmB;KAC5B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,uCAAuC,GAAG,GAAG,EAAE;IACpD,MAAM,IAAI,GAAG;QACZ,EAAE,EAAE,GAAG;QACP,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,SAAS;KACpB,CAAC;IACF,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACpB,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,QAAQ,CAAC,QAAQ,EAAE;QAClB,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CA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AAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uHAAuH,EAAE,GAAG,EAAE;YAChI,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,MAAM,IAAI,GAAG,uCAAuC,EAAE,CAAC;YACvD,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;YACd,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QACH,sCAAsC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/node/content/BatchResponseContent.d.ts b/test/dist/es/test/node/content/BatchResponseContent.d.ts deleted file mode 100644 index 6596c6394..000000000 --- a/test/dist/es/test/node/content/BatchResponseContent.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -export {}; diff --git a/test/dist/es/test/node/content/BatchResponseContent.js b/test/dist/es/test/node/content/BatchResponseContent.js deleted file mode 100644 index 78f9dc62f..000000000 --- a/test/dist/es/test/node/content/BatchResponseContent.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import { assert } from "chai"; -import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; -const redirect = { - id: "1", - status: 302, - headers: { - location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", - }, -}; -const forbidden = { - id: "3", - status: 401, - body: { - error: { - code: "Forbidden", - message: "...", - }, - }, -}; -const okWithBody = { - id: "2", - status: 200, - body: { - "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", - value: [], - }, -}; -const okWithoutBody = { - id: "4", - status: 204, - body: null, -}; -describe("BatchResponseContent.ts", () => { - describe("update", function() { - this.timeout(20 * 1000); - it("Should update instance with nextLink responses", (done) => { - const responses = [redirect, forbidden]; - const batchRes = new BatchResponseContent({ - responses, - "@odata.nextLink": "dummy nextlink", - }); - batchRes.update({ - responses: [okWithoutBody, okWithBody], - }); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - describe("createResponseObject", function() { - this.timeout(20 * 1000); - it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - assert.isDefined(batchRes.getResponseById("1")); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("3")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - describe("getResponseById", function() { - this.timeout(20 * 1000); - it("Should return response object for given id", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponseById("1")); - done(); - }); - it("Should return undefined for given id for which the response is not present", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isUndefined(batchRes.getResponseById("100")); - done(); - }); - }); - describe("getResponses", function() { - this.timeout(20 * 1000); - it("Should return responses map", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponses()); - done(); - }); - }); - describe("getResponsesIterator", function() { - this.timeout(20 * 1000); - it("Should return iterator", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - let count = 0; - const iterator = batchRes.getResponsesIterator(); - let data = iterator.next(); - while (!data.done) { - data = iterator.next(); - count++; - } - assert.equal(count, 4); - done(); - }); - }); -}); -//# sourceMappingURL=BatchResponseContent.js.map diff --git a/test/dist/es/test/node/content/BatchResponseContent.js.map b/test/dist/es/test/node/content/BatchResponseContent.js.map deleted file mode 100644 index cdeeabe03..000000000 --- a/test/dist/es/test/node/content/BatchResponseContent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"BatchResponseContent.js","sourceRoot":"","sources":["../../../../../node/content/BatchResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,QAAQ,GAAG;IAChB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,OAAO,EAAE;QACR,QAAQ,EAAE,uEAAuE;KACjF;CACD,CAAC;AACF,MAAM,SAAS,GAAG;IACjB,EAAE,EAAE,GAAG;IACP,MAAM,EAAE,GAAG;IACX,IAAI,EAAE;QACL,KAAK,EAAE;YACN,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,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AC,IAAI,EAAE,EAAE;YAC1C,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACzC,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB,CAAC,CAAC;YACH,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;QAExB,EAAE,CAAC,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;YACrC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC;gBACzC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC;aAC3D,CAAC,CAAC;YACH,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,QAAQ,GAAG,QAAQ,CAAC,oBAAoB,EAAE,CAAC;YACjD,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;gBAClB,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACvB,KAAK,EAAE,CAAC;aACR;YACD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,CAAC;QACR,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/dist/es/test/test-helper.d.ts b/test/dist/es/test/test-helper.d.ts deleted file mode 100644 index 060efc0a1..000000000 --- a/test/dist/es/test/test-helper.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; -import { Client } from "../src/index"; -export declare function getClient(): Client; -export declare function randomString(): string; diff --git a/test/dist/es/test/test-helper.js b/test/dist/es/test/test-helper.js deleted file mode 100644 index b1b7a6c35..000000000 --- a/test/dist/es/test/test-helper.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ -import "isomorphic-fetch"; -import { Client } from "../src/index"; -import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; -export function getClient() { - return Client.initWithMiddleware({ - authProvider: new DummyAuthenticationProvider(), - }); -} -export function randomString() { - return Math.random() - .toString(36) - .substring(7); -} -//# sourceMappingURL=test-helper.js.map diff --git a/test/dist/es/test/test-helper.js.map b/test/dist/es/test/test-helper.js.map deleted file mode 100644 index 7c40ce956..000000000 --- a/test/dist/es/test/test-helper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../test-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,UAAU,SAAS;IACxB,OAAO,MAAM,CAAC,kBAAkB,CAAC;QAChC,YAAY,EAAE,IAAI,2BAA2B,EAAE;KAC/C,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC3B,OAAO,IAAI,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,EAAE,CAAC;SACZ,SAAS,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/test/node/content/BatchRequestContent.ts b/test/node/content/BatchRequestContent.ts index ca090faf7..2bdd95fa8 100644 --- a/test/node/content/BatchRequestContent.ts +++ b/test/node/content/BatchRequestContent.ts @@ -72,7 +72,7 @@ describe("BatchRequestContent.ts", () => { createFolderDuplicate1.id = ""; try { const batchReq = new BatchRequestContent([createFolderDuplicate1]); - throw new Error("Something wrong with the empty id check"); + throw new Error(" Test Failed - Something wrong with the empty id check"); } catch (error) { assert.equal(error.name, "Empty Id For Request"); } @@ -88,7 +88,7 @@ describe("BatchRequestContent.ts", () => { } try { const batchReq = new BatchRequestContent(requests); - throw new Error("Something wrong with the limiting requests"); + throw new Error("Test Failed - Something wrong with the limiting requests"); } catch (error) { assert.equal(error.name, "Limit Exceeded Error"); done(); @@ -110,7 +110,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(requests); try { batchReq.addRequest(req); - throw new Error("Something wrong with the limiting requests"); + throw new Error("Test Failed - Something wrong with the limiting requests"); } catch (error) { assert.equal(error.name, "Limit Exceeded Error"); done(); @@ -132,7 +132,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req1]); try { batchReq.addRequest(req2); - throw new Error("Something wrong with duplicate id validation"); + throw new Error("Test Failed - Something wrong with duplicate id validation"); } catch (error) { assert.equal(error.name, "Duplicate RequestId Error"); done(); @@ -145,7 +145,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(); try { batchReq.addRequest(req); - throw new Error("Something wrong with empty id validation"); + throw new Error("Test Failed - Something wrong with empty id validation"); } catch (error) { assert.equal(error.name, "Empty Id For Request"); done(); @@ -199,7 +199,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req]); try { batchReq.addDependency("1"); - throw new Error("Dependent validation is failing"); + throw new Error("Test Failed - Dependent validation is failing"); } catch (err) { assert.equal(err.name, "Invalid Dependency Addition"); done(); @@ -211,7 +211,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent([req]); try { batchReq.addDependency("1", "100"); - throw new Error("Dependency validation is failing"); + throw new Error("Test Failed - Dependency validation is failing"); } catch (err) { assert.equal(err.name, "Invalid Dependency"); done(); @@ -297,7 +297,7 @@ describe("BatchRequestContent.ts", () => { const batchReq = new BatchRequestContent(); try { const content = await batchReq.getContent(); - throw new Error("Something wrong with the empty requests validation"); + throw new Error("Test Failed - Something wrong with the empty requests validation"); } catch (error) { assert.equal(error.name, "Empty Payload"); } @@ -340,26 +340,6 @@ describe("BatchRequestContent.ts", () => { } }); }); - - it("Should throw error for request does not have content-type header if it does have a body", async () => { - const createFolderReqWithoutHeader = new Request("/me/drive/root/children", { - method: "POST", - body: JSON.stringify(folderDetails), - }); - - const batchReq = new BatchRequestContent([ - { - id: "1", - request: createFolderReqWithoutHeader, - }, - ]); - try { - const content = await batchReq.getContent(); - throw new Error("Something wrong with the header checking"); - } catch (error) { - assert.equal(error.name, "Invalid Content-type header"); - } - }); }); describe("removeDependency", function() { @@ -423,7 +403,7 @@ describe("BatchRequestContent.ts", () => { it("Should throw error for empty request object", (done) => { try { BatchRequestContent["validateDependencies"](new Map() as Map); - throw new Error("Something wrong with the empty requests check"); + throw new Error("Test Failed - Something wrong with the empty requests check"); } catch (error) { assert.equal(error.name, "Empty Requests Error"); done(); diff --git a/test/package-lock.json b/test/package-lock.json new file mode 100644 index 000000000..d7d6a3cce --- /dev/null +++ b/test/package-lock.json @@ -0,0 +1,1085 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@microsoft/microsoft-graph-types-beta": { + "version": "github:microsoftgraph/msgraph-typescript-typings#dec3e2507fdab4b6348ecabdd2e56189caaf05c2", + "from": "github:microsoftgraph/msgraph-typescript-typings#beta", + "dev": true + }, + "@types/chai": { + "version": "4.2.14", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", + "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", + "dev": true + }, + "@types/form-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.5.0.tgz", + "integrity": "sha512-23/wYiuckYYtFpL+4RPWiWmRQH2BjFuqCUi2+N3amB1a1Drv+i/byTrGvlLwRVLFNAZbwpbQ7JvTK+VCAPMbcg==", + "dev": true, + "requires": { + "form-data": "*" + } + }, + "@types/microsoft-graph": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@types/microsoft-graph/-/microsoft-graph-1.28.0.tgz", + "integrity": "sha512-TquUdDyJvKop8A3Kmlop3+yUGdGG7ly20+AIRIgxdd4tEt52YrOWOcIO00QOtUQB1zMk+HsbFJyar9hFnV9G1w==", + "dev": true + }, + "@types/mocha": { + "version": "5.2.7", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", + "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", + "dev": true + }, + "@types/node": { + "version": "12.19.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.11.tgz", + "integrity": "sha512-bwVfNTFZOrGXyiQ6t4B9sZerMSShWNsGRw8tC5DY1qImUNczS9SjT4G6PnzjCnxsu5Ubj6xjL2lgwddkxtQl5w==", + "dev": true + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dev": true, + "requires": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "requires": { + "mime-db": "1.44.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mocha": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.2.1.tgz", + "integrity": "sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.4.3", + "debug": "4.2.0", + "diff": "4.0.2", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.14.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.2", + "nanoid": "3.1.12", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "7.2.0", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.0.2", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "2.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "msal": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/msal/-/msal-1.4.4.tgz", + "integrity": "sha512-aOBD/L6jAsizDFzKxxvXxH0FEDjp6Inr3Ufi/Y2o7KCFKN+akoE2sLeszEb/0Y3VxHxK0F0ea7xQ/HHTomKivw==", + "dev": true, + "requires": { + "tslib": "^1.9.3" + } + }, + "nanoid": { + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz", + "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A==", + "dev": true + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-node": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "whatwg-fetch": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz", + "integrity": "sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "workerpool": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.2.tgz", + "integrity": "sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", + "dev": true + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/test/package.json b/test/package.json new file mode 100644 index 000000000..5e30fdf54 --- /dev/null +++ b/test/package.json @@ -0,0 +1,18 @@ +{ + "devDependencies": { + "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta", + "@types/chai": "^4.2.14", + "@types/form-data": "^2.2.1", + "@types/microsoft-graph": "^1.9.0", + "@types/mocha": "^5.2.7", + "@types/node": "^12.0.0", + "chai": "^4.2.0", + "es6-promise": "^4.2.6", + "form-data": "^2.3.3", + "isomorphic-fetch": "^3.0.0", + "mocha": "^8.2.1", + "msal": "^1.0.0", + "node-fetch": "^2.6.1", + "ts-node": "^9.0.0" + } +} diff --git a/test/test-helper.ts b/test/test-helper.ts index 83082ed7b..bc55cbf8f 100644 --- a/test/test-helper.ts +++ b/test/test-helper.ts @@ -5,8 +5,6 @@ * ------------------------------------------------------------------------------------------- */ -import "isomorphic-fetch"; - import { Client } from "../src/index"; import { DummyAuthenticationProvider } from "./DummyAuthenticationProvider"; diff --git a/test/tsconfig-test-cjs.json b/test/tsconfig-test-cjs.json index a1f5fa6ab..8703c7717 100644 --- a/test/tsconfig-test-cjs.json +++ b/test/tsconfig-test-cjs.json @@ -2,8 +2,9 @@ "extends": "./../tsconfig-base.json", "compilerOptions": { "module": "commonjs", - "target": "es6", + "target": "es5", "lib": ["dom", "esnext"], + "rootDir": ".", "outDir": "lib/es" }, "include": ["test/"], diff --git a/test/tsconfig-test-es.json b/test/tsconfig-test-es.json index e208d8261..f9e0f1e73 100644 --- a/test/tsconfig-test-es.json +++ b/test/tsconfig-test-es.json @@ -1,10 +1,11 @@ { "extends": "../tsconfig-base.json", "compilerOptions": { - "module": "es6", + "module": "commonjs", "target": "es6", "lib": ["dom", "esnext"], - "outDir": "dist/es" + "rootDir": ".", + "outDir": "lib/es" }, - "include": ["common", "node", "browser"] + "include": ["test/development"] } diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json index 940d4d977..2cda489a0 100644 --- a/tsconfig-cjs.json +++ b/tsconfig-cjs.json @@ -6,6 +6,6 @@ "lib": ["dom", "esnext"], "outDir": "lib" }, - "exclude": ["node_modules", "lib", "samples", "test/"], - "include": ["./src/**/*.ts"] + "exclude": ["node_modules", "lib", "samples", "test/development"], + "include": ["./src/**/*.ts","./test"] } diff --git a/tsconfig-es.json b/tsconfig-es.json index 49e0ef498..321626ea3 100644 --- a/tsconfig-es.json +++ b/tsconfig-es.json @@ -7,5 +7,5 @@ "outDir": "lib/es" }, "exclude": ["node_modules", "lib", "samples", "test/development"], - "include": ["./src/**/*.ts", "../test"] + "include": ["./src/**/*.ts", "./test/**/*.ts"] } From 3a0787efcca74f048ac4b4c2765c1c990333089c Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Tue, 29 Dec 2020 20:50:03 -0800 Subject: [PATCH 05/10] Removing test/package.json --- package-lock.json | 321 +----- package.json | 24 +- rollup.config.js | 55 +- src/browser/TestAll.ts | 1 - test/common/content/BatchRequestContent.ts | 100 -- test/development/secrets.ts | 2 +- test/development/workload/OneNote.ts | 2 +- test/development/workload/PageIterator.ts | 18 +- test/development/workload/delta-query.ts | 2 +- test/development/workload/excel.ts | 4 +- test/development/workload/groups.ts | 2 +- test/development/workload/insights.ts | 2 +- test/development/workload/open-extensions.ts | 4 +- test/development/workload/users.ts | 3 +- test/node/content/BatchRequestContent.ts | 591 +--------- test/package-lock.json | 1085 ------------------ test/package.json | 18 - test/tsconfig-test-cjs.json | 8 +- 18 files changed, 107 insertions(+), 2135 deletions(-) delete mode 100644 src/browser/TestAll.ts delete mode 100644 test/package-lock.json delete mode 100644 test/package.json diff --git a/package-lock.json b/package-lock.json index ef6a24fd0..30c5be1a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -852,6 +852,12 @@ "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", "dev": true }, + "@microsoft/microsoft-graph-types": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-types/-/microsoft-graph-types-1.28.0.tgz", + "integrity": "sha512-nb6nS+ISwa75t1lnO4J3zsNuJ7CHNrOgIVg1ptzAejkGuyJfkpJfx+0+UjyG+WXl9HL9KMeOxzaALBJflOah9Q==", + "dev": true + }, "@samverschueren/stream-to-observable": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", @@ -900,16 +906,6 @@ "@types/node": "*" } }, - "@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "*" - } - }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -936,12 +932,6 @@ "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" }, - "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true - }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -1287,6 +1277,12 @@ "async-done": "^1.2.2" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1414,36 +1410,6 @@ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, - "bl": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", - "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, "blob": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", @@ -1677,12 +1643,6 @@ "ieee754": "^1.1.13" } }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -1856,12 +1816,6 @@ } } }, - "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true - }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -2084,6 +2038,15 @@ } } }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", @@ -2501,6 +2464,12 @@ "rimraf": "^2.2.8" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -2522,12 +2491,6 @@ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", "dev": true }, - "devtools-protocol": { - "version": "0.0.818844", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.818844.tgz", - "integrity": "sha512-AD1hi7iVJ8OD0aMLQU5VK0XH9LDlA1+BcPIgrAxPfaibx2DbWucuyOhc4oyQCbnvDDO68nN6/LcKfqTP343Jjg==", - "dev": true - }, "di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", @@ -3073,29 +3036,6 @@ } } }, - "extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "requires": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - } - } - }, "fancy-log": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", @@ -3108,15 +3048,6 @@ "time-stamp": "^1.0.0" } }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -3353,6 +3284,17 @@ } } }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3368,11 +3310,10 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" }, "fs-extra": { "version": "8.1.0", @@ -4558,16 +4499,6 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, - "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", - "dev": true, - "requires": { - "agent-base": "5", - "debug": "4" - } - }, "husky": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/husky/-/husky-2.3.0.tgz", @@ -6610,12 +6541,6 @@ } } }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, "mocha": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", @@ -7534,12 +7459,6 @@ "sha.js": "^2.4.8" } }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -7629,24 +7548,12 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "property-expr": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-1.5.1.tgz", "integrity": "sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g==", "dev": true }, - "proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true - }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -7708,86 +7615,6 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, - "puppeteer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.5.0.tgz", - "integrity": "sha512-OM8ZvTXAhfgFA7wBIIGlPQzvyEETzDjeRa4mZRCRHxYL+GNH5WAuYUQdja3rpWZvkX/JKqmuVgbsxDNsDFjMEg==", - "dev": true, - "requires": { - "debug": "^4.1.0", - "devtools-protocol": "0.0.818844", - "extract-zip": "^2.0.0", - "https-proxy-agent": "^4.0.0", - "node-fetch": "^2.6.1", - "pkg-dir": "^4.2.0", - "progress": "^2.0.1", - "proxy-from-env": "^1.0.0", - "rimraf": "^3.0.2", - "tar-fs": "^2.0.0", - "unbzip2-stream": "^1.3.3", - "ws": "^7.2.3" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", @@ -9146,44 +8973,6 @@ "integrity": "sha512-xYavZtFC1vKgJu0AOSYdrLeikNCsNwmUeZaV1XF9cMqEhBVVxLq6rEbYzOGrF1MV2MNPkhsJqqiXuQ4a76CEUg==", "dev": true }, - "tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dev": true, - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "tar-stream": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", - "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", - "dev": true, - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, "terser": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/terser/-/terser-4.0.2.tgz", @@ -9214,12 +9003,6 @@ "minimatch": "^3.0.4" } }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -9509,16 +9292,6 @@ } } }, - "unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", - "dev": true, - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -10042,16 +9815,6 @@ "yargs": "^13.3.0" } }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", diff --git a/package.json b/package.json index 6facc4f88..4a11f3864 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "@babel/runtime": "^7.4.4", "esm": "^3.2.25", + "fs": "0.0.1-security", "karma": "^5.2.3", "tslib": "^1.9.3" }, @@ -22,10 +23,12 @@ "@babel/plugin-transform-runtime": "^7.4.4", "@babel/preset-env": "^7.4.4", "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@microsoft/microsoft-graph-types": "^1.28.0", "@types/chai": "^4.2.14", "@types/mocha": "^5.2.7", "@types/node": "^12.0.10", "chai": "^4.2.0", + "form-data": "^2.3.3", "gulp": "^4.0.2", "husky": "^2.2.0", "isomorphic-fetch": "^3.0.0", @@ -39,7 +42,6 @@ "msal": "^1.0.0", "nyc": "^15.1.0", "prettier": "^1.17.0", - "puppeteer": "^5.5.0", "rollup": "^1.10.1", "rollup-plugin-babel": "^4.3.2", "rollup-plugin-commonjs": "^10.0.1", @@ -58,12 +60,8 @@ "build:cjs": "tsc --p tsconfig-cjs.json", "pre-build": "npm run setVersion", "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", - "test": "npm run build:cjs && mocha lib/spec/content && mocha lib/spec/core && mocha lib/spec/middleware && mocha lib/spec/tasks", - "test:content": "tsc --p spec/tsconfig.json && mocha spec/content", - "test:core": "tsc --p spec/tsconfig.json && mocha spec/core", - "test:middleware": "tsc --p spec/tsconfig.json && mocha spec/middleware", - "test:tasks": "tsc --p spec/tsconfig.json && mocha spec/tasks", - "test:development": "tsc --p spec/tsconfig.json && mocha spec/development/workload", + "test": "npm run test:cjs && npm run test:esm", + "test:development": "tsc --p test/tsconfig-test-cjs.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch", "test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload", "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", "format:css": "prettier --write \"**/*.css\"", @@ -75,12 +73,9 @@ "format:ts": "prettier --write \"**/*.ts\"", "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", "prepack": "npm install && npm run build && npm run test", - "test:cjs": "mocha -r ts-node/register --project tsconfig-cjs.json spec/content/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/core/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/middleware/*.ts && mocha -r ts-node/register --project tsconfig-cjs.json spec/tasks/*.ts", - "test:esm": "TS_NODE_PROJECT='./test/tsconfig-test-es.json' mocha --require esm test/dist/test/**/*.js", - "test:es": "tsc -p tsconfig-es.json && mocha lib/es/test/common/content --require esm && mocha lib/es/test/common/core --require esm && mocha lib/es/test/common/tasks --require esm && mocha lib/es/test/common/middleware --require esm", - "test:mocha": "nyc --require esm mocha -r ts-node/register spec/core/*.ts", - "cover": "nyc npm run test", - "coverage": "nyc npm run test:esm", + "test:coverage": "TS_NODE_PROJECT='./tsconfig-cjs.json' nyc mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts && mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts", + "test:cjs": "tsc -p tsconfig-cjs.json && mocha 'lib/test/common/**/*.js' --require isomorphic-fetch && mocha 'lib/test/node/**/*.js' --require isomorphic-fetch", + "test:esm": "tsc -p tsconfig-es.json && mocha 'lib/es/test/common/**/*.js' --require esm --require isomorphic-fetch && mocha 'lib/es/test/node/**/*.js' --require esm --require isomorphic-fetch", "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" }, "repository": { @@ -94,6 +89,9 @@ "samples/", "*.js", "lib/" + ], + "include": [ + "src/" ] } } diff --git a/rollup.config.js b/rollup.config.js index c5d4e797d..3d21af8ab 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,33 +3,32 @@ import resolve from "rollup-plugin-node-resolve"; import babel from "rollup-plugin-babel"; import commonjs from "rollup-plugin-commonjs"; -const config = [ - { - input: ["lib/es/browser/index.js"], - output: { - file: "lib/graph-es-sdk.js", - format: "es", - name: "MicrosoftGraph", - }, - plugins: [resolve(), terser()], - }, - { - input: ["lib/es/browser/index.js"], - output: { - file: "lib/graph-js-sdk.js", - format: "iife", - name: "MicrosoftGraph", - }, - plugins: [ - resolve(), - babel({ - runtimeHelpers: true, - exclude: "node_modules/**", - }), - commonjs({ include: "node_modules/**" }), - terser(), - ], - }, +const config = [{ + input: ["lib/es/src/browser/index.js"], + output: { + file: "lib/graph-es-sdk.js", + format: "es", + name: "MicrosoftGraph", + }, + plugins: [resolve(), terser()], + }, + { + input: ["lib/es/src/browser/index.js"], + output: { + file: "lib/graph-js-sdk.js", + format: "iife", + name: "MicrosoftGraph", + }, + plugins: [ + resolve(), + babel({ + runtimeHelpers: true, + exclude: "node_modules/**", + }), + commonjs({ include: "node_modules/**" }), + terser(), + ], + }, ]; -export default config; +export default config; \ No newline at end of file diff --git a/src/browser/TestAll.ts b/src/browser/TestAll.ts deleted file mode 100644 index 8fd93e6ca..000000000 --- a/src/browser/TestAll.ts +++ /dev/null @@ -1 +0,0 @@ -class TestAll {} diff --git a/test/common/content/BatchRequestContent.ts b/test/common/content/BatchRequestContent.ts index 17777a967..6c5fb481f 100644 --- a/test/common/content/BatchRequestContent.ts +++ b/test/common/content/BatchRequestContent.ts @@ -191,106 +191,6 @@ describe("BatchRequestContent.ts", () => { }); }); - describe("addDependency", function() { - this.timeout(20 * 1000); - it("Should return error for request with dependent id not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1"); - throw new Error("Test Failed -Dependent validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency Addition"); - done(); - } - }); - - it("Should return error for the request with given dependency id is not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1", "100"); - throw new Error("Test Failed -Dependency validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency"); - done(); - } - }); - - it("Should add dependency for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2", "1"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("2", "3"); - assert.equal(batchReq.requests.get("2").dependsOn.length, 2); - done(); - }); - - it("Should return error for adding duplicate dependency", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2", "1"); - try { - batchReq.addDependency("2", "1"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - - it("Should add dependency for dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("3"); - assert.isDefined(batchReq.requests.get("3").dependsOn); - done(); - }); - - it("Should return error for adding duplicate dependency when dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - try { - batchReq.addDependency("2"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - - it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addDependency("1"); - } catch (e) { - assert.equal(e.name, "Invalid Dependency Addition"); - done(); - } - }); - }); - describe("getContent", () => { it("Should return error for empty requests", async () => { const batchReq = new BatchRequestContent(); diff --git a/test/development/secrets.ts b/test/development/secrets.ts index 304c647cd..432df72b8 100644 --- a/test/development/secrets.ts +++ b/test/development/secrets.ts @@ -4,4 +4,4 @@ * * To use authentication based(making real requests to the graph service) testing populate this access token's value and rename this file as secrets.ts */ -export const AccessToken = ""; +export const Access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/development/workload/OneNote.ts index 87d47e5e3..2bcddc1cd 100644 --- a/test/development/workload/OneNote.ts +++ b/test/development/workload/OneNote.ts @@ -5,10 +5,10 @@ * ------------------------------------------------------------------------------------------- */ +import { Notebook, OnenotePage, OnenoteSection } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; import FormData from "form-data"; import fs from "fs"; -import { Notebook, OnenotePage, OnenoteSection } from "microsoft-graph"; import { getClient, randomString } from "../test-helper"; diff --git a/test/development/workload/PageIterator.ts b/test/development/workload/PageIterator.ts index 69a793bf9..349b0cd2a 100644 --- a/test/development/workload/PageIterator.ts +++ b/test/development/workload/PageIterator.ts @@ -5,29 +5,31 @@ * ------------------------------------------------------------------------------------------- */ +import { Event } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; -import { Event } from "microsoft-graph"; -import { PageIterator, PageIteratorCallback, GraphRequestOptions, PageCollection } from "../../../src/tasks/PageIterator"; + import { getClient } from "../test-helper"; + import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; +import { GraphRequestOptions, PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; import { Client, ClientOptions } from "../../../src"; const client = getClient(); -describe("PageIterator", function() { +describe("PageIterator", ()=> { const pstHeader = { Prefer: 'outlook.timezone= "pacific standard time"' }; const utc = "UTC"; const pst = "Pacific Standard Time"; const testURL = "/me/events"; - before(async function() { + before(async function () { this.timeout(20000); - const response = await client.api(testURL).get(); + const response = await client.api(testURL + "?count=true").get(); const numberOfEvents = 4; - const existingEventsCount = response.value.length; + const existingEventsCount = response.value["@odata.count"]; if (existingEventsCount >= numberOfEvents) { return; @@ -58,7 +60,7 @@ describe("PageIterator", function() { assert.equal(event.start.timeZone, pst); return true; }; - var requestOptions: GraphRequestOptions = { options: { headers: pstHeader } }; + const requestOptions: GraphRequestOptions = { options: { headers: pstHeader } }; if (response["@odata.nextLink"]) { const pageIterator = new PageIterator(client, response, callback, requestOptions); await pageIterator.iterate(); @@ -85,7 +87,7 @@ describe("PageIterator", function() { return true; }; - var requestOptions = { headers: pstHeader }; + const requestOptions = { headers: pstHeader }; if (response["@odata.nextLink"]) { const pageIterator = new PageIterator(client, response, callback, requestOptions); await pageIterator.iterate(); diff --git a/test/development/workload/delta-query.ts b/test/development/workload/delta-query.ts index a5caf7043..80ff5c93d 100644 --- a/test/development/workload/delta-query.ts +++ b/test/development/workload/delta-query.ts @@ -5,9 +5,9 @@ * ------------------------------------------------------------------------------------------- */ +import { Event } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; import "isomorphic-fetch"; -import { Event } from "microsoft-graph"; import { getClient, randomString } from "../test-helper"; diff --git a/test/development/workload/excel.ts b/test/development/workload/excel.ts index df242fa81..1b4c868c1 100644 --- a/test/development/workload/excel.ts +++ b/test/development/workload/excel.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; import * as fs from "fs"; -import { WorkbookRange, WorkbookWorksheet } from "microsoft-graph"; +import { WorkbookRange, WorkbookWorksheet } from "@microsoft/microsoft-graph-types"; import { getClient, randomString } from "../test-helper"; @@ -24,7 +24,7 @@ describe("Excel", function() { }); it("Uploads an Excel file to OneDrive", async () => { try { - const file = fs.readFileSync("./spec/sample_files/empty-spreadsheet.xlsx"); + const file = fs.readFileSync("./test/sample_files/empty-spreadsheet.xlsx"); const res = await client.api(`/me/drive/root/children/${ExcelFilename}/content`).put(file); assert.isDefined(res.id); } catch (error) { diff --git a/test/development/workload/groups.ts b/test/development/workload/groups.ts index e7563b197..24c0fdb72 100644 --- a/test/development/workload/groups.ts +++ b/test/development/workload/groups.ts @@ -5,8 +5,8 @@ * ------------------------------------------------------------------------------------------- */ +import { Group } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; -import { Group } from "microsoft-graph"; import { getClient, randomString } from "../test-helper"; diff --git a/test/development/workload/insights.ts b/test/development/workload/insights.ts index 751d70dfc..6cc765b71 100644 --- a/test/development/workload/insights.ts +++ b/test/development/workload/insights.ts @@ -5,8 +5,8 @@ * ------------------------------------------------------------------------------------------- */ +import { Person } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; -import { Person } from "microsoft-graph"; import { getClient } from "../test-helper"; diff --git a/test/development/workload/open-extensions.ts b/test/development/workload/open-extensions.ts index 158741c24..fc766907d 100644 --- a/test/development/workload/open-extensions.ts +++ b/test/development/workload/open-extensions.ts @@ -5,8 +5,8 @@ * ------------------------------------------------------------------------------------------- */ +import { OpenTypeExtension } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; -import { OpenTypeExtension } from "microsoft-graph"; import { getClient, randomString } from "../test-helper"; @@ -21,7 +21,7 @@ let extension: ColorOpenExtension = { color: randomString(), }; -describe("Open Extensions", function() { +describe("Open Extensions", function () { this.timeout(10 * 1000); it("Use open extensions to add a field to users", async () => { diff --git a/test/development/workload/users.ts b/test/development/workload/users.ts index e75b5eacb..06495b789 100644 --- a/test/development/workload/users.ts +++ b/test/development/workload/users.ts @@ -5,9 +5,10 @@ * ------------------------------------------------------------------------------------------- */ +import { User } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; import "isomorphic-fetch"; -import { User } from "microsoft-graph"; + import { getClient, randomString } from "../test-helper"; diff --git a/test/node/content/BatchRequestContent.ts b/test/node/content/BatchRequestContent.ts index 2bdd95fa8..5637ec091 100644 --- a/test/node/content/BatchRequestContent.ts +++ b/test/node/content/BatchRequestContent.ts @@ -9,315 +9,13 @@ import { assert } from "chai"; import * as fs from "fs"; import "isomorphic-fetch"; -import { BatchRequestContent, BatchRequestStep } from "../../../src/content/BatchRequestContent"; -import { randomString } from "../../test-helper"; - -const folderName = randomString(); -const folderDetails = { - name: folderName, - folder: {}, -}; - -const createFolderRequest = new Request("/me/drive/root/children", { - method: "POST", - headers: { - "Content-type": "application/json", - }, - body: JSON.stringify(folderDetails), -}); - -const getCreateFolderRequestCopy = () => { - return { - id: "1", - request: createFolderRequest, - }; -}; - -const getCreateFolderRequestWithDependsOnCopy = () => { - const data = { - id: "1", - request: createFolderRequest, - dependsOn: undefined, - }; - data.dependsOn = []; - return data; -}; +import { BatchRequestContent} from "../../../src/content/BatchRequestContent"; describe("BatchRequestContent.ts", () => { - describe("Create", function() { - this.timeout(20 * 1000); - it("Should Create BatchRequestContent instance with no requests", (done) => { - const batchReq = new BatchRequestContent(); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - - it("Should create BatchRequestContent instance with empty array", (done) => { - const batchReq = new BatchRequestContent([]); - assert(batchReq instanceof BatchRequestContent); - done(); - }); - - it("Should create BatchRequestContent instance with requests", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - const createFolderDuplicate2 = getCreateFolderRequestCopy(); - createFolderDuplicate2.id = "2"; - const batchReq = new BatchRequestContent([createFolderDuplicate1, createFolderDuplicate2]); - assert.equal(batchReq.requests.size, 2); - done(); - }); - - it("Should throw error for empty request id", (done) => { - const createFolderDuplicate1 = getCreateFolderRequestCopy(); - createFolderDuplicate1.id = ""; - try { - const batchReq = new BatchRequestContent([createFolderDuplicate1]); - throw new Error(" Test Failed - Something wrong with the empty id check"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - } - done(); - }); - - it("Should return error incase of number of requests limit exceeding", (done) => { - const requests = []; - for (let i = 0; i < 25; i++) { - const req = getCreateFolderRequestCopy(); - req.id = "" + i; - requests.push(req); - } - try { - const batchReq = new BatchRequestContent(requests); - throw new Error("Test Failed - Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - }); - - describe("addRequest", function() { - this.timeout(20 * 1000); - it("Should emit size exceed error", (done) => { - const requests = []; - for (let i = 0; i < 20; i++) { - const r = getCreateFolderRequestCopy(); - r.id = "" + i; - requests.push(r); - } - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(requests); - try { - batchReq.addRequest(req); - throw new Error("Test Failed - Something wrong with the limiting requests"); - } catch (error) { - assert.equal(error.name, "Limit Exceeded Error"); - done(); - } - }); - - it("Should add Request JSON to the BatchRequestContent instance", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = "100"; - const batchReq = new BatchRequestContent(); - const id = batchReq.addRequest(req); - assert.equal(req.id, id); - done(); - }); - - it("Should throw duplicate id error", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addRequest(req2); - throw new Error("Test Failed - Something wrong with duplicate id validation"); - } catch (error) { - assert.equal(error.name, "Duplicate RequestId Error"); - done(); - } - }); - - it("Should throw duplicate id error", (done) => { - const req = getCreateFolderRequestCopy(); - req.id = ""; - const batchReq = new BatchRequestContent(); - try { - batchReq.addRequest(req); - throw new Error("Test Failed - Something wrong with empty id validation"); - } catch (error) { - assert.equal(error.name, "Empty Id For Request"); - done(); - } - }); - }); - - describe("removeRequest", () => { - it("Should delete the request present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, batchReq.removeRequest(req.id)); - done(); - }); - - it("Should return false for the request that is not present in the batch", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(false, batchReq.removeRequest("1000")); - done(); - }); - - it("Should remove dependencies in case dependencies present", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - const req4 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - batchReq.addDependency("2", "1"); - batchReq.addDependency("3", "2"); - batchReq.addDependency("4", "1"); - batchReq.addDependency("4", "2"); - batchReq.addDependency("4", "3"); - batchReq.removeRequest("2"); - - assert.isUndefined(batchReq.requests.get("1").dependsOn); - assert.isUndefined(batchReq.requests.get("3").dependsOn); - assert.equal(batchReq.requests.get("4").dependsOn.length, 2); - done(); - }); - }); - - describe("addDependency", function() { - this.timeout(20 * 1000); - it("Should return error for request with dependent id not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1"); - throw new Error("Test Failed - Dependent validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency Addition"); - done(); - } - }); - - it("Should return error for the request with given dependency id is not present", (done) => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - batchReq.addDependency("1", "100"); - throw new Error("Test Failed - Dependency validation is failing"); - } catch (err) { - assert.equal(err.name, "Invalid Dependency"); - done(); - } - }); - - it("Should add dependency for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2", "1"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("2", "3"); - assert.equal(batchReq.requests.get("2").dependsOn.length, 2); - done(); - }); - - it("Should return error for adding duplicate dependency", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2", "1"); - try { - batchReq.addDependency("2", "1"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - - it("Should add dependency for dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - batchReq.addDependency("3"); - assert.isDefined(batchReq.requests.get("3").dependsOn); - done(); - }); - - it("Should return error for adding duplicate dependency when dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.isDefined(batchReq.requests.get("2").dependsOn); - try { - batchReq.addDependency("2"); - } catch (e) { - assert.equal(e.name, "Duplicate Dependency"); - done(); - } - }); - - it("Should return error for adding dependency when only one request is present and dependency id not given", (done) => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const batchReq = new BatchRequestContent([req1]); - try { - batchReq.addDependency("1"); - } catch (e) { - assert.equal(e.name, "Invalid Dependency Addition"); - done(); - } - }); - }); - describe("getContent", () => { - it("Should return error for empty requests", async () => { - const batchReq = new BatchRequestContent(); - try { - const content = await batchReq.getContent(); - throw new Error("Test Failed - Something wrong with the empty requests validation"); - } catch (error) { - assert.equal(error.name, "Empty Payload"); - } - }); - - it("Should return json content", async () => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - try { - const content = await batchReq.getContent(); - assert.isDefined(content.requests[0].body); - assert.equal(typeof content.requests[0].body, "object"); - } catch (error) { - throw error; - } - }); - it("Should return image's base64 string", async () => { const fileName = "sample_image.jpg"; - fs.readFile(`./spec/sample_files/${fileName}`, {}, async (err, file) => { + fs.readFile(`./test/sample_files/${fileName}`, {}, async (err, file) => { if (err) { throw err; } @@ -342,289 +40,4 @@ describe("BatchRequestContent.ts", () => { }); }); - describe("removeDependency", function() { - this.timeout(20 * 1000); - - it("Should return false for dependent not present", (done) => { - const batchReq = new BatchRequestContent(); - assert.equal(false, batchReq.removeDependency("1")); - done(); - }); - - it("Should return false for dependency array not present in the request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(false, batchReq.removeDependency("2")); - done(); - }); - - it("Should return false for given dependency id is not present in the dependent request", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(false, batchReq.removeDependency("2", "5")); - done(); - }); - - it("Should delete the given dependency and dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - batchReq.addDependency("2"); - assert.equal(true, batchReq.removeDependency("2", "1")); - done(); - }); - - it("Should delete all dependencies for a given dependent", (done) => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - const req3 = getCreateFolderRequestCopy(); - req1.id = "1"; - req2.id = "2"; - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - batchReq.addDependency("3", "1"); - batchReq.addDependency("3", "2"); - assert.equal(true, batchReq.removeDependency("3")); - done(); - }); - }); - - describe("validateDependencies", () => { - /* tslint:disable: no-string-literal */ - it("Should throw error for empty request object", (done) => { - try { - BatchRequestContent["validateDependencies"](new Map() as Map); - throw new Error("Test Failed - Something wrong with the empty requests check"); - } catch (error) { - assert.equal(error.name, "Empty Requests Error"); - done(); - } - }); - - it("isParallel - Should validate for single request", () => { - const req = getCreateFolderRequestCopy(); - const batchReq = new BatchRequestContent([req]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isParallel - Should validate for multiple requests", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isParallel - Should validate for requests with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isParallel - Should validate for requests with empty dependsOn array", () => { - const req1 = getCreateFolderRequestCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should not validate for first request having dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = undefined; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should not validate for a request does not depend on anything", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should not validate for a request does not depend on previous request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["4"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should not validate for requests having more than one dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["2", "3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSerial - Should validate for proper serial dependencies", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const req4 = getCreateFolderRequestWithDependsOnCopy(); - req4.id = "4"; - req4.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3, req4]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should validate for first request with undefined dependsOn", () => { - const req1 = getCreateFolderRequestCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should validate for first request with empty dependsOn array", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.id = "1"; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should not validate for first request having dependency on itself", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["1"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["1"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should not validate for first request having dependency on non existing request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["10"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["10"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["10"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should validate for requests dependsOn some middle order request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(true, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should not validate for middle order request with empty dependsOn", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["1"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should not validate for middle order request dependency request has its own dependency", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - req2.dependsOn = ["2"]; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["2"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - - it("isSame - Should not validate for middle order request does depend on some other request other than dependency request", () => { - const req1 = getCreateFolderRequestWithDependsOnCopy(); - req1.dependsOn = ["2"]; - const req2 = getCreateFolderRequestWithDependsOnCopy(); - req2.id = "2"; - const req3 = getCreateFolderRequestWithDependsOnCopy(); - req3.id = "3"; - req3.dependsOn = ["3"]; - const batchReq = new BatchRequestContent([req1, req2, req3]); - assert.equal(false, BatchRequestContent["validateDependencies"](batchReq.requests)); - }); - /* tslint:enable: no-string-literal */ - }); }); diff --git a/test/package-lock.json b/test/package-lock.json deleted file mode 100644 index d7d6a3cce..000000000 --- a/test/package-lock.json +++ /dev/null @@ -1,1085 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@microsoft/microsoft-graph-types-beta": { - "version": "github:microsoftgraph/msgraph-typescript-typings#dec3e2507fdab4b6348ecabdd2e56189caaf05c2", - "from": "github:microsoftgraph/msgraph-typescript-typings#beta", - "dev": true - }, - "@types/chai": { - "version": "4.2.14", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.14.tgz", - "integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==", - "dev": true - }, - "@types/form-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.5.0.tgz", - "integrity": "sha512-23/wYiuckYYtFpL+4RPWiWmRQH2BjFuqCUi2+N3amB1a1Drv+i/byTrGvlLwRVLFNAZbwpbQ7JvTK+VCAPMbcg==", - "dev": true, - "requires": { - "form-data": "*" - } - }, - "@types/microsoft-graph": { - "version": "1.28.0", - "resolved": "https://registry.npmjs.org/@types/microsoft-graph/-/microsoft-graph-1.28.0.tgz", - "integrity": "sha512-TquUdDyJvKop8A3Kmlop3+yUGdGG7ly20+AIRIgxdd4tEt52YrOWOcIO00QOtUQB1zMk+HsbFJyar9hFnV9G1w==", - "dev": true - }, - "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, - "@types/node": { - "version": "12.19.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.11.tgz", - "integrity": "sha512-bwVfNTFZOrGXyiQ6t4B9sZerMSShWNsGRw8tC5DY1qImUNczS9SjT4G6PnzjCnxsu5Ubj6xjL2lgwddkxtQl5w==", - "dev": true - }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "binary-extensions": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", - "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", - "dev": true, - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "dev": true, - "optional": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isomorphic-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", - "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", - "dev": true, - "requires": { - "node-fetch": "^2.6.1", - "whatwg-fetch": "^3.4.1" - } - }, - "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", - "dev": true, - "requires": { - "chalk": "^4.0.0" - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", - "dev": true - }, - "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", - "dev": true, - "requires": { - "mime-db": "1.44.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mocha": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.2.1.tgz", - "integrity": "sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w==", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.4.3", - "debug": "4.2.0", - "diff": "4.0.2", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.1.6", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.14.0", - "log-symbols": "4.0.0", - "minimatch": "3.0.4", - "ms": "2.1.2", - "nanoid": "3.1.12", - "serialize-javascript": "5.0.1", - "strip-json-comments": "3.1.1", - "supports-color": "7.2.0", - "which": "2.0.2", - "wide-align": "1.1.3", - "workerpool": "6.0.2", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "2.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "msal": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/msal/-/msal-1.4.4.tgz", - "integrity": "sha512-aOBD/L6jAsizDFzKxxvXxH0FEDjp6Inr3Ufi/Y2o7KCFKN+akoE2sLeszEb/0Y3VxHxK0F0ea7xQ/HHTomKivw==", - "dev": true, - "requires": { - "tslib": "^1.9.3" - } - }, - "nanoid": { - "version": "3.1.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz", - "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A==", - "dev": true - }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "ts-node": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", - "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", - "dev": true, - "requires": { - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.17", - "yn": "3.1.1" - } - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "whatwg-fetch": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz", - "integrity": "sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "workerpool": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.2.tgz", - "integrity": "sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q==", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", - "dev": true - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "dependencies": { - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", - "dev": true - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - } - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } - } -} diff --git a/test/package.json b/test/package.json deleted file mode 100644 index 5e30fdf54..000000000 --- a/test/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "devDependencies": { - "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta", - "@types/chai": "^4.2.14", - "@types/form-data": "^2.2.1", - "@types/microsoft-graph": "^1.9.0", - "@types/mocha": "^5.2.7", - "@types/node": "^12.0.0", - "chai": "^4.2.0", - "es6-promise": "^4.2.6", - "form-data": "^2.3.3", - "isomorphic-fetch": "^3.0.0", - "mocha": "^8.2.1", - "msal": "^1.0.0", - "node-fetch": "^2.6.1", - "ts-node": "^9.0.0" - } -} diff --git a/test/tsconfig-test-cjs.json b/test/tsconfig-test-cjs.json index 8703c7717..e2e92ebd2 100644 --- a/test/tsconfig-test-cjs.json +++ b/test/tsconfig-test-cjs.json @@ -3,10 +3,10 @@ "compilerOptions": { "module": "commonjs", "target": "es5", + "esModuleInterop": true, + "noEmitOnError": true, "lib": ["dom", "esnext"], - "rootDir": ".", - "outDir": "lib/es" + "outDir": "../lib/" }, - "include": ["test/"], - "exclude": ["test/development"] + "include": ["./development/","../src/"] } From 1a23f51f1907a2c7244f2e08af216eb23c120415 Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Wed, 30 Dec 2020 17:05:53 -0800 Subject: [PATCH 06/10] middlewareutil removing getall --- package.json | 3 +- test/common/middleware/MiddlewareUtil.ts | 621 +++++++++++----------- test/development/workload/PageIterator.ts | 55 +- 3 files changed, 345 insertions(+), 334 deletions(-) diff --git a/package.json b/package.json index 4a11f3864..985c1f527 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", "test": "npm run test:cjs && npm run test:esm", "test:development": "tsc --p test/tsconfig-test-cjs.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch", - "test:workload": "tsc --p spec/tsconfig.json && mocha spec/development/workload", "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", "format:css": "prettier --write \"**/*.css\"", "format:html": "prettier --write \"**/*.html\"", @@ -74,7 +73,7 @@ "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", "prepack": "npm install && npm run build && npm run test", "test:coverage": "TS_NODE_PROJECT='./tsconfig-cjs.json' nyc mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts && mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts", - "test:cjs": "tsc -p tsconfig-cjs.json && mocha 'lib/test/common/**/*.js' --require isomorphic-fetch && mocha 'lib/test/node/**/*.js' --require isomorphic-fetch", + "test:cjs": "tsc -p tsconfig-cjs.json && mocha 'lib/test/common/**/*.js' --require isomorphic-fetch && mocha 'lib/test/node/**/*.js' --require isomorphic-fetch", "test:esm": "tsc -p tsconfig-es.json && mocha 'lib/es/test/common/**/*.js' --require esm --require isomorphic-fetch && mocha 'lib/es/test/node/**/*.js' --require esm --require isomorphic-fetch", "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" }, diff --git a/test/common/middleware/MiddlewareUtil.ts b/test/common/middleware/MiddlewareUtil.ts index 2a6efcf7e..d1ccd8973 100644 --- a/test/common/middleware/MiddlewareUtil.ts +++ b/test/common/middleware/MiddlewareUtil.ts @@ -1,334 +1,345 @@ -// /** -// * ------------------------------------------------------------------------------------------- -// * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. -// * See License in the project root for license information. -// * ------------------------------------------------------------------------------------------- -// */ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ +/* tslint:disable */ +import { assert } from "chai"; -// import { assert } from "chai"; -// import { NFHeaders } from "node-fetch"; +import { FetchOptions } from "../../../src/IFetchOptions"; +import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../../src/middleware/MiddlewareUtil"; -// import { FetchOptions } from "../../src/IFetchOptions"; -// import { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from "../../src/middleware/MiddlewareUtil"; +describe("MiddlewareUtil.ts", async () => { + function getMultipleValuesForHeader(headers: Headers, key: string): string[] { + return headers + .get(key) + .split(",") + .map(function(item) { + return item.trim(); + }); + } -// describe("MiddlewareUtil.ts", async () => { -// describe("getRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const url = "dummy_url"; -// it("Should get header from request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// const headerValue: string = getRequestHeader(request, undefined, key); -// assert.equal(headerValue, value); -// }); + describe("getRequestHeader", () => { + const key: string = "Content-Type"; + const value: string = "application/json"; + const url = "dummy_url"; + it("Should get header from request object", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }); + const headerValue: string = getRequestHeader(request, undefined, key); + assert.equal(headerValue, value); + }); -// it("Should get header from headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); + it("Should get header from headers object", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }; + const headerValue: string = getRequestHeader(url, options, key); + assert.equal(headerValue, value); + }); -// it("Should get header from Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ -// version: "version", -// [key]: value, -// }), -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); + it("Should get header from Headers instance", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ + version: "version", + [key]: value, + }), + }; + const headerValue: string = getRequestHeader(url, options, key); + assert.equal(headerValue, value); + }); -// it("Should get header from array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"], [key, value]], -// }; -// const headerValue: string = getRequestHeader(url, options, key); -// assert.equal(headerValue, value); -// }); -// }); + it("Should get header from array of headers", () => { + const options: FetchOptions = { + method: "test", + headers: [ + ["version", "version"], + [key, value], + ], + }; + const headerValue: string = getRequestHeader(url, options, key); + assert.equal(headerValue, value); + }); + }); -// describe("setRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const url = "dummy_url"; -// it("Should set header in request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// }, -// }); -// setRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); + describe("setRequestHeader", () => { + const key: string = "Content-Type"; + const value: string = "application/json"; + const url = "dummy_url"; + it("Should set header in request object", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + }, + }); + setRequestHeader(request, undefined, key, value); + assert.equal(request.headers.get(key), value); + }); -// it("Should replace header in request object if the header is already present", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// setRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); + it("Should replace header in request object if the header is already present", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }); + setRequestHeader(request, undefined, key, value); + assert.equal(request.headers.get(key), value); + }); -// it("Should set header for empty headers", () => { -// const options: FetchOptions = { -// method: "test", -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); + it("Should set header for empty headers", () => { + const options: FetchOptions = { + method: "test", + }; + setRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as Headers).get(key), value); + }); -// it("Should set header in headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// }, -// }; -// setRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); + it("Should set header in headers object", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + }, + }; + setRequestHeader(url, options, key, value); + assert.equal(options.headers[key], value); + }); -// it("Should replace header in headers object if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// setRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); + it("Should replace header in headers object if header is already present", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }; + setRequestHeader(url, options, key, value); + assert.equal(options.headers[key], value); + }); -// it("Should set header in Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version" }), -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); + it("Should set header in Headers instance", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ version: "version" }), + }; + setRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as Headers).get(key), value); + }); -// it("Should replace header in Headers instance if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: value }), -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); + it("Should replace header in Headers instance if header is already present", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ version: "version", [key]: value }), + }; + setRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as Headers).get(key), value); + }); -// it("Should set header in array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"]], -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal(options.headers[1][1], value); -// }); + it("Should set header in array of headers", () => { + const options: FetchOptions = { + method: "test", + headers: [["version", "version"]], + }; + setRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal(options.headers[1][1], value); + }); -// it("Should replace header in array of headers if header is already present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, "dummy/type"]], -// }; -// setRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 1); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], value); -// }); -// }); + it("Should replace header in array of headers if header is already present", () => { + const options: FetchOptions = { + method: "test", + headers: [[key, "dummy/type"]], + }; + setRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as string[][]).length, 1); + assert.equal(options.headers[0][0], key); + assert.equal(options.headers[0][1], value); + }); + }); -// describe("appendRequestHeader", () => { -// const key: string = "Content-Type"; -// const value: string = "application/json"; -// const firstValue: string = "text/html"; -// const url = "dummy_url"; -// it("Should set header in request object if the header is not present", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// assert.equal(request.headers.get(key), value); -// }); + describe("appendRequestHeader", () => { + const key: string = "Content-Type"; + const value: string = "application/json"; + const firstValue: string = "text/html"; + const url = "dummy_url"; + it("Should set header in request object if the header is not present", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + }, + }); + appendRequestHeader(request, undefined, key, value); + assert.equal(request.headers.get(key), value); + }); -// it("Should append header in request object", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: firstValue, -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// const values = (request.headers as NFHeaders).getAll(key); -// assert.equal(values[0], firstValue); -// assert.equal(values[1], value); -// }); + it("Should append header in request object", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + [key]: firstValue, + }, + }); + appendRequestHeader(request, undefined, key, value); + const values = getMultipleValuesForHeader(request.headers, key); + assert.equal(values[0], firstValue); + assert.equal(values[1], value); + }); -// it("Should append header in request object even if the value is duplicate", () => { -// const request: Request = new Request(url, { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }); -// appendRequestHeader(request, undefined, key, value); -// const values = (request.headers as NFHeaders).getAll(key); -// assert.equal(values[0], value); -// assert.equal(values[1], value); -// }); + it("Should append header in request object even if the value is duplicate", () => { + const request: Request = new Request(url, { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }); + appendRequestHeader(request, undefined, key, value); + const values = getMultipleValuesForHeader(request.headers, key); + assert.equal(values[0], value); + assert.equal(values[1], value); + }); -// it("Should set header for empty headers", () => { -// const options: FetchOptions = { -// method: "test", -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as NFHeaders).get(key), value); -// }); + it("Should set header for empty headers", () => { + const options: FetchOptions = { + method: "test", + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as Headers).get(key), value); + }); -// it("Should set header in headers object if header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], value); -// }); + it("Should set header in headers object if header is not present", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + }, + }; + appendRequestHeader(url, options, key, value); + assert.equal(options.headers[key], value); + }); -// it("Should append header in headers object", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: firstValue, -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], `${firstValue}, ${value}`); -// }); + it("Should append header in headers object", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + [key]: firstValue, + }, + }; + appendRequestHeader(url, options, key, value); + assert.equal(options.headers[key], `${firstValue}, ${value}`); + }); -// it("Should append header in headers object even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: { -// version: "version", -// [key]: value, -// }, -// }; -// appendRequestHeader(url, options, key, value); -// assert.equal(options.headers[key], `${value}, ${value}`); -// }); + it("Should append header in headers object even if the value is duplicate", () => { + const options: FetchOptions = { + method: "test", + headers: { + version: "version", + [key]: value, + }, + }; + appendRequestHeader(url, options, key, value); + assert.equal(options.headers[key], `${value}, ${value}`); + }); -// it("Should set header in Headers instance if header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version" }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as Headers).get(key), value); -// }); + it("Should set header in Headers instance if header is not present", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ version: "version" }), + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as Headers).get(key), value); + }); -// it("Should append header in Headers instance", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: firstValue }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// const values = (options.headers as NFHeaders).getAll(key); -// assert.equal(values[0], firstValue); -// assert.equal(values[1], value); -// }); + it("Should append header in Headers instance", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ version: "version", [key]: firstValue }), + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + const values = getMultipleValuesForHeader(options.headers as Headers, key); + assert.equal(values[0], firstValue); + assert.equal(values[1], value); + }); -// it("Should append header in Headers instance even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: new Headers({ version: "version", [key]: value }), -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// const values = (options.headers as NFHeaders).getAll(key); -// assert.equal(values[0], value); -// assert.equal(values[1], value); -// }); + it("Should append header in Headers instance even if the value is duplicate", () => { + const options: FetchOptions = { + method: "test", + headers: new Headers({ version: "version", [key]: value }), + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + const values = getMultipleValuesForHeader(options.headers as Headers, key); + assert.equal(values[0], value); + assert.equal(values[1], value); + }); -// it("Should set header in array of headers if the header is not present", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [["version", "version"]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal(options.headers[1][1], value); -// }); + it("Should set header in array of headers if the header is not present", () => { + const options: FetchOptions = { + method: "test", + headers: [["version", "version"]], + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal(options.headers[1][1], value); + }); -// it("Should append header in array of headers", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, firstValue]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 2); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], firstValue); -// assert.equal(options.headers[1][0], key); -// assert.equal(options.headers[1][1], value); -// }); + it("Should append header in array of headers", () => { + const options: FetchOptions = { + method: "test", + headers: [[key, firstValue]], + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as string[][]).length, 2); + assert.equal(options.headers[0][0], key); + assert.equal(options.headers[0][1], firstValue); + assert.equal(options.headers[1][0], key); + assert.equal(options.headers[1][1], value); + }); -// it("Should append header in array of headers even if the value is duplicate", () => { -// const options: FetchOptions = { -// method: "test", -// headers: [[key, value]], -// }; -// appendRequestHeader(url, options, key, value); -// assert.isDefined(options.headers); -// assert.equal((options.headers as string[][]).length, 2); -// assert.equal(options.headers[0][0], key); -// assert.equal(options.headers[0][1], value); -// assert.equal(options.headers[1][0], key); -// assert.equal(options.headers[1][1], value); -// }); -// }); + it("Should append header in array of headers even if the value is duplicate", () => { + const options: FetchOptions = { + method: "test", + headers: [[key, value]], + }; + appendRequestHeader(url, options, key, value); + assert.isDefined(options.headers); + assert.equal((options.headers as string[][]).length, 2); + assert.equal(options.headers[0][0], key); + assert.equal(options.headers[0][1], value); + assert.equal(options.headers[1][0], key); + assert.equal(options.headers[1][1], value); + }); + }); -// describe("generateUUID", () => { -// it("Should return the unique uuid", () => { -// const uuid = generateUUID(); -// assert.equal(uuid.length, 36); -// }); -// }); -// }); + describe("generateUUID", () => { + it("Should return the unique uuid", () => { + const uuid = generateUUID(); + assert.equal(uuid.length, 36); + }); + }); +}); \ No newline at end of file diff --git a/test/development/workload/PageIterator.ts b/test/development/workload/PageIterator.ts index 349b0cd2a..35c42a942 100644 --- a/test/development/workload/PageIterator.ts +++ b/test/development/workload/PageIterator.ts @@ -95,31 +95,32 @@ describe("PageIterator", ()=> { } }).timeout(30 * 1000); - it("setting middleware with pageIterator", async () => { - const middleware = new ChaosHandler(); - const getPageCollection = () => { - return { - value: [], - "@odata.nextLink": "nextURL", - additionalContent: "additional content", - }; - }; - const clientOptions: ClientOptions = { - middleware, - }; - const responseBody = { value: [{ event1: "value1" }, { event2: "value2" }] }; - let counter = 1; - const callback: PageIteratorCallback = (data) => { - assert.equal(data["event" + counter], "value" + counter); - counter++; - return true; - }; - - const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, responseBody)]; - const requestOptions = { middlewareOptions }; - - const client = Client.initWithMiddleware(clientOptions); - const pageIterator = new PageIterator(client, getPageCollection(), callback, requestOptions); - await pageIterator.iterate(); - }); + // TODO - Temporariliy commenting this test. + // it("setting middleware with pageIterator", async () => { + // const middleware = new ChaosHandler(); + // const getPageCollection = () => { + // return { + // value: [], + // "@odata.nextLink": "nextURL", + // additionalContent: "additional content", + // }; + // }; + // const clientOptions: ClientOptions = { + // middleware, + // }; + // const responseBody = { value: [{ event1: "value1" }, { event2: "value2" }] }; + // let counter = 1; + // const callback: PageIteratorCallback = (data) => { + // assert.equal(data["event" + counter], "value" + counter); + // counter++; + // return true; + // }; + + // const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, responseBody)]; + // const requestOptions = { middlewareOptions }; + + // const client = Client.initWithMiddleware(clientOptions); + // const pageIterator = new PageIterator(client, getPageCollection(), callback, requestOptions); + // await pageIterator.iterate(); + // }); }); From 7084038b4d44280761664b5a41d9d9b26e5f4710 Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Fri, 1 Jan 2021 17:11:19 -0800 Subject: [PATCH 07/10] Adding headers to chaoshandleroptions --- package-lock.json | 2 +- package.json | 2 +- src/Version.ts | 2 +- src/middleware/ChaosHandler.ts | 23 ++++---- src/middleware/options/ChaosHandlerOptions.ts | 10 +++- test/common/middleware/ChaosHandler.ts | 12 ++-- test/development/workload/PageIterator.ts | 59 ++++++++++--------- 7 files changed, 62 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 435dde4b8..e1cc4658f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@microsoft/microsoft-graph-client", - "version": "2.2.0-Preview.1", + "version": "2.1.0-Preview.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9e6fb01b4..10da05dce 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "pre-build": "npm run setVersion", "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", "test": "npm run test:cjs && npm run test:esm", - "test:development": "tsc --p test/tsconfig-test-cjs.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch", + "test:development": "tsc --p test/tsconfig-test-cjs.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch --grep PageIterator", "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", "format:css": "prettier --write \"**/*.css\"", "format:html": "prettier --write \"**/*.html\"", diff --git a/src/Version.ts b/src/Version.ts index 13e0e9e67..64101ee23 100644 --- a/src/Version.ts +++ b/src/Version.ts @@ -12,4 +12,4 @@ * @module Version */ -export const PACKAGE_VERSION = "2.2.0-Preview.1"; +export const PACKAGE_VERSION = "2.1.0-Preview.2"; diff --git a/src/middleware/ChaosHandler.ts b/src/middleware/ChaosHandler.ts index 5944cad79..8a4d61817 100644 --- a/src/middleware/ChaosHandler.ts +++ b/src/middleware/ChaosHandler.ts @@ -67,9 +67,9 @@ export class ChaosHandler implements Middleware { * @param {string} requestDate - date of the request * @returns response Header */ - private createResponseHeaders(statusCode: number, requestID: string, requestDate: string) { - const responseHeader: Headers = new Headers(); + private createResponseHeaders(chaosHandlerOptions: ChaosHandlerOptions, requestID: string, requestDate: string) { + const responseHeader: Headers = chaosHandlerOptions.headers ? new Headers(chaosHandlerOptions.headers) : new Headers(); responseHeader.append("Cache-Control", "no-store"); responseHeader.append("request-id", requestID); responseHeader.append("client-request-id", requestID); @@ -77,10 +77,11 @@ export class ChaosHandler implements Middleware { responseHeader.append("Date", requestDate); responseHeader.append("Strict-Transport-Security", ""); - if (statusCode === 429) { + if (chaosHandlerOptions.statusCode === 429) { // throttling case has to have a timeout scenario responseHeader.append("retry-after", "300"); } + return responseHeader; } @@ -94,14 +95,14 @@ export class ChaosHandler implements Middleware { * @param {any?} requestBody - the request body to be returned for the request * @returns response body */ - private createResponseBody(statusCode: number, statusMessage: string, requestID: string, requestDate: string, responseBody?: any) { - if (responseBody) { - return responseBody; + private createResponseBody(options: ChaosHandlerOptions, requestID: string, requestDate: string) { + if (options.responseBody) { + return options.responseBody; } let body: any; - if (statusCode >= 400) { - const codeMessage: string = httpStatusCode[statusCode]; - const errMessage: string = statusMessage; + if (options.statusCode >= 400) { + const codeMessage: string = httpStatusCode[options.statusCode]; + const errMessage: string = options.statusMessage; body = { error: { @@ -135,8 +136,8 @@ export class ChaosHandler implements Middleware { requestID = generateUUID(); requestDate = new Date(); - responseHeader = this.createResponseHeaders(chaosHandlerOptions.statusCode, requestID, requestDate.toString()); - responseBody = this.createResponseBody(chaosHandlerOptions.statusCode, chaosHandlerOptions.statusMessage, requestID, requestDate.toString(), chaosHandlerOptions.responseBody); + responseHeader = this.createResponseHeaders(chaosHandlerOptions, requestID, requestDate.toString()); + responseBody = this.createResponseBody(chaosHandlerOptions, requestID, requestDate.toString()); const init: any = { url: requestURL, status: chaosHandlerOptions.statusCode, statusText: chaosHandlerOptions.statusMessage, headers: responseHeader }; context.response = new Response(responseBody, init); } catch (error) { diff --git a/src/middleware/options/ChaosHandlerOptions.ts b/src/middleware/options/ChaosHandlerOptions.ts index 836a1550d..807e72289 100644 --- a/src/middleware/options/ChaosHandlerOptions.ts +++ b/src/middleware/options/ChaosHandlerOptions.ts @@ -55,6 +55,13 @@ export class ChaosHandlerOptions implements MiddlewareOptions { */ public responseBody: any; + /** + * The response body to be returned in the response + * + * @public + */ + public headers: Headers; + /** * @public * @constructor @@ -66,12 +73,13 @@ export class ChaosHandlerOptions implements MiddlewareOptions { * @param {any?} responseBody - The response body to be returned in the response * @returns An instance of ChaosHandlerOptions */ - public constructor(chaosStrategy: ChaosStrategy = ChaosStrategy.RANDOM, statusMessage: string = "Some error Happened", statusCode?: number, chaosPercentage?: number, responseBody?: any) { + public constructor(chaosStrategy: ChaosStrategy = ChaosStrategy.RANDOM, statusMessage: string = "Some error Happened", statusCode?: number, chaosPercentage?: number, responseBody?: any, headers?:Headers) { this.chaosStrategy = chaosStrategy; this.statusCode = statusCode; this.statusMessage = statusMessage; this.chaosPercentage = chaosPercentage !== undefined ? chaosPercentage : 10; this.responseBody = responseBody; + this.headers = headers if (this.chaosPercentage > 100) { throw new Error("Error Pecentage can not be more than 100"); } diff --git a/test/common/middleware/ChaosHandler.ts b/test/common/middleware/ChaosHandler.ts index 132463305..aadeb0514 100644 --- a/test/common/middleware/ChaosHandler.ts +++ b/test/common/middleware/ChaosHandler.ts @@ -27,24 +27,28 @@ describe("ChaosHandler.ts", () => { describe("createResponseHeaders", () => { it("Should have request-id for every random statusCode", () => { - const responseHeader = chaosHandler["createResponseHeaders"](204, "xxxxxxxxxxxxxxxx", new Date().toString()); + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "testStatusCode", 204); + const responseHeader = chaosHandler["createResponseHeaders"](options, "xxxxxxxxxxxxxxxx", new Date().toString()); assert.isDefined(responseHeader.get("request-id")); }); it("Should have retry-after for 429 case", () => { - const responseHeader = chaosHandler["createResponseHeaders"](429, "xxxxxxxxxxxxxxxx", new Date().toString()); + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "testStatusCode", 429); + const responseHeader = chaosHandler["createResponseHeaders"](options, "xxxxxxxxxxxxxxxx", new Date().toString()); assert.isDefined(responseHeader.get("retry-after")); }); }); describe("createResponseBody", () => { it("Should return error in response body for error scenarios", () => { - const responseBody = chaosHandler["createResponseBody"](404, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Not Found", 404); + const responseBody = chaosHandler["createResponseBody"](options, "xxxxxxxxxxxxxx", new Date().toString()); assert.isDefined(responseBody["error"]); }); it("Should return empty response body for success scenarios", () => { - const responseBody = chaosHandler["createResponseBody"](200, "Not Found", "xxxxxxxxxxxxxx", new Date().toString()); + const options = new ChaosHandlerOptions(ChaosStrategy.MANUAL, "Not Found", 200); + const responseBody = chaosHandler["createResponseBody"](options, "xxxxxxxxxxxxxx", new Date().toString()); assert.equal(Object.keys(responseBody).length, 0); }); }); diff --git a/test/development/workload/PageIterator.ts b/test/development/workload/PageIterator.ts index 35c42a942..ede92a9df 100644 --- a/test/development/workload/PageIterator.ts +++ b/test/development/workload/PageIterator.ts @@ -11,12 +11,13 @@ import { assert } from "chai"; import { getClient } from "../test-helper"; -import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; +import { CgithaosHandler } from "../../../src/middleware/ChaosHandler"; import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; + import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; -import { GraphRequestOptions, PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; import { Client, ClientOptions } from "../../../src"; +import { GraphRequestOptions, PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; const client = getClient(); describe("PageIterator", ()=> { const pstHeader = { Prefer: 'outlook.timezone= "pacific standard time"' }; @@ -96,31 +97,31 @@ describe("PageIterator", ()=> { }).timeout(30 * 1000); // TODO - Temporariliy commenting this test. - // it("setting middleware with pageIterator", async () => { - // const middleware = new ChaosHandler(); - // const getPageCollection = () => { - // return { - // value: [], - // "@odata.nextLink": "nextURL", - // additionalContent: "additional content", - // }; - // }; - // const clientOptions: ClientOptions = { - // middleware, - // }; - // const responseBody = { value: [{ event1: "value1" }, { event2: "value2" }] }; - // let counter = 1; - // const callback: PageIteratorCallback = (data) => { - // assert.equal(data["event" + counter], "value" + counter); - // counter++; - // return true; - // }; - - // const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, responseBody)]; - // const requestOptions = { middlewareOptions }; - - // const client = Client.initWithMiddleware(clientOptions); - // const pageIterator = new PageIterator(client, getPageCollection(), callback, requestOptions); - // await pageIterator.iterate(); - // }); + it("setting middleware with pageIterator", async () => { + const middleware = new ChaosHandler(); + const getPageCollection = () => { + return { + value: [], + "@odata.nextLink": "nextURL", + additionalContent: "additional content", + }; + }; + const clientOptions: ClientOptions = { + middleware, + }; + const responseBody = { value: [{ event1: "value1" }, { event2: "value2" }] }; + let counter = 1; + const callback: PageIteratorCallback = (data) => { + assert.equal(data["event" + counter], "value" + counter); + counter++; + return true; + }; + + const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, JSON.stringify(responseBody), new Headers({ 'Content-Type' : 'application/json','content-length':'100'}))]; + const requestOptions = { middlewareOptions }; + + const client = Client.initWithMiddleware(clientOptions); + const pageIterator = new PageIterator(client, getPageCollection(), callback, requestOptions); + await pageIterator.iterate(); + }); }); From 5d40cdc836f114d51c560b130fab6769c9e15921 Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Fri, 1 Jan 2021 20:26:26 -0800 Subject: [PATCH 08/10] Adding documentation --- .gitignore | 2 +- .huskyrc | 2 +- .prettierignore | 6 +- .vscode/launch.json | 10 +- lib/.npmignore | 2 +- package.json | 190 +++++++++--------- samples/node/README.md | 5 +- src/middleware/ChaosHandler.ts | 21 +- src/middleware/options/ChaosHandlerOptions.ts | 6 +- test/Tests.md | 15 ++ test/browser/BrowserTests.md | 6 + .../common}/core/GraphClientError.ts | 2 +- test/common/core/HTTPClient.ts | 8 - test/development/DevelopmentTests.md | 10 + test/development/secrets.ts | 2 +- test/development/workload/OneNote.ts | 4 +- test/development/workload/PageIterator.ts | 11 +- test/node/NodeTests.md | 6 + ...js.json => tsconfig-test-development.json} | 2 +- test/tsconfig-test-es.json | 11 - tsconfig-base.json | 7 - 21 files changed, 167 insertions(+), 161 deletions(-) create mode 100644 test/Tests.md create mode 100644 test/browser/BrowserTests.md rename {spec => test/common}/core/GraphClientError.ts (95%) create mode 100644 test/development/DevelopmentTests.md create mode 100644 test/node/NodeTests.md rename test/{tsconfig-test-cjs.json => tsconfig-test-development.json} (83%) delete mode 100644 test/tsconfig-test-es.json diff --git a/.gitignore b/.gitignore index 0f27427cf..94c058b21 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,6 @@ samples/browser/src/graph-js-sdk.js samples/browser/src/graph-es-sdk.js -spec/**/secrets.ts +test/development/secrets.ts .nyc_output/* \ No newline at end of file diff --git a/.huskyrc b/.huskyrc index b0c6b7030..d8d81fd78 100644 --- a/.huskyrc +++ b/.huskyrc @@ -1,5 +1,5 @@ { "hooks": { - "pre-commit": "npm run build" + "pre-commit": "npm run pre-build && git add src/Version.ts && lint-staged && npm run lint && npm run test" } } diff --git a/.prettierignore b/.prettierignore index d29ebee2a..1b023f31b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,6 +6,6 @@ src/**/*.js src/**/*.js.map src/**/*.d.ts -spec/**/*.js -spec/**/*.js.map -spec/**/*.d.ts +test/**/*.js +test/**/*.js.map +test/**/*.d.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index 299a3c032..e56321f36 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,7 @@ "request": "launch", "name": "Run Content tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": ["${workspaceRoot}/lib/spec/content/*.js"], + "args": ["${workspaceRoot}/lib/test/common/**/*.js"], "cwd": "${workspaceRoot}", "preLaunchTask": "Run Compile", "outFiles": [], @@ -29,7 +29,7 @@ "request": "launch", "name": "Run Core tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": ["${workspaceRoot}/lib/spec/core/*.js"], + "args": ["${workspaceRoot}/lib/test/common/core/*.js"], "cwd": "${workspaceRoot}", "preLaunchTask": "Run Compile", "outFiles": [], @@ -40,7 +40,7 @@ "request": "launch", "name": "Run Middleware tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": ["${workspaceRoot}/lib/spec/middleware/*.js"], + "args": ["${workspaceRoot}/lib/test/common/middleware/*.js"], "cwd": "${workspaceRoot}", "preLaunchTask": "Run Compile", "outFiles": [], @@ -51,7 +51,7 @@ "request": "launch", "name": "Run Tasks tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": ["${workspaceRoot}/lib/spec/tasks/*.js"], + "args": ["${workspaceRoot}/lib/test/common/tasks/*.js"], "cwd": "${workspaceRoot}", "preLaunchTask": "Run Compile", "outFiles": [], @@ -62,7 +62,7 @@ "request": "launch", "name": "Run Workload tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "args": ["${workspaceRoot}/spec/development/workload/*.js"], + "args": ["${workspaceRoot}/test/common/development/workload/*.js"], "cwd": "${workspaceRoot}", "preLaunchTask": "Run Compile", "outFiles": [], diff --git a/lib/.npmignore b/lib/.npmignore index d013729d2..51c25aaf4 100644 --- a/lib/.npmignore +++ b/lib/.npmignore @@ -1,2 +1,2 @@ .npmignore -spec/ \ No newline at end of file +test/ \ No newline at end of file diff --git a/package.json b/package.json index 10da05dce..5f1b5471e 100644 --- a/package.json +++ b/package.json @@ -1,96 +1,96 @@ { - "name": "@microsoft/microsoft-graph-client", - "version": "2.1.0-Preview.2", - "description": "Microsoft Graph Client Library", - "license": "MIT", - "main": "lib/src/index.js", - "module": "lib/es/index.js", - "typings": "lib/src/index", - "files": [ - "lib/", - "src/" - ], - "types": "./lib/src/index.d.ts", - "dependencies": { - "@babel/runtime": "^7.4.4", - "esm": "^3.2.25", - "fs": "0.0.1-security", - "karma": "^5.2.3", - "tslib": "^1.9.3" - }, - "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/plugin-transform-runtime": "^7.4.4", - "@babel/preset-env": "^7.4.4", - "@istanbuljs/nyc-config-typescript": "^1.0.1", - "@microsoft/microsoft-graph-types": "^1.28.0", - "@types/chai": "^4.2.14", - "@types/mocha": "^5.2.7", - "@types/node": "^12.0.10", - "chai": "^4.2.0", - "form-data": "^2.3.3", - "gulp": "^4.0.2", - "husky": "^2.2.0", - "isomorphic-fetch": "^3.0.0", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^2.1.0", - "karma-mocha": "^2.0.1", - "karma-typescript": "^5.2.0", - "lint-staged": "^8.1.5", - "mocha": "^6.2.3", - "msal": "^1.0.0", - "nyc": "^15.1.0", - "prettier": "^1.17.0", - "rollup": "^1.10.1", - "rollup-plugin-babel": "^4.3.2", - "rollup-plugin-commonjs": "^10.0.1", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-terser": "^5.0.0", - "source-map-support": "^0.5.19", - "ts-node": "^9.0.0", - "tslint": "^5.16.0", - "tslint-config-prettier": "^1.18.0", - "typescript": "^3.4.5", - "uglify-es": "^3.3.9" - }, - "scripts": { - "setVersion": "gulp setVersion", - "build:es": "tsc --p tsconfig-es.json", - "build:cjs": "tsc --p tsconfig-cjs.json", - "pre-build": "npm run setVersion", - "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", - "test": "npm run test:cjs && npm run test:esm", - "test:development": "tsc --p test/tsconfig-test-cjs.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch --grep PageIterator", - "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", - "format:css": "prettier --write \"**/*.css\"", - "format:html": "prettier --write \"**/*.html\"", - "format:js": "prettier --write \"**/*.js\"", - "format:json": "prettier --write \"**/*.json\"", - "format:md": "prettier --write \"**/*.md\"", - "format:rc": "prettier --write --parser json \"**/.*rc\"", - "format:ts": "prettier --write \"**/*.ts\"", - "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", - "prepack": "npm install && npm run build && npm run test", - "test:coverage": "TS_NODE_PROJECT='./tsconfig-cjs.json' nyc mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts && mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts", - "test:cjs": "tsc -p tsconfig-cjs.json && mocha 'lib/test/common/**/*.js' --require isomorphic-fetch && mocha 'lib/test/node/**/*.js' --require isomorphic-fetch", - "test:esm": "tsc -p tsconfig-es.json && mocha 'lib/es/test/common/**/*.js' --require esm --require isomorphic-fetch && mocha 'lib/es/test/node/**/*.js' --require esm --require isomorphic-fetch", - "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" - }, - "nyc": { - "all": true, - "cache": false, - "exclude": [ - "samples/", - "*.js", - "lib/" - ], - "include": [ - "src/" - ] - } -} \ No newline at end of file + "name": "@microsoft/microsoft-graph-client", + "version": "2.1.0-Preview.2", + "description": "Microsoft Graph Client Library", + "license": "MIT", + "main": "lib/src/index.js", + "module": "lib/es/index.js", + "typings": "lib/src/index", + "files": [ + "lib/", + "src/" + ], + "types": "./lib/src/index.d.ts", + "dependencies": { + "@babel/runtime": "^7.4.4", + "tslib": "^1.9.3" + }, + "devDependencies": { + "@babel/core": "^7.4.4", + "@babel/plugin-transform-runtime": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@microsoft/microsoft-graph-types": "^1.28.0", + "@types/chai": "^4.2.14", + "@types/mocha": "^5.2.7", + "@types/node": "^12.0.10", + "chai": "^4.2.0", + "form-data": "^2.3.3", + "gulp": "^4.0.2", + "husky": "^2.2.0", + "isomorphic-fetch": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^2.1.0", + "karma-mocha": "^2.0.1", + "karma-typescript": "^5.2.0", + "lint-staged": "^8.1.5", + "mocha": "^6.2.3", + "msal": "^1.0.0", + "nyc": "^15.1.0", + "prettier": "^1.17.0", + "rollup": "^1.10.1", + "rollup-plugin-babel": "^4.3.2", + "rollup-plugin-commonjs": "^10.0.1", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^5.0.0", + "source-map-support": "^0.5.19", + "ts-node": "^9.0.0", + "tslint": "^5.16.0", + "tslint-config-prettier": "^1.18.0", + "typescript": "^3.4.5", + "uglify-es": "^3.3.9", + "esm": "^3.2.25", + "fs": "0.0.1-security", + "karma": "^5.2.3" + }, + "scripts": { + "setVersion": "gulp setVersion", + "build:es": "tsc --p tsconfig-es.json", + "build:cjs": "tsc --p tsconfig-cjs.json", + "pre-build": "npm run setVersion", + "build": "npm run pre-build && npm run build:cjs && npm run build:es && rollup -c", + "test": "npm run test:cjs && npm run test:esm", + "test:development": "tsc --p test/tsconfig-test-development.json && mocha 'lib/test/development/**/*.js' --require isomorphic-fetch", + "lint": "tslint --project ./tsconfig-cjs.json -c tslint.json", + "format:css": "prettier --write \"**/*.css\"", + "format:html": "prettier --write \"**/*.html\"", + "format:js": "prettier --write \"**/*.js\"", + "format:json": "prettier --write \"**/*.json\"", + "format:md": "prettier --write \"**/*.md\"", + "format:rc": "prettier --write --parser json \"**/.*rc\"", + "format:ts": "prettier --write \"**/*.ts\"", + "format": "npm run format:css && npm run format:html && npm run format:js && npm run format:json && npm run format:md && npm run format:rc && npm run format:ts", + "prepack": "npm install && npm run build && npm run test", + "test:coverage": "TS_NODE_PROJECT='./tsconfig-cjs.json' nyc mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts && mocha --require isomorphic-fetch -r ts-node/register test/common/**/*.ts", + "test:cjs": "tsc -p tsconfig-cjs.json && mocha 'lib/test/common/**/*.js' --require isomorphic-fetch && mocha 'lib/test/node/**/*.js' --require isomorphic-fetch", + "test:esm": "tsc -p tsconfig-es.json && mocha 'lib/es/test/common/**/*.js' --require esm --require isomorphic-fetch && mocha 'lib/es/test/node/**/*.js' --require esm --require isomorphic-fetch", + "karma": "karma start --single-run --browsers ChromeHeadless karma.conf.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoftgraph/msgraph-sdk-javascript.git" + }, + "nyc": { + "all": true, + "cache": false, + "exclude": [ + "samples/", + "*.js", + "lib/" + ], + "include": [ + "src/" + ] + } +} diff --git a/samples/node/README.md b/samples/node/README.md index a72c86be3..fb002d181 100644 --- a/samples/node/README.md +++ b/samples/node/README.md @@ -7,9 +7,8 @@ You can get an access token by doing the following: 1. Rename [secrets.sample.json](./secrets.sample.json) to secrets.json 2. Go to Graph Explorer. 3. Login with the account you want to use to run the node samples. -4. Open the F12 dev tools. -5. Type tokenPlease() into the console to get an access token. -6. Copy the access token and put it into the secrets.json file and save the file. +4. Click on the Access token tab option to get an access token. +5. Copy the access token and put it into the secrets.json file and save the file. ## Run Sample diff --git a/src/middleware/ChaosHandler.ts b/src/middleware/ChaosHandler.ts index 8a4d61817..1945e1e69 100644 --- a/src/middleware/ChaosHandler.ts +++ b/src/middleware/ChaosHandler.ts @@ -62,13 +62,12 @@ export class ChaosHandler implements Middleware { /** * Generates responseHeader * @private - * @param {number} statusCode - the status code to be returned for the request + * @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object * @param {string} requestID - request id * @param {string} requestDate - date of the request * @returns response Header */ private createResponseHeaders(chaosHandlerOptions: ChaosHandlerOptions, requestID: string, requestDate: string) { - const responseHeader: Headers = chaosHandlerOptions.headers ? new Headers(chaosHandlerOptions.headers) : new Headers(); responseHeader.append("Cache-Control", "no-store"); responseHeader.append("request-id", requestID); @@ -88,21 +87,19 @@ export class ChaosHandler implements Middleware { /** * Generates responseBody * @private - * @param {number} statusCode - the status code to be returned for the request - * @param {string} statusMessage - the status message to be returned for the request + * @param {ChaosHandlerOptions} options - The ChaosHandlerOptions object * @param {string} requestID - request id * @param {string} requestDate - date of the request - * @param {any?} requestBody - the request body to be returned for the request - * @returns response body + * * @returns response body */ - private createResponseBody(options: ChaosHandlerOptions, requestID: string, requestDate: string) { - if (options.responseBody) { - return options.responseBody; + private createResponseBody(chaosHandlerOptions: ChaosHandlerOptions, requestID: string, requestDate: string) { + if (chaosHandlerOptions.responseBody) { + return chaosHandlerOptions.responseBody; } let body: any; - if (options.statusCode >= 400) { - const codeMessage: string = httpStatusCode[options.statusCode]; - const errMessage: string = options.statusMessage; + if (chaosHandlerOptions.statusCode >= 400) { + const codeMessage: string = httpStatusCode[chaosHandlerOptions.statusCode]; + const errMessage: string = chaosHandlerOptions.statusMessage; body = { error: { diff --git a/src/middleware/options/ChaosHandlerOptions.ts b/src/middleware/options/ChaosHandlerOptions.ts index 807e72289..eb0bc8517 100644 --- a/src/middleware/options/ChaosHandlerOptions.ts +++ b/src/middleware/options/ChaosHandlerOptions.ts @@ -56,7 +56,7 @@ export class ChaosHandlerOptions implements MiddlewareOptions { public responseBody: any; /** - * The response body to be returned in the response + * The response headers to be returned in the response * * @public */ @@ -73,13 +73,13 @@ export class ChaosHandlerOptions implements MiddlewareOptions { * @param {any?} responseBody - The response body to be returned in the response * @returns An instance of ChaosHandlerOptions */ - public constructor(chaosStrategy: ChaosStrategy = ChaosStrategy.RANDOM, statusMessage: string = "Some error Happened", statusCode?: number, chaosPercentage?: number, responseBody?: any, headers?:Headers) { + public constructor(chaosStrategy: ChaosStrategy = ChaosStrategy.RANDOM, statusMessage: string = "Some error Happened", statusCode?: number, chaosPercentage?: number, responseBody?: any, headers?: Headers) { this.chaosStrategy = chaosStrategy; this.statusCode = statusCode; this.statusMessage = statusMessage; this.chaosPercentage = chaosPercentage !== undefined ? chaosPercentage : 10; this.responseBody = responseBody; - this.headers = headers + this.headers = headers; if (this.chaosPercentage > 100) { throw new Error("Error Pecentage can not be more than 100"); } diff --git a/test/Tests.md b/test/Tests.md new file mode 100644 index 000000000..18e0e8355 --- /dev/null +++ b/test/Tests.md @@ -0,0 +1,15 @@ +The /test folder consists of unit tests written using the following testing tools + +- mocha +- chai +- karma +- @istanbuljs/nyc-config-typescript + +Scripts used + +- `npm run test` - To run unit tests in test/common and test/node. +- `npm run test:cjs` - To run unit tests in test/common and test/node compiled as CommonJS modules. +- `npm run test:esm` - To run unit tests in test/common and test/node compiled as ESM modules. +- `npm run test:development` - To run tests in test/development folder. +- `npm run test:coverage` - To get the test code coverage after running the tests. +- `npm run karma` - To run the units tests in test/common and test/browser folders on a headless browser. diff --git a/test/browser/BrowserTests.md b/test/browser/BrowserTests.md new file mode 100644 index 000000000..90b4ecf9b --- /dev/null +++ b/test/browser/BrowserTests.md @@ -0,0 +1,6 @@ +This folder contains unit tests which are browser-specific. Example - The tests in [GraphResponseHandler](./core/GraphResponseHandler.ts) requires the DOMParser which is a browser functionality. + +Karma is used for testing the code in browsers. To run the unit tests using karma run the following steps - + +- Run the script `npm install`. +- Run the script `npm run karma`. diff --git a/spec/core/GraphClientError.ts b/test/common/core/GraphClientError.ts similarity index 95% rename from spec/core/GraphClientError.ts rename to test/common/core/GraphClientError.ts index b25569348..2c017f6e8 100644 --- a/spec/core/GraphClientError.ts +++ b/test/common/core/GraphClientError.ts @@ -7,7 +7,7 @@ import { assert } from "chai"; -import { GraphClientError } from "../../src/GraphClientError"; +import { GraphClientError } from "../../../src/GraphClientError"; describe("GraphClientError", () => { const message = "test"; diff --git a/test/common/core/HTTPClient.ts b/test/common/core/HTTPClient.ts index 943ab1dc3..18312e8fe 100644 --- a/test/common/core/HTTPClient.ts +++ b/test/common/core/HTTPClient.ts @@ -36,14 +36,6 @@ describe("HTTPClient.ts", () => { } }); - it("Should throw an error if middleware is passed as null", () => { - try { - const client = new HTTPClient(null); - } catch (error) { - assert.equal(error.name, "InvalidMiddlewareChain"); - } - }); - it("Should throw an error if middleware is passed as an empty array", () => { try { const client = new HTTPClient(...[]); diff --git a/test/development/DevelopmentTests.md b/test/development/DevelopmentTests.md new file mode 100644 index 000000000..b8dc740a1 --- /dev/null +++ b/test/development/DevelopmentTests.md @@ -0,0 +1,10 @@ +This folder contains test which are real-time. + +Following are the steps to run the tests in the test/development folder. + +1. Rename the [secrets.sample.ts](../secrets.sample.ts) to secrets.ts +2. Go to Graph Explorer. +3. Login with the account you want to use to run the unit tests. +4. Click on the Access token tab option to get an access token. +5. Copy the access token and put it into the secrets.ts file and save. +6. Run the script `npm run test:development`. diff --git a/test/development/secrets.ts b/test/development/secrets.ts index 432df72b8..e1f5a399f 100644 --- a/test/development/secrets.ts +++ b/test/development/secrets.ts @@ -4,4 +4,4 @@ * * To use authentication based(making real requests to the graph service) testing populate this access token's value and rename this file as secrets.ts */ -export const AccessToken = "eyJ0eXAiOiJKV1QiLCJub25jZSI6IkVzV1p6VVk0bXhVR0ZSczQ0WTNxM1YtQTRmSWRxMGgyLUhRbVI0Q1NNTEUiLCJyaCI6IjAuQWdBQVFuck0xRVE4ODBTcTgyWmpBcTZyQ0xYSWk5NzUyYkZJcUsyM1NOcHlVR1JaQUJVLiIsImFsZyI6IlJTMjU2IiwieDV0IjoiNU9mOVA1RjlnQ0N3Q21GMkJPSEh4RERRLURrIiwia2lkIjoiNU9mOVA1RjlnQ0N3Q21GMkJPSEh4RERRLURrIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9kNGNjN2E0Mi0zYzQ0LTQ0ZjMtYWFmMy02NjYzMDJhZWFiMDgvIiwiaWF0IjoxNjA5Mjk5MzE3LCJuYmYiOjE2MDkyOTkzMTcsImV4cCI6MTYwOTMwMzIxNywiYWNjdCI6MCwiYWNyIjoiMSIsImFjcnMiOlsidXJuOnVzZXI6cmVnaXN0ZXJzZWN1cml0eWluZm8iLCJ1cm46bWljcm9zb2Z0OnJlcTEiLCJ1cm46bWljcm9zb2Z0OnJlcTIiLCJ1cm46bWljcm9zb2Z0OnJlcTMiLCJjMSIsImMyIiwiYzMiLCJjNCIsImM1IiwiYzYiLCJjNyIsImM4IiwiYzkiLCJjMTAiLCJjMTEiLCJjMTIiLCJjMTMiLCJjMTQiLCJjMTUiLCJjMTYiLCJjMTciLCJjMTgiLCJjMTkiLCJjMjAiLCJjMjEiLCJjMjIiLCJjMjMiLCJjMjQiLCJjMjUiXSwiYWlvIjoiRTJKZ1lKamZ2SE5oc20yaUZxdHVoTG5EK2U2YytMQ00vV1dXeHN3L054dVhhRzdJNXdZQSIsImF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0C4F41WjoHgvZgvSjcQ0RJJNsG8xg"; diff --git a/test/development/workload/OneNote.ts b/test/development/workload/OneNote.ts index 2bcddc1cd..c7774ed44 100644 --- a/test/development/workload/OneNote.ts +++ b/test/development/workload/OneNote.ts @@ -71,7 +71,7 @@ describe("OneNote", function() { }); it("Create a OneNote page with html page content", async () => { const formData = new FormData(); - formData.append("Presentation", fs.createReadStream("./spec/sample_files/onenotepage.html")); + formData.append("Presentation", fs.createReadStream("./test/sample_files/onenotepage.html")); const json = await client.api(`/me/onenote/sections/${section.id}/pages`).post(formData); const createdPageFromHTML = json as OnenotePage; @@ -96,7 +96,7 @@ describe("OneNote", function() { it("create a OneNote page with html page content and file attachment", async () => { try { const formData = new FormData(); - formData.append("Presentation", fs.createReadStream("./spec/sample_files/onenotepage_fileattachment.html")); + formData.append("Presentation", fs.createReadStream("./test/sample_files/onenotepage_fileattachment.html")); formData.append("fileBlock1", fs.createReadStream("./sample.png")); const json = await client.api(`/me/onenote/sections/${section.id}/pages`).post(formData); const createdPageFromHTML = json as OnenotePage; diff --git a/test/development/workload/PageIterator.ts b/test/development/workload/PageIterator.ts index ede92a9df..cb1098ce1 100644 --- a/test/development/workload/PageIterator.ts +++ b/test/development/workload/PageIterator.ts @@ -8,10 +8,9 @@ import { Event } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; - import { getClient } from "../test-helper"; -import { CgithaosHandler } from "../../../src/middleware/ChaosHandler"; +import { ChaosHandler } from "../../../src/middleware/ChaosHandler"; import { ChaosHandlerOptions } from "../../../src/middleware/options/ChaosHandlerOptions"; import { ChaosStrategy } from "../../../src/middleware/options/ChaosStrategy"; @@ -19,13 +18,13 @@ import { Client, ClientOptions } from "../../../src"; import { GraphRequestOptions, PageIterator, PageIteratorCallback } from "../../../src/tasks/PageIterator"; const client = getClient(); -describe("PageIterator", ()=> { +describe("PageIterator", () => { const pstHeader = { Prefer: 'outlook.timezone= "pacific standard time"' }; const utc = "UTC"; const pst = "Pacific Standard Time"; const testURL = "/me/events"; - before(async function () { + before(async function() { this.timeout(20000); const response = await client.api(testURL + "?count=true").get(); @@ -96,7 +95,7 @@ describe("PageIterator", ()=> { } }).timeout(30 * 1000); - // TODO - Temporariliy commenting this test. + // TODO - Temporariliy commenting this test. it("setting middleware with pageIterator", async () => { const middleware = new ChaosHandler(); const getPageCollection = () => { @@ -117,7 +116,7 @@ describe("PageIterator", ()=> { return true; }; - const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, JSON.stringify(responseBody), new Headers({ 'Content-Type' : 'application/json','content-length':'100'}))]; + const middlewareOptions = [new ChaosHandlerOptions(ChaosStrategy.MANUAL, "middleware options for pageIterator", 200, 0, JSON.stringify(responseBody), new Headers({ "Content-Type": "application/json", "content-length": "100" }))]; const requestOptions = { middlewareOptions }; const client = Client.initWithMiddleware(clientOptions); diff --git a/test/node/NodeTests.md b/test/node/NodeTests.md new file mode 100644 index 000000000..e1b38d886 --- /dev/null +++ b/test/node/NodeTests.md @@ -0,0 +1,6 @@ +This folder contains unit tests which are node-specific. + +Karma is used for testing the code in browsers. To run the unit tests using karma run the following steps - + +- Run the script npm install +- Run the script npm run test diff --git a/test/tsconfig-test-cjs.json b/test/tsconfig-test-development.json similarity index 83% rename from test/tsconfig-test-cjs.json rename to test/tsconfig-test-development.json index e2e92ebd2..70c6c27ca 100644 --- a/test/tsconfig-test-cjs.json +++ b/test/tsconfig-test-development.json @@ -8,5 +8,5 @@ "lib": ["dom", "esnext"], "outDir": "../lib/" }, - "include": ["./development/","../src/"] + "include": ["./development/", "../src/"] } diff --git a/test/tsconfig-test-es.json b/test/tsconfig-test-es.json deleted file mode 100644 index f9e0f1e73..000000000 --- a/test/tsconfig-test-es.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../tsconfig-base.json", - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": ["dom", "esnext"], - "rootDir": ".", - "outDir": "lib/es" - }, - "include": ["test/development"] -} diff --git a/tsconfig-base.json b/tsconfig-base.json index bd470bb72..bcd34dddb 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -7,12 +7,5 @@ "removeComments": false, "sourceMap": true, "declaration": true - }, - "ts-node": { - "ignore": ["*.d.ts"], - "compilerOptions": { - "target": "es6", - "module": "ES6" - } } } From fdcb113fd45594b9e55acdbe03fe2e750d9212ac Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Fri, 1 Jan 2021 20:43:01 -0800 Subject: [PATCH 09/10] Delete files and format --- .gitignore | 5 ----- CONTRIBUTING.md | 5 ++--- README.md | 3 +-- src/TestInclusion.ts | 17 ----------------- test/common/middleware/MiddlewareUtil.ts | 7 ++----- test/development/secrets.ts | 7 ------- test/development/workload/open-extensions.ts | 2 +- test/development/workload/users.ts | 1 - test/node/content/BatchRequestContent.ts | 3 +-- tsconfig-cjs.json | 2 +- 10 files changed, 8 insertions(+), 44 deletions(-) delete mode 100644 src/TestInclusion.ts delete mode 100644 test/development/secrets.ts diff --git a/.gitignore b/.gitignore index 94c058b21..98154ad58 100644 --- a/.gitignore +++ b/.gitignore @@ -14,16 +14,11 @@ npm-debug.log /lib/* !/lib/.npmignore -src/**/*.js -src/**/*.js.map -src/**/*.d.ts - samples/node/secrets.json samples/browser/src/secrets.js samples/browser/src/graph-js-sdk.js samples/browser/src/graph-es-sdk.js - test/development/secrets.ts .nyc_output/* \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a2f6c5bb..9dd15dce2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,10 +114,9 @@ npm install To edit files, open them in an editor of your choice and modify them. To create a new file, use the editor of your choice and save the new file in the appropriate location in your local copy of the repository. While working, save your work frequently. -*Note: Make sure to add unit tests to validate you changes.* +_Note: Make sure to add unit tests to validate you changes._ -Once you have done with your changes, You have to build and test your changes -To build the library run, +Once you have done with your changes, You have to build and test your changes To build the library run, ```cmd npm run build diff --git a/README.md b/README.md index 94c25c7a5..bb840f42c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ Refer devDependencies in [package.json](./package.json) for the compatible msal ``` ```typescript - // Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options const msalConfig = { auth: { @@ -97,7 +96,7 @@ npm install msal@ import { UserAgentApplication } from "msal"; import { ImplicitMSALAuthenticationProvider } from "@microsoft/microsoft-graph-client/lib/src/ImplicitMSALAuthenticationProvider"; -import { MSALAuthenticationProviderOptions } from '@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProviderOptions'; +import { MSALAuthenticationProviderOptions } from "@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProviderOptions"; // An Optional options for initializing the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics#configuration-options const msalConfig = { diff --git a/src/TestInclusion.ts b/src/TestInclusion.ts deleted file mode 100644 index ef3b82997..000000000 --- a/src/TestInclusion.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { FetchOptions } from "./IFetchOptions"; -import { MiddlewareControl } from "./middleware/MiddlewareControl"; - -/** - * @interface - * @property {RequestInfo} request - The request url string or the Request instance - * @property {FetchOptions} [options] - The options for the request - * @property {Response} [response] - The response content - * @property {MiddlewareControl} [middlewareControl] - The options for the middleware chain - */ - -export interface TestInclusion { - request: RequestInfo; - options?: FetchOptions; - response?: Response; - middlewareControl?: MiddlewareControl; -} diff --git a/test/common/middleware/MiddlewareUtil.ts b/test/common/middleware/MiddlewareUtil.ts index d1ccd8973..6d494bef8 100644 --- a/test/common/middleware/MiddlewareUtil.ts +++ b/test/common/middleware/MiddlewareUtil.ts @@ -63,10 +63,7 @@ describe("MiddlewareUtil.ts", async () => { it("Should get header from array of headers", () => { const options: FetchOptions = { method: "test", - headers: [ - ["version", "version"], - [key, value], - ], + headers: [["version", "version"], [key, value]], }; const headerValue: string = getRequestHeader(url, options, key); assert.equal(headerValue, value); @@ -342,4 +339,4 @@ describe("MiddlewareUtil.ts", async () => { assert.equal(uuid.length, 36); }); }); -}); \ No newline at end of file +}); diff --git a/test/development/secrets.ts b/test/development/secrets.ts deleted file mode 100644 index e1f5a399f..000000000 --- a/test/development/secrets.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @file - * Defines access token exporting structure - * - * To use authentication based(making real requests to the graph service) testing populate this access token's value and rename this file as secrets.ts - */ -export const AccessToken = "eyJ0eXAiOiJKV1QiLCJub25jZSI6IkVJMjE3VDVtdlNWWnlsVHF4QUxPSFNUc0x6V0prOVN6U0o1SUNNc1BkQWsiLCJyaCI6IjAuQWdBQVFuck0xRVE4ODBTcTgyWmpBcTZyQ0xYSWk5NzUyYkZJcUsyM1NOcHlVR1JaQUJVLiIsImFsZyI6IlJTMjU2IiwieDV0IjoiNU9mOVA1RjlnQ0N3Q21GMkJPSEh4RERRLURrIiwia2lkIjoiNU9mOVA1RjlnQ0N3Q21GMkJPSEh4RERRLURrIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9kNGNjN2E0Mi0zYzQ0LTQ0ZjMtYWFmMy02NjYzMDJhZWFiMDgvIiwiaWF0IjoxNjA5NTU4OTI0LCJuYmYiOjE2MDk1NTg5MjQsImV4cCI6MTYwOTU2MjgyNCwiYWNjdCI6MCwiYWNyIjoiMSIsImFjcnMiOlsidXJuOnVzZXI6cmVnaXN0ZXJzZWN1cml0eWluZm8iLCJ1cm46bWljcm9zb2Z0OnJlcTEiLCJ1cm46bWljcm9zb2Z0OnJlcTIiLCJ1cm46bWljcm9zb2Z0OnJlcTMiLCJjMSIsImMyIiwiYzMiLCJjNCIsImM1IiwiYzYiLCJjNyIsImM4IiwiYzkiLCJjMTAiLCJjMTEiLCJjMTIiLCJjMTMiLCJjMTQiLCJjMTUiLCJjMTYiLCJjMTciLCJjMTgiLCJj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6o6oiXuwpWK743Vj6fw_auicr4vMWeZeuKj2WWhPWmEiM7WRA33Uv2KMzjcfMekXyf-cjHHaUnGIIpscREHMM0xgleEy8JF9S2twlk86PcmYISr4xXEH2amsLWVCOzccGVUYEBlEkTDyHnVguhGW6SvvIlkCvW5NvhXkvocu0C4F41WjoHgvZgvSjcQ0RJJNsG8xg"; diff --git a/test/development/workload/open-extensions.ts b/test/development/workload/open-extensions.ts index fc766907d..72da48b2f 100644 --- a/test/development/workload/open-extensions.ts +++ b/test/development/workload/open-extensions.ts @@ -21,7 +21,7 @@ let extension: ColorOpenExtension = { color: randomString(), }; -describe("Open Extensions", function () { +describe("Open Extensions", function() { this.timeout(10 * 1000); it("Use open extensions to add a field to users", async () => { diff --git a/test/development/workload/users.ts b/test/development/workload/users.ts index 06495b789..9ac45c78f 100644 --- a/test/development/workload/users.ts +++ b/test/development/workload/users.ts @@ -9,7 +9,6 @@ import { User } from "@microsoft/microsoft-graph-types"; import { assert } from "chai"; import "isomorphic-fetch"; - import { getClient, randomString } from "../test-helper"; const client = getClient(); diff --git a/test/node/content/BatchRequestContent.ts b/test/node/content/BatchRequestContent.ts index 5637ec091..47736ae29 100644 --- a/test/node/content/BatchRequestContent.ts +++ b/test/node/content/BatchRequestContent.ts @@ -9,7 +9,7 @@ import { assert } from "chai"; import * as fs from "fs"; import "isomorphic-fetch"; -import { BatchRequestContent} from "../../../src/content/BatchRequestContent"; +import { BatchRequestContent } from "../../../src/content/BatchRequestContent"; describe("BatchRequestContent.ts", () => { describe("getContent", () => { @@ -39,5 +39,4 @@ describe("BatchRequestContent.ts", () => { }); }); }); - }); diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json index 2cda489a0..e56eb5f83 100644 --- a/tsconfig-cjs.json +++ b/tsconfig-cjs.json @@ -7,5 +7,5 @@ "outDir": "lib" }, "exclude": ["node_modules", "lib", "samples", "test/development"], - "include": ["./src/**/*.ts","./test"] + "include": ["./src/**/*.ts", "./test"] } From 4c4ee3266740c9d37869b1ab56091e43ad97af7b Mon Sep 17 00:00:00 2001 From: "nikithauc@gmail.com" Date: Wed, 6 Jan 2021 11:15:05 -0800 Subject: [PATCH 10/10] added assertions, removed dup test file, language changes --- CONTRIBUTING.md | 2 +- package-lock.json | 375 ++++++++++++++------ test/common/content/BatchResponseContent.ts | 2 + test/node/NodeTests.md | 4 +- test/node/content/BatchResponseContent.ts | 127 ------- 5 files changed, 277 insertions(+), 233 deletions(-) delete mode 100644 test/node/content/BatchResponseContent.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9dd15dce2..91872017c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,7 +116,7 @@ To edit files, open them in an editor of your choice and modify them. To create _Note: Make sure to add unit tests to validate you changes._ -Once you have done with your changes, You have to build and test your changes To build the library run, +Build and test your changes with the following commands after you have completed your work: ```cmd npm run build diff --git a/package-lock.json b/package-lock.json index e1cc4658f..bf79a2e9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -910,6 +910,7 @@ "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dev": true, "requires": { "mime-types": "~2.1.24", "negotiator": "0.6.2" @@ -930,7 +931,8 @@ "after": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "dev": true }, "aggregate-error": { "version": "3.1.0", @@ -1179,7 +1181,8 @@ "arraybuffer.slice": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", - "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", + "dev": true }, "arrify": { "version": "1.0.1", @@ -1266,7 +1269,8 @@ "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true }, "async-settle": { "version": "1.0.0", @@ -1318,12 +1322,14 @@ "backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", - "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", @@ -1383,7 +1389,8 @@ "base64-arraybuffer": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", - "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=" + "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=", + "dev": true }, "base64-js": { "version": "1.5.1", @@ -1394,12 +1401,14 @@ "base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", - "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "dev": true }, "better-assert": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, "requires": { "callsite": "1.0.0" } @@ -1413,7 +1422,8 @@ "blob": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", - "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==", + "dev": true }, "bn.js": { "version": "5.1.3", @@ -1425,6 +1435,7 @@ "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "dev": true, "requires": { "bytes": "3.1.0", "content-type": "~1.0.4", @@ -1442,6 +1453,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -1449,7 +1461,8 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, @@ -1457,6 +1470,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1676,7 +1690,8 @@ "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "dev": true }, "cache-base": { "version": "1.0.1", @@ -1738,7 +1753,8 @@ "callsite": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true }, "callsites": { "version": "2.0.0", @@ -1749,7 +1765,8 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true }, "caniuse-lite": { "version": "1.0.30000969", @@ -2016,7 +2033,8 @@ "colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true }, "combine-source-map": { "version": "0.8.0", @@ -2062,22 +2080,26 @@ "component-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "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==" + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true }, "component-inherit": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "concat-stream": { "version": "1.6.2", @@ -2095,6 +2117,7 @@ "version": "3.7.0", "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "dev": true, "requires": { "debug": "2.6.9", "finalhandler": "1.1.2", @@ -2106,6 +2129,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -2113,7 +2137,8 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, @@ -2132,7 +2157,8 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true }, "convert-source-map": { "version": "1.6.0", @@ -2146,7 +2172,8 @@ "cookie": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true }, "copy-descriptor": { "version": "0.1.1", @@ -2287,7 +2314,8 @@ "custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", - "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=" + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "dev": true }, "d": { "version": "1.0.0", @@ -2307,12 +2335,14 @@ "date-format": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", - "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==" + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==", + "dev": true }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, "requires": { "ms": "^2.1.1" } @@ -2320,7 +2350,8 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "decode-uri-component": { "version": "0.2.0", @@ -2473,7 +2504,8 @@ "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true }, "des.js": { "version": "1.0.1", @@ -2494,7 +2526,8 @@ "di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", - "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=" + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "dev": true }, "diff": { "version": "3.5.0", @@ -2525,6 +2558,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "dev": true, "requires": { "custom-event": "~1.0.0", "ent": "~2.2.0", @@ -2563,7 +2597,8 @@ "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true }, "electron-to-chromium": { "version": "1.3.135", @@ -2609,7 +2644,8 @@ "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true }, "end-of-stream": { "version": "1.4.1", @@ -2624,6 +2660,7 @@ "version": "3.4.2", "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.2.tgz", "integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==", + "dev": true, "requires": { "accepts": "~1.3.4", "base64id": "2.0.0", @@ -2637,6 +2674,7 @@ "version": "3.4.4", "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.4.tgz", "integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==", + "dev": true, "requires": { "component-emitter": "~1.3.0", "component-inherit": "0.0.3", @@ -2655,6 +2693,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -2662,22 +2701,26 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, "parseqs": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", - "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==", + "dev": true }, "parseuri": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", - "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==", + "dev": true }, "ws": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "dev": true, "requires": { "async-limiter": "~1.0.0" } @@ -2688,6 +2731,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", "integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==", + "dev": true, "requires": { "after": "0.8.2", "arraybuffer.slice": "~0.0.7", @@ -2699,7 +2743,8 @@ "ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", - "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=" + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "dev": true }, "error-ex": { "version": "1.3.2", @@ -2819,7 +2864,8 @@ "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true }, "escape-string-regexp": { "version": "1.0.5", @@ -2830,7 +2876,8 @@ "esm": { "version": "3.2.25", "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==" + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true }, "esprima": { "version": "4.0.1", @@ -2853,7 +2900,8 @@ "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true }, "events": { "version": "3.2.0", @@ -2948,7 +2996,8 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true }, "extend-shallow": { "version": "3.0.2", @@ -3085,6 +3134,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, "requires": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -3099,6 +3149,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -3106,7 +3157,8 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, @@ -3187,7 +3239,8 @@ "flatted": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true }, "flush-write-stream": { "version": "1.1.1", @@ -3208,7 +3261,8 @@ "follow-redirects": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", - "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==" + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", + "dev": true }, "for-in": { "version": "1.0.2", @@ -3313,12 +3367,14 @@ "fs": { "version": "0.0.1-security", "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=", + "dev": true }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, "requires": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", @@ -3328,7 +3384,8 @@ "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true } } }, @@ -3345,7 +3402,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "1.2.9", @@ -3915,7 +3973,8 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true }, "get-func-name": { "version": "2.0.0", @@ -3979,6 +4038,7 @@ "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4104,7 +4164,8 @@ "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", + "dev": true }, "growl": { "version": "1.10.5", @@ -4297,6 +4358,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "dev": true, "requires": { "isarray": "2.0.1" }, @@ -4304,14 +4366,16 @@ "isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true } } }, "has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", - "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true }, "has-flag": { "version": "3.0.0", @@ -4469,6 +4533,7 @@ "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "dev": true, "requires": { "depd": "~1.1.2", "inherits": "2.0.3", @@ -4481,6 +4546,7 @@ "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, "requires": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -4515,6 +4581,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -4550,12 +4617,14 @@ "indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -4564,7 +4633,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "ini": { "version": "1.3.7", @@ -4743,7 +4813,8 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", @@ -4764,6 +4835,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -5004,7 +5076,8 @@ "isbinaryfile": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.6.tgz", - "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==" + "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==", + "dev": true }, "isexe": { "version": "2.0.0", @@ -5513,6 +5586,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, "requires": { "graceful-fs": "^4.1.6" } @@ -5527,6 +5601,7 @@ "version": "5.2.3", "resolved": "https://registry.npmjs.org/karma/-/karma-5.2.3.tgz", "integrity": "sha512-tHdyFADhVVPBorIKCX8A37iLHxc6RBRphkSoQ+MLKdAtFn1k97tD8WUGi1KlEtDZKL3hui0qhsY9HXUfSNDYPQ==", + "dev": true, "requires": { "body-parser": "^1.19.0", "braces": "^3.0.2", @@ -5556,12 +5631,14 @@ "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -5570,6 +5647,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, "requires": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -5578,12 +5656,14 @@ "binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -5592,6 +5672,7 @@ "version": "3.4.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", + "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", @@ -5607,6 +5688,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -5617,6 +5699,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -5624,17 +5707,20 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -5643,6 +5729,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, "requires": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -5652,12 +5739,14 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, "optional": true }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5671,6 +5760,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -5678,12 +5768,14 @@ "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, "requires": { "binary-extensions": "^2.0.0" } @@ -5691,17 +5783,20 @@ "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, "requires": { "p-locate": "^4.1.0" } @@ -5709,12 +5804,14 @@ "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, "p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, "requires": { "p-limit": "^2.2.0" } @@ -5722,12 +5819,14 @@ "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true }, "readdirp": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, "requires": { "picomatch": "^2.2.1" } @@ -5736,6 +5835,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -5743,12 +5843,14 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -5759,6 +5861,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -5767,6 +5870,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "requires": { "is-number": "^7.0.0" } @@ -5775,6 +5879,7 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -5785,6 +5890,7 @@ "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, "requires": { "cliui": "^6.0.0", "decamelize": "^1.2.0", @@ -5803,6 +5909,7 @@ "version": "18.1.3", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" @@ -6228,7 +6335,8 @@ "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "dev": true }, "lodash.flattendeep": { "version": "4.4.0", @@ -6266,6 +6374,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz", "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==", + "dev": true, "requires": { "date-format": "^3.0.0", "debug": "^4.1.1", @@ -6397,7 +6506,8 @@ "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true }, "merge-stream": { "version": "1.0.1", @@ -6450,17 +6560,20 @@ "mime": { "version": "2.4.6", "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", + "dev": true }, "mime-db": { "version": "1.44.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true }, "mime-types": { "version": "2.1.27", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, "requires": { "mime-db": "1.44.0" } @@ -6487,6 +6600,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6618,7 +6732,8 @@ "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true }, "msal": { "version": "1.0.0", @@ -6665,7 +6780,8 @@ "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "dev": true }, "next-tick": { "version": "1.0.0", @@ -7018,7 +7134,8 @@ "object-component": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", - "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "dev": true }, "object-copy": { "version": "0.1.0", @@ -7189,6 +7306,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, "requires": { "ee-first": "1.1.1" } @@ -7197,6 +7315,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -7235,6 +7354,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", + "dev": true, "requires": { "p-try": "^2.0.0" } @@ -7257,7 +7377,8 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, "package-hash": { "version": "4.0.0", @@ -7336,6 +7457,7 @@ "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, "requires": { "better-assert": "~1.0.0" } @@ -7344,6 +7466,7 @@ "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, "requires": { "better-assert": "~1.0.0" } @@ -7351,7 +7474,8 @@ "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true }, "pascalcase": { "version": "0.1.1", @@ -7380,7 +7504,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-is-inside": { "version": "1.0.2", @@ -7456,7 +7581,8 @@ "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true }, "pify": { "version": "3.0.0", @@ -7612,12 +7738,14 @@ "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", - "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==" + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", + "dev": true }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true }, "querystring": { "version": "0.2.0", @@ -7653,12 +7781,14 @@ "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true }, "raw-body": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "dev": true, "requires": { "bytes": "3.1.0", "http-errors": "1.7.2", @@ -7905,17 +8035,20 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true }, "resolve": { "version": "1.11.0", @@ -7976,7 +8109,8 @@ "rfdc": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", - "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==", + "dev": true }, "rimraf": { "version": "2.6.3", @@ -8150,7 +8284,8 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "semver": { "version": "5.7.0", @@ -8182,7 +8317,8 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "set-value": { "version": "2.0.0", @@ -8216,7 +8352,8 @@ "setprototypeof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "dev": true }, "sha.js": { "version": "2.4.11", @@ -8396,6 +8533,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "dev": true, "requires": { "debug": "~4.1.0", "engine.io": "~3.4.0", @@ -8408,12 +8546,14 @@ "socket.io-adapter": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", - "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==" + "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==", + "dev": true }, "socket.io-client": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "dev": true, "requires": { "backo2": "1.0.2", "base64-arraybuffer": "0.1.5", @@ -8434,27 +8574,32 @@ "base64-arraybuffer": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true }, "component-emitter": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true }, "isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, "socket.io-parser": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.1.tgz", "integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==", + "dev": true, "requires": { "component-emitter": "~1.3.0", "debug": "~3.1.0", @@ -8464,12 +8609,14 @@ "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==" + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -8482,6 +8629,7 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "dev": true, "requires": { "component-emitter": "1.2.1", "debug": "~4.1.0", @@ -8491,12 +8639,14 @@ "component-emitter": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true }, "isarray": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true } } }, @@ -8672,7 +8822,8 @@ "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true }, "stream-browserify": { "version": "3.0.0", @@ -8756,6 +8907,7 @@ "version": "2.2.4", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "dev": true, "requires": { "date-format": "^2.1.0", "debug": "^4.1.1", @@ -8765,7 +8917,8 @@ "date-format": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", - "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==" + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==", + "dev": true } } }, @@ -9036,6 +9189,7 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, "requires": { "rimraf": "^3.0.0" }, @@ -9044,6 +9198,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -9063,7 +9218,8 @@ "to-array": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", - "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true }, "to-fast-properties": { "version": "2.0.0", @@ -9125,7 +9281,8 @@ "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "dev": true }, "toposort": { "version": "2.0.2", @@ -9231,6 +9388,7 @@ "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, "requires": { "media-typer": "0.3.0", "mime-types": "~2.1.24" @@ -9260,7 +9418,8 @@ "ua-parser-js": { "version": "0.7.22", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.22.tgz", - "integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==" + "integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==", + "dev": true }, "uglify-es": { "version": "3.3.9", @@ -9391,12 +9550,14 @@ "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true }, "unset-value": { "version": "1.0.0", @@ -9497,7 +9658,8 @@ "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true }, "uuid": { "version": "3.4.0", @@ -9593,7 +9755,8 @@ "void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", - "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "dev": true }, "wcwidth": { "version": "1.0.1", @@ -9622,7 +9785,8 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true }, "which-typed-array": { "version": "1.1.2", @@ -9701,7 +9865,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write-file-atomic": { "version": "3.0.3", @@ -9718,12 +9883,14 @@ "ws": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz", - "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==" + "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==", + "dev": true }, "xmlhttprequest-ssl": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", - "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "dev": true }, "xtend": { "version": "4.0.1", @@ -9734,7 +9901,8 @@ "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true }, "yargs": { "version": "13.3.2", @@ -9812,7 +9980,8 @@ "yeast": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", - "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "dev": true }, "yn": { "version": "3.1.1", diff --git a/test/common/content/BatchResponseContent.ts b/test/common/content/BatchResponseContent.ts index fbb88504e..b75b4d3b0 100644 --- a/test/common/content/BatchResponseContent.ts +++ b/test/common/content/BatchResponseContent.ts @@ -53,7 +53,9 @@ describe("BatchResponseContent.ts", () => { batchRes.update({ responses: [okWithoutBody, okWithBody], }); + assert.isDefined(batchRes.getResponseById("1")); assert.isDefined(batchRes.getResponseById("2")); + assert.isDefined(batchRes.getResponseById("3")); assert.isDefined(batchRes.getResponseById("4")); done(); }); diff --git a/test/node/NodeTests.md b/test/node/NodeTests.md index e1b38d886..21932ad7d 100644 --- a/test/node/NodeTests.md +++ b/test/node/NodeTests.md @@ -2,5 +2,5 @@ This folder contains unit tests which are node-specific. Karma is used for testing the code in browsers. To run the unit tests using karma run the following steps - -- Run the script npm install -- Run the script npm run test +- Run the script `npm install` +- Run the script `npm run test` diff --git a/test/node/content/BatchResponseContent.ts b/test/node/content/BatchResponseContent.ts deleted file mode 100644 index fbb88504e..000000000 --- a/test/node/content/BatchResponseContent.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * ------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. - * See License in the project root for license information. - * ------------------------------------------------------------------------------------------- - */ - -import { assert } from "chai"; - -import { BatchResponseContent } from "../../../src/content/BatchResponseContent"; - -const redirect = { - id: "1", - status: 302, - headers: { - location: "https://b0mpua-by3301.files.1drv.com/y23vmagahszhxzlcvhasdhasghasodfi", - }, -}; -const forbidden = { - id: "3", - status: 401, - body: { - error: { - code: "Forbidden", - message: "...", - }, - }, -}; -const okWithBody = { - id: "2", - status: 200, - body: { - "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerTask)", - value: [], - }, -}; -const okWithoutBody = { - id: "4", - status: 204, - body: null, -}; - -describe("BatchResponseContent.ts", () => { - describe("update", function() { - this.timeout(20 * 1000); - - it("Should update instance with nextLink responses", (done) => { - const responses = [redirect, forbidden]; - const batchRes = new BatchResponseContent({ - responses, - "@odata.nextLink": "dummy nextlink", - }); - batchRes.update({ - responses: [okWithoutBody, okWithBody], - }); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - - describe("createResponseObject", function() { - this.timeout(20 * 1000); - - it("Should create batch response content instance for 302, 402, 202, 204 responses", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - assert.isDefined(batchRes.getResponseById("1")); - assert.isDefined(batchRes.getResponseById("2")); - assert.isDefined(batchRes.getResponseById("3")); - assert.isDefined(batchRes.getResponseById("4")); - done(); - }); - }); - - describe("getResponseById", function() { - this.timeout(20 * 1000); - - it("Should return response object for given id", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponseById("1")); - done(); - }); - - it("Should return undefined for given id for which the response is not present", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isUndefined(batchRes.getResponseById("100")); - done(); - }); - }); - - describe("getResponses", function() { - this.timeout(20 * 1000); - - it("Should return responses map", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect], - }); - assert.isDefined(batchRes.getResponses()); - done(); - }); - }); - - describe("getResponsesIterator", function() { - this.timeout(20 * 1000); - - it("Should return iterator", (done) => { - const batchRes = new BatchResponseContent({ - responses: [redirect, forbidden, okWithBody, okWithoutBody], - }); - let count = 0; - const iterator = batchRes.getResponsesIterator(); - let data = iterator.next(); - while (!data.done) { - data = iterator.next(); - count++; - } - assert.equal(count, 4); - done(); - }); - }); -});