From 8ac65c342d78030c3404761a6914821b0a09f85d Mon Sep 17 00:00:00 2001 From: Gautam Singh <5769869+gautamsi@users.noreply.github.com> Date: Sun, 10 Sep 2023 19:19:14 -0500 Subject: [PATCH] release 0.13.0 * removed bluebird and fetch api * removed XHR related shims and use @ewsjs/xhr implementation --- README.md | 9 +- package-lock.json | 482 +++++++++++++++++++++++++------ package.json | 7 +- scripts/config/tsd.start | 1 - src/js/ConfigurationApi.ts | 11 - src/js/Core/ExchangeService.ts | 1 - src/js/ExchangeWebService.ts | 5 +- src/js/Misc/MapiTypeConverter.ts | 2 +- src/js/Promise.ts | 320 -------------------- src/js/XHRDefault.ts | 196 ------------- src/js/XHRFactory.ts | 26 +- tsconfig.json | 5 +- typings/ExchangeWebService.d.ts | 310 +------------------- 13 files changed, 417 insertions(+), 958 deletions(-) delete mode 100644 src/js/Promise.ts delete mode 100644 src/js/XHRDefault.ts diff --git a/README.md b/README.md index a6192463..81028427 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,13 @@ You can now use this in Ionic, Cordova, Browser based process (where CORS is dis =========================================================================================== +# Whats new v0.13.0 **BREAKING CHANGES** +* Security update: removed fetch and bluebird dependency +* removed `XHRDefault` and `ConfigurationApi.ConfigurePromise` exported methods +* Exported XHRApi from `@ewsjs/xhr` to make it easier to use +* Using default implementation of `XhrApi` from `@ewsjs/xhr` instead of using `fetch` + + # Whats new v0.12.0 * fixed `WellKnownFolderNames` to be `StringPropertyDefinition` type instead of `Generic` which microsoft has changed long back. Part of this was fixed by #414 (thanks @klinki) * fixes #416 and also cleans up other typing issues @@ -93,7 +100,7 @@ NTLM and Cookies Authentication works with nodejs only * commonjs module for NodeJs * AMD module for other scenarios* (not documented yet) -All http call is wrapped in promise using default BlueBird promise. You can also interchange compatible promise api. +~~All http call is wrapped in promise using default BlueBird promise. You can also interchange compatible promise api.~~ Code sample from [EWS Managed API 2.1.](https://msdn.microsoft.com/en-us/library/office/jj536567.aspx) should work with little modificaion to Promise format ## async/await latest nodejs diff --git a/package-lock.json b/package-lock.json index 8edb483d..c835ac96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,15 @@ { "name": "ews-javascript-api", - "version": "0.11.0", + "version": "0.13.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ews-javascript-api", - "version": "0.11.0", + "version": "0.13.0", "license": "MIT", "dependencies": { + "@ewsjs/xhr": "^2.0.1", "@xmldom/xmldom": "^0.8.1", "base64-js": "^1.5.1", "moment": "^2.29.4", @@ -31,10 +32,28 @@ "shelljs": "^0.8.5", "typedoc": "^0.22.13", "typescript": "^4.6.2" + } + }, + "node_modules/@ewsjs/ntlm-client": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ewsjs/ntlm-client/-/ntlm-client-2.0.0.tgz", + "integrity": "sha512-CxIF+szJF8oPswACtmEqAC2iJrV5te7LV5wVyCRCKe4fGt1H4I8psFbIKX2iaGIII1xoARqooKdu41HRImKv4w==", + "engines": { + "node": ">=4.0.0" }, "optionalDependencies": { - "bluebird": "^3.7.2", - "fetch": "^1.1.0" + "extend": "^3.0.2" + } + }, + "node_modules/@ewsjs/xhr": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@ewsjs/xhr/-/xhr-2.0.1.tgz", + "integrity": "sha512-95tb/3AhahMHibDRA5CRWLxRDQMiZ0Zr6yAzDVUY/aQ2wHNkNDTiNgPW+6ywCYEhSYvhqw7ua5JOdYIDw2/xqw==", + "dependencies": { + "@ewsjs/ntlm-client": "^2.0.0", + "axios": "^1.5.0", + "http-cookie-agent": "^5.0.4", + "tough-cookie": "^4.1.3" } }, "node_modules/@nodelib/fs.scandir": { @@ -119,6 +138,38 @@ "node": ">=10.0.0" } }, + "node_modules/agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -202,6 +253,21 @@ "node": "*" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", @@ -236,18 +302,6 @@ "node": ">=8" } }, - "node_modules/biskviit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/biskviit/-/biskviit-1.0.1.tgz", - "integrity": "sha1-A3oM1LcbnjMf2QoRIt4X3EnkIKc=", - "optional": true, - "dependencies": { - "psl": "^1.1.7" - }, - "engines": { - "node": ">=1.0.0" - } - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -259,12 +313,6 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "optional": true - }, "node_modules/brace-expansion": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", @@ -482,6 +530,17 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -554,6 +613,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -581,15 +648,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "optional": true, - "dependencies": { - "iconv-lite": "~0.4.13" - } - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -599,6 +657,12 @@ "node": ">=6" } }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "optional": true + }, "node_modules/fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -624,16 +688,6 @@ "reusify": "^1.0.4" } }, - "node_modules/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-CoJ58Gvjf58Ou1Z1YKMKSA2lmi4=", - "optional": true, - "dependencies": { - "biskviit": "1.0.1", - "encoding": "0.1.12" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -671,6 +725,38 @@ "flat": "cli.js" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -794,13 +880,31 @@ "he": "bin/he" } }, - "node_modules/iconv-lite": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz", - "integrity": "sha1-T9qjs4rLwsAxsEXQ7c3+HsqxjI0=", - "optional": true, + "node_modules/http-cookie-agent": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-5.0.4.tgz", + "integrity": "sha512-OtvikW69RvfyP6Lsequ0fN5R49S+8QcS9zwd58k6VSr6r57T8G29BkPdyrBcSwLq6ExLs9V+rBlfxu7gDstJag==", + "dependencies": { + "agent-base": "^7.1.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=14.18.0 <15.0.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/3846masa" + }, + "peerDependencies": { + "deasync": "^0.1.26", + "tough-cookie": "^4.0.0", + "undici": "^5.11.0" + }, + "peerDependenciesMeta": { + "deasync": { + "optional": true + }, + "undici": { + "optional": true + } } }, "node_modules/ieee754": { @@ -1081,6 +1185,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -1361,11 +1484,28 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/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==" + }, "node_modules/psl": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.18.tgz", - "integrity": "sha1-qPL1RloB6KzOT/LXI0KwXHtQfZA=", - "optional": true + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, "node_modules/queue-microtask": { "version": "1.2.3", @@ -1487,6 +1627,11 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "node_modules/resolve": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", @@ -1703,6 +1848,28 @@ "node": ">=8.0" } }, + "node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -1783,6 +1950,15 @@ "node": ">= 10.0.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -1951,6 +2127,25 @@ } }, "dependencies": { + "@ewsjs/ntlm-client": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ewsjs/ntlm-client/-/ntlm-client-2.0.0.tgz", + "integrity": "sha512-CxIF+szJF8oPswACtmEqAC2iJrV5te7LV5wVyCRCKe4fGt1H4I8psFbIKX2iaGIII1xoARqooKdu41HRImKv4w==", + "requires": { + "extend": "^3.0.2" + } + }, + "@ewsjs/xhr": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@ewsjs/xhr/-/xhr-2.0.1.tgz", + "integrity": "sha512-95tb/3AhahMHibDRA5CRWLxRDQMiZ0Zr6yAzDVUY/aQ2wHNkNDTiNgPW+6ywCYEhSYvhqw7ua5JOdYIDw2/xqw==", + "requires": { + "@ewsjs/ntlm-client": "^2.0.0", + "axios": "^1.5.0", + "http-cookie-agent": "^5.0.4", + "tough-cookie": "^4.1.3" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2021,6 +2216,29 @@ "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.6.tgz", "integrity": "sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==" }, + "agent-base": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", + "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", + "requires": { + "debug": "^4.3.4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -2080,6 +2298,21 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "balanced-match": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", @@ -2097,15 +2330,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "biskviit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/biskviit/-/biskviit-1.0.1.tgz", - "integrity": "sha1-A3oM1LcbnjMf2QoRIt4X3EnkIKc=", - "optional": true, - "requires": { - "psl": "^1.1.7" - } - }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -2117,12 +2341,6 @@ "readable-stream": "^3.4.0" } }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "optional": true - }, "brace-expansion": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", @@ -2278,6 +2496,14 @@ "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==", + "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", @@ -2335,6 +2561,11 @@ "slash": "^3.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -2356,21 +2587,18 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "optional": true, - "requires": { - "iconv-lite": "~0.4.13" - } - }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "optional": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -2393,16 +2621,6 @@ "reusify": "^1.0.4" } }, - "fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-CoJ58Gvjf58Ou1Z1YKMKSA2lmi4=", - "optional": true, - "requires": { - "biskviit": "1.0.1", - "encoding": "0.1.12" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2428,6 +2646,21 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2514,11 +2747,13 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "iconv-lite": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz", - "integrity": "sha1-T9qjs4rLwsAxsEXQ7c3+HsqxjI0=", - "optional": true + "http-cookie-agent": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/http-cookie-agent/-/http-cookie-agent-5.0.4.tgz", + "integrity": "sha512-OtvikW69RvfyP6Lsequ0fN5R49S+8QcS9zwd58k6VSr6r57T8G29BkPdyrBcSwLq6ExLs9V+rBlfxu7gDstJag==", + "requires": { + "agent-base": "^7.1.0" + } }, "ieee754": { "version": "1.2.1", @@ -2713,6 +2948,19 @@ "picomatch": "^2.2.3" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -2908,11 +3156,25 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "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==" + }, "psl": { - "version": "1.1.18", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.18.tgz", - "integrity": "sha1-qPL1RloB6KzOT/LXI0KwXHtQfZA=", - "optional": true + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, "queue-microtask": { "version": "1.2.3", @@ -2998,6 +3260,11 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "resolve": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", @@ -3143,6 +3410,24 @@ "is-number": "^7.0.0" } }, + "tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -3200,6 +3485,15 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index c2a6f4b4..e8a180ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ews-javascript-api", - "version": "0.12.0", + "version": "0.13.0", "description": "EWS Managed api in JavaScript", "main": "js/ExchangeWebService.js", "scripts": { @@ -26,16 +26,13 @@ }, "homepage": "https://github.com/gautamsi/ews-javascript-api", "dependencies": { + "@ewsjs/xhr": "^2.0.1", "@xmldom/xmldom": "^0.8.1", "base64-js": "^1.5.1", "moment": "^2.29.4", "moment-timezone": "^0.5.41", "uuid": "^8.3.2" }, - "optionalDependencies": { - "bluebird": "^3.7.2", - "fetch": "^1.1.0" - }, "devDependencies": { "@types/chai": "^4.3.0", "@types/chai-as-promised": "7.1.5", diff --git a/scripts/config/tsd.start b/scripts/config/tsd.start index ebc5c89e..06b0e16c 100644 --- a/scripts/config/tsd.start +++ b/scripts/config/tsd.start @@ -1,3 +1,2 @@ declare module "ews-javascript-api" { import * as moment from 'moment-timezone'; -import { FetchStream, fetchUrl, FetchOptions } from 'fetch'; diff --git a/src/js/ConfigurationApi.ts b/src/js/ConfigurationApi.ts index 904a5b3b..fc6d52f1 100644 --- a/src/js/ConfigurationApi.ts +++ b/src/js/ConfigurationApi.ts @@ -1,20 +1,9 @@ import { XHRFactory } from "./XHRFactory"; -import { PromiseConstructor, ConfigurePromise } from "./Promise"; import { IXHROptions, IXHRApi } from "./Interfaces"; -import { FetchOptions } from 'fetch'; -import { XHRDefault } from './XHRDefault'; export class ConfigurationApi { static ConfigureXHR(xhrApi: IXHRApi) { XHRFactory.xhrHelper = xhrApi; } - - static SetXHROptions(fetchOptions: FetchOptions) { - XHRDefault.defaultOptions = fetchOptions; - } - - static ConfigurePromise(promise: PromiseConstructor) { - ConfigurePromise(promise); - } } diff --git a/src/js/Core/ExchangeService.ts b/src/js/Core/ExchangeService.ts index 58d84e3f..547e9f15 100644 --- a/src/js/Core/ExchangeService.ts +++ b/src/js/Core/ExchangeService.ts @@ -221,7 +221,6 @@ import { UserId } from "../ComplexProperties/UserId"; import { UserSettingName } from "../Enumerations/UserSettingName"; import { ViewBase } from "../Search/ViewBase"; import { WellKnownFolderName } from "../Enumerations/WellKnownFolderName"; -import { XHRFactory } from "../XHRFactory"; import { ExchangeServiceBase } from "./ExchangeServiceBase"; /** diff --git a/src/js/ExchangeWebService.ts b/src/js/ExchangeWebService.ts index efa58e75..3a9e23c8 100644 --- a/src/js/ExchangeWebService.ts +++ b/src/js/ExchangeWebService.ts @@ -38,7 +38,6 @@ if (typeof Object.assign != 'function') { export { IXHRApi, IXHROptions, IXHRProgress, } from "./Interfaces"; export { ConfigurationApi } from "./ConfigurationApi"; export { XHRFactory } from "./XHRFactory"; -export { XHRDefault } from "./XHRDefault"; /**Schema Bootstrapping */ import { Schemas } from "./Core/ServiceObjects/Schemas/Schemas"; @@ -941,4 +940,6 @@ export { X509CertificateCredentials } from "./Credentials/X509CertificateCredent export { XmlAttributeNames } from "./Core/XmlAttributeNames"; //export {XmlDtdException} from "./Security/XmlDtdException"; export { XmlElementNames } from "./Core/XmlElementNames"; -export { XmlNamespace } from "./Enumerations/XmlNamespace"; \ No newline at end of file +export { XmlNamespace } from "./Enumerations/XmlNamespace"; + +export { XhrApi, NtlmProvider, CookieProvider } from "@ewsjs/xhr"; diff --git a/src/js/Misc/MapiTypeConverter.ts b/src/js/Misc/MapiTypeConverter.ts index fd4d606b..795972ef 100644 --- a/src/js/Misc/MapiTypeConverter.ts +++ b/src/js/Misc/MapiTypeConverter.ts @@ -292,7 +292,7 @@ export class MapiTypeConverter { static IsArrayType(mapiType: MapiPropertyType): boolean { return MapiTypeConverter.MapiTypeConverterMap.get(mapiType).IsArray; } static ParseMapiIntegerValue(s: string): any { var num = Convert.toNumber(s); - if (num === NaN) { + if (Number.isNaN(num)) { return s; } return num; diff --git a/src/js/Promise.ts b/src/js/Promise.ts deleted file mode 100644 index 6ddca5af..00000000 --- a/src/js/Promise.ts +++ /dev/null @@ -1,320 +0,0 @@ -import { NotSupportedException } from "./Exceptions/NotSupportedException"; - -/** - * Represents the completion of an asynchronous operation - * @typescript 2.1.1 lib.es6.d.ts Promise Description - */ -export interface Promise { - // /** - // * Attaches callbacks for the resolution and/or rejection of the Promise. - // * @param onfulfilled The callback to execute when the Promise is resolved. - // * @param onrejected The callback to execute when the Promise is rejected. - // * @returns A Promise for the completion of which ever callback is executed. - // */ - // then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} - -export interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, - onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult | PromiseLike, - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( - onfulfilled: (value: T) => TResult1 | PromiseLike, - onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} - -export interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - //new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void, onProgress?: (progress: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: (T | PromiseLike)[]): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - -export var Promise: PromiseConstructor; - -class PromiseType { - constructor() { - throw new NotSupportedException("Promise implementation missing.\nPlease use ConfigurePromise function to assign Promise Object\n" + - "bluebird: ConfigurePromise(require('bluebird))\n" + - "Q: ConfigurePromise(require('q').Promise)\n" + - "winjs-node: ConfigurePromise(require('winjs-node').Promise)") - } -} - -try { - var promise = require('bluebird'); - Promise = promise; -} catch (e) { - Promise = PromiseType; -} - -export function ConfigurePromise(promise: PromiseConstructor) { - Promise = promise; -} \ No newline at end of file diff --git a/src/js/XHRDefault.ts b/src/js/XHRDefault.ts deleted file mode 100644 index 5d80c8cf..00000000 --- a/src/js/XHRDefault.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { FetchStream, fetchUrl, FetchOptions } from 'fetch'; -import { IXHROptions, IXHRApi, IXHRProgress } from "./Interfaces"; - -/** - * Default implementation of XHRApi using fetch - */ -export class XHRDefault implements IXHRApi { - static FetchStream: typeof FetchStream = FetchStream; - static fetchUrl: typeof fetchUrl = null; - static defaultOptions: FetchOptions = {}; - - fetchOptions: FetchOptions = {}; - private stream: FetchStream; - - xhr(xhroptions: IXHROptions, progressDelegate?: (progressData: IXHRProgress) => void): Promise { - if (XHRDefault.fetchUrl === null) { - throw new Error("xhrApi - stub method, must be bootstrapped"); - } - //setup xhr for github.com/andris9/fetch options - let options = { - url: xhroptions.url, - payload: xhroptions.data, - headers: xhroptions.headers, - method: xhroptions.type, - disableRedirects: !xhroptions.allowRedirect, - } - - return new Promise((resolve, reject) => { - XHRDefault.fetchUrl(xhroptions.url, this.getOptions(options), (error, meta, body) => { - if (error) { - if (typeof (error).status === 'undefined') { - (error).status = 0; - - } - reject(setupXhrResponse(error)); - } - else { - let xhrResponse: XMLHttpRequest = { - response: body.toString(), - status: meta.status, - redirectCount: meta.redirectCount, - headers: meta.responseHeaders, - finalUrl: meta.finalUrl, - responseType: '', - statusText: undefined, - }; - if (xhrResponse.status === 200) { - resolve(setupXhrResponse(xhrResponse)); - } - else { - reject(setupXhrResponse(xhrResponse)); - } - } - }); - }) - } - - xhrStream(xhroptions: IXHROptions, progressDelegate: (progressData: IXHRProgress) => void): Promise { - if (XHRDefault.FetchStream === null) { - throw new Error("xhrApi - stub method, must be bootstrapped"); - } - - //setup xhr for github.com/andris9/fetch options - let options = { - payload: xhroptions.data, - headers: xhroptions.headers, - method: xhroptions.type - } - - return new Promise((resolve, reject) => { - this.stream = new XHRDefault.FetchStream(xhroptions.url, this.getOptions(options)); - - this.stream.on("data", (chunk) => { - //console.log(chunk.toString()); - progressDelegate({ type: "data", data: chunk.toString() }); - }); - - this.stream.on("meta", (meta) => { - progressDelegate({ type: "header", headers: meta["responseHeaders"] }); - }); - - this.stream.on("end", () => { - progressDelegate({ type: "end" }); - resolve(void 0); - }); - - this.stream.on('error', (error) => { - progressDelegate({ type: "error", error: error }); - this.disconnect(); - reject(error); - }); - }); - } - - disconnect() { - if (this.stream) { - try { - this.stream.destroy(); - } - catch (e) { } - } - } - - get apiName(): string { - return "default"; - } - - constructor(fetchOptions: FetchOptions = {}) { - this.fetchOptions = fetchOptions; - try { - let fetch = require("fetch"); - XHRDefault.FetchStream = fetch.FetchStream; - XHRDefault.fetchUrl = fetch.fetchUrl; - } - catch (e) { } - } - - private getOptions(opts: FetchOptions) { - let headers = Object.assign({}, (XHRDefault.defaultOptions || {}).headers, (this.fetchOptions || {}).headers, (opts || {}).headers) - return Object.assign({}, XHRDefault.defaultOptions, this.fetchOptions, opts, { headers }); - } -} - -/** @internal */ -function setupXhrResponse(xhrResponse: XMLHttpRequest): XMLHttpRequest { - xhrResponse["responseText"] = xhrResponse.response; - delete xhrResponse["response"]; - xhrResponse.getAllResponseHeaders = function () { - var header = ""; - if ((xhrResponse).headers) { - for (var key in (xhrResponse).headers) { - header += key + " : " + (xhrResponse).headers[key] + "\r\n"; - } - } - return header; - }; - - xhrResponse.getResponseHeader = (header: string) => { - if (header) { - if ((xhrResponse).headers) { - if ((xhrResponse).headers[header]) { - return (xhrResponse).headers[header]; - } - if ((xhrResponse).headers[header.toLocaleLowerCase()]) { - return (xhrResponse).headers[header.toLocaleLowerCase()]; - } - } - } - return null; - } - - return xhrResponse; -} - -export interface xFetchOptions { - /** how many redirects allowed, defaults to 10 */ - maxRedirects: number; - /** set to true if redirects are not allowed, defaults to false */ - disableRedirects: boolean; - /** optional header fields, in the form of {'Header-Field':'value'} */ - headers: { [key: string]: (any) }; - /** maximum allowd length for the file, the remainder is cut off. Defaults to Infinity */ - maxResponseLength: number; - /** defaults to GET */ - method: string; - /** request body */ - payload: string; - /** set to false, to disable content gzipping, needed for Node v0.5.9 which has buggy zlib */ - disableGzip: boolean; - /** an array of cookie definitions in the form of ['name=val'] */ - cookies: any; - /** for sharing cookies between requests, see below */ - cookieJar: any; - /** valid for fetchUrl */ - outputEncoding: string; - /** valid for fetchUrl, set to true to disable automatic charset decoding to utf-8 */ - disableDecoding: boolean; - /** valid for fetchUrl, set input encoding */ - overrideCharset: string; - /** use high performance asyncronous DNS resolution based on c-ares instead of a thread pool calling getaddrinfo(3) */ - asyncDnsLoookup: boolean; - /** set a timeout in ms */ - timeout: number; - /** pass-through http.request agent parameter for https */ - agentHttps: any; - /** pass-through http.request agent parameter for http */ - agentHttp: any; - /** pass-through http.request agent parameter as fallback, if agentHttps or agentHttp are not specified */ - agent: any; - /** whether to reject self-signed certificates (true, default behavior), or ignore and allow them (false) */ - rejectUnauthorized: boolean; - /** is the username for Basic auth */ - user: string; - /** is the password for Basic auth */ - pass: string; -} diff --git a/src/js/XHRFactory.ts b/src/js/XHRFactory.ts index 8cd27c00..218fc343 100644 --- a/src/js/XHRFactory.ts +++ b/src/js/XHRFactory.ts @@ -1,18 +1,12 @@ -import { IXHROptions, IXHRApi } from "./Interfaces"; -import { XHRDefault } from "./XHRDefault" - +import { IXHRApi } from "./Interfaces"; +import { XhrApi } from "@ewsjs/xhr"; export class XHRFactory { - static xhrHelper: IXHRApi; - static get XHRApi() { - if (typeof this.xhrHelper === 'undefined' || this.xhrHelper === null) { - this.xhrHelper = new XHRDefault(); - } - return this.xhrHelper; - } - - public static newXHRApi() { - console.warn("depricated, import and use \"new XHRDefault(options?)\" instead") - return new XHRDefault(); - } -} \ No newline at end of file + static xhrHelper: IXHRApi; + static get XHRApi() { + if (typeof this.xhrHelper === 'undefined' || this.xhrHelper === null) { + this.xhrHelper = new XhrApi(); + } + return this.xhrHelper; + } +} diff --git a/tsconfig.json b/tsconfig.json index 6d612bd5..94b9282d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,11 +22,12 @@ }, "compileOnSave": false, "exclude": [ - "node_modules", + "node_modules", "projects", "build", "src/js/System.d.ts", "typings/ExchangeWebService.d.ts", - "src/js/Microsoft.Exchange.WebServices.d__.ts" + "src/js/Microsoft.Exchange.WebServices.d__.ts", + "test/" ] } diff --git a/typings/ExchangeWebService.d.ts b/typings/ExchangeWebService.d.ts index b622c437..36100c94 100644 --- a/typings/ExchangeWebService.d.ts +++ b/typings/ExchangeWebService.d.ts @@ -1,6 +1,5 @@ declare module "ews-javascript-api" { import * as moment from 'moment-timezone'; -import { FetchStream, fetchUrl, FetchOptions } from 'fetch'; export interface IndexerWithStringKey { [index: string]: TValue; @@ -4135,8 +4134,6 @@ export interface AutodiscoverRedirectionUrlValidationCallback { } class ConfigurationApi { static ConfigureXHR(xhrApi: IXHRApi): void; - static SetXHROptions(fetchOptions: FetchOptions): void; - static ConfigurePromise(promise: PromiseConstructor): void; } class EwsLogging { static DebugLogEnabled: boolean; @@ -20881,7 +20878,8 @@ export interface TaskSchemaStatic extends TaskSchema { * BootStrap code. to initializes some class to avoid circular reference. */ /** XHR setup */ -/** TimeZoneTransitions *//**#endregion BootStrap code */ +/** TimeZoneTransitions */ +/**#endregion BootStrap code */ module StringHelper { function IsNullOrEmpty(str: string): boolean; function Format(source: string, ...args: any[]): string; @@ -22795,252 +22793,6 @@ export interface ResponseHeaderDelegate { Exception: Exception; } /** - * Represents the completion of an asynchronous operation - * @typescript 2.1.1 lib.es6.d.ts Promise Description - */ -export interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise; - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise; - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected: (reason: any) => TResult | PromiseLike): Promise; -} -export interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): PromiseLike; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike; - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike; -} -export interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: (T | PromiseLike)[]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: (T | PromiseLike)[]): Promise; - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - var Promise: PromiseConstructor; - function ConfigurePromise(promise: PromiseConstructor): void;/** * Represents the definition of an extended property. */ class ExtendedPropertyDefinition extends PropertyDefinitionBase { @@ -25150,68 +24902,10 @@ export interface ISearchFilterCollection { static ParseString(url: string): ParsedUrl; static UriSchemeHttp: string; static UriSchemeHttps: string; -}/** - * Default implementation of XHRApi using fetch - */ - class XHRDefault implements IXHRApi { - static FetchStream: typeof FetchStream; - static fetchUrl: typeof fetchUrl; - static defaultOptions: FetchOptions; - fetchOptions: FetchOptions; - xhr(xhroptions: IXHROptions, progressDelegate?: (progressData: IXHRProgress) => void): Promise; - xhrStream(xhroptions: IXHROptions, progressDelegate: (progressData: IXHRProgress) => void): Promise; - disconnect(): void; - get apiName(): string; - constructor(fetchOptions?: FetchOptions); -} -export interface xFetchOptions { - /** how many redirects allowed, defaults to 10 */ - maxRedirects: number; - /** set to true if redirects are not allowed, defaults to false */ - disableRedirects: boolean; - /** optional header fields, in the form of {'Header-Field':'value'} */ - headers: { - [key: string]: (any); - }; - /** maximum allowd length for the file, the remainder is cut off. Defaults to Infinity */ - maxResponseLength: number; - /** defaults to GET */ - method: string; - /** request body */ - payload: string; - /** set to false, to disable content gzipping, needed for Node v0.5.9 which has buggy zlib */ - disableGzip: boolean; - /** an array of cookie definitions in the form of ['name=val'] */ - cookies: any; - /** for sharing cookies between requests, see below */ - cookieJar: any; - /** valid for fetchUrl */ - outputEncoding: string; - /** valid for fetchUrl, set to true to disable automatic charset decoding to utf-8 */ - disableDecoding: boolean; - /** valid for fetchUrl, set input encoding */ - overrideCharset: string; - /** use high performance asyncronous DNS resolution based on c-ares instead of a thread pool calling getaddrinfo(3) */ - asyncDnsLoookup: boolean; - /** set a timeout in ms */ - timeout: number; - /** pass-through http.request agent parameter for https */ - agentHttps: any; - /** pass-through http.request agent parameter for http */ - agentHttp: any; - /** pass-through http.request agent parameter as fallback, if agentHttps or agentHttp are not specified */ - agent: any; - /** whether to reject self-signed certificates (true, default behavior), or ignore and allow them (false) */ - rejectUnauthorized: boolean; - /** is the username for Basic auth */ - user: string; - /** is the password for Basic auth */ - pass: string; } class XHRFactory { static xhrHelper: IXHRApi; static get XHRApi(): IXHRApi; - static newXHRApi(): XHRDefault; } class XHROutlook implements IXHRApi { xhr(xhroptions: IXHROptions, progressDelegate?: (progressData: IXHRProgress) => void): Promise;