@chat-adapter/teams 4.15.0 → 4.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphClientError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.js","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/authProviderOptions/azureTokenCredentials/index.ts","../src/index.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/RequestMethod.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/content/BatchRequestContent.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Constants.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphClientError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphRequestUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareControl.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/AuthenticationHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/TelemetryHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/AuthenticationHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/HTTPMessageHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RetryHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/RetryHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RedirectHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/RedirectHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Version.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/TelemetryHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/ChaosStrategy.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/ResponseType.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphResponseHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/Range.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/UploadResult.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/LargeFileUploadTask.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/FileObjectClasses/FileUpload.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/OneDriveLargeFileUploadTaskUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/OneDriveLargeFileUploadTask.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/CustomAuthenticationProvider.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/HTTPClient.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/HTTPClientFactory.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/ValidatePolyFilling.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Client.ts","../src/cards.ts","../src/markdown.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphClientError\n */\n\n/**\n * @class\n * Create GraphClientError object to handle client-side errors\n * encountered within the JavaScript Client SDK.\n * Whereas GraphError Class should be used to handle errors in the response from the Graph API.\n */\n\nexport class GraphClientError extends Error {\n\t/**\n\t * @public\n\t * A custom error. This property should set be when the error is not of instanceOf Error/GraphClientError.\n\t * Example =\n\t * const client = MicrosoftGraph.Client.init({\n\t * \t\tdefaultVersion: \"v1.0\",\n\t * \tauthProvider: (done) => { done({TokenError:\"AccessToken cannot be null\"}, \"<ACCESS_TOKEN>\");\n\t * });\n\t */\n\tpublic customError?: any;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To set the GraphClientError object\n\t * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request\n\t * @returns GraphClientError object set to the error passed\n\t */\n\tpublic static setGraphClientError(error: any): GraphClientError {\n\t\tlet graphClientError: GraphClientError;\n\t\tif (error instanceof Error) {\n\t\t\tgraphClientError = error;\n\t\t} else {\n\t\t\tgraphClientError = new GraphClientError();\n\t\t\tgraphClientError.customError = error;\n\t\t}\n\t\treturn graphClientError;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphClientError\n\t * @param {string} message? - Error message\n\t * @returns An instance of GraphClientError\n\t */\n\tpublic constructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, GraphClientError.prototype);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\nimport { TokenCredential } from \"@azure/identity\";\n\nimport { GraphClientError } from \"../../GraphClientError\";\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\nimport { TokenCredentialAuthenticationProviderOptions } from \"./ITokenCredentialAuthenticationProviderOptions\";\n\n/**\n * @module TokenCredentialAuthenticationProvider\n */\n\n/**\n * @class\n * Class representing TokenCredentialAuthenticationProvider\n * This feature is introduced in Version 3.0.0\n * @extends AuthenticationProvider\n * Reference - https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md\n */\nexport class TokenCredentialAuthenticationProvider implements AuthenticationProvider {\n\t/**\n\t * @private\n\t * A member holding an instance of @azure/identity TokenCredential\n\t */\n\tprivate tokenCredential: TokenCredential;\n\n\t/**\n\t * @private\n\t * A member holding an instance of TokenCredentialAuthenticationProviderOptions\n\t */\n\tprivate authenticationProviderOptions: TokenCredentialAuthenticationProviderOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of TokenCredentialAuthenticationProvider\n\t * @param {TokenCredential} tokenCredential - An instance of @azure/identity TokenCredential\n\t * @param {TokenCredentialAuthenticationProviderOptions} authenticationProviderOptions - An instance of TokenCredentialAuthenticationProviderOptions\n\t * @returns An instance of TokenCredentialAuthenticationProvider\n\t */\n\tpublic constructor(tokenCredential: TokenCredential, authenticationProviderOptions: TokenCredentialAuthenticationProviderOptions) {\n\t\tif (!tokenCredential) {\n\t\t\tthrow new GraphClientError(\"Please pass a token credential object to the TokenCredentialAuthenticationProvider class constructor\");\n\t\t}\n\t\tif (!authenticationProviderOptions) {\n\t\t\tthrow new GraphClientError(\"Please pass the TokenCredentialAuthenticationProviderOptions with scopes to the TokenCredentialAuthenticationProvider class constructor\");\n\t\t}\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\n\t\tthis.tokenCredential = tokenCredential;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To get the access token\n\t * @param {TokenCredentialAuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object\n\t * @returns The promise that resolves to an access token\n\t */\n\tpublic async getAccessToken(): Promise<string> {\n\t\tconst scopes = this.authenticationProviderOptions.scopes;\n\t\tconst error = new GraphClientError();\n\n\t\tif (!scopes || scopes.length === 0) {\n\t\t\terror.name = \"Empty Scopes\";\n\t\t\terror.message = \"Scopes cannot be empty, Please provide scopes\";\n\t\t\tthrow error;\n\t\t}\n\t\tconst response = await this.tokenCredential.getToken(scopes, this.authenticationProviderOptions.getTokenOptions);\n\t\tif (response) {\n\t\t\treturn response.token;\n\t\t}\n\t\terror.message = \"Cannot retrieve accessToken from the Token Credential object\";\n\t\terror.name = \"Access token is undefined\";\n\t\tthrow error;\n\t}\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=ITokenCredentialAuthenticationProviderOptions.js.map","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\nexport * from \"../../lib/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider\";\nexport * from \"../../lib/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions\";\n","import { ClientSecretCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport {\n TokenCredentialAuthenticationProvider,\n type TokenCredentialAuthenticationProviderOptions,\n} from \"@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials\";\nimport type { Activity, ConversationReference } from \"botbuilder\";\nimport {\n ActivityTypes,\n CloudAdapter,\n ConfigurationBotFrameworkAuthentication,\n TeamsInfo,\n type TurnContext,\n} from \"botbuilder\";\n\n/** Extended CloudAdapter that exposes processActivity for serverless environments */\nclass ServerlessCloudAdapter extends CloudAdapter {\n handleActivity(\n authHeader: string,\n activity: Activity,\n logic: (context: TurnContext) => Promise<void>\n ) {\n return this.processActivity(authHeader, activity, logic);\n }\n}\n\nimport {\n AdapterRateLimitError,\n AuthenticationError,\n bufferToDataUri,\n extractCard,\n extractFiles,\n NetworkError,\n PermissionError,\n toBuffer,\n ValidationError,\n} from \"@chat-adapter/shared\";\nimport type {\n ActionEvent,\n Adapter,\n AdapterPostableMessage,\n Attachment,\n ChannelInfo,\n ChatInstance,\n EmojiValue,\n FetchOptions,\n FetchResult,\n FileUpload,\n FormattedContent,\n ListThreadsOptions,\n ListThreadsResult,\n Logger,\n RawMessage,\n ReactionEvent,\n ThreadInfo,\n ThreadSummary,\n WebhookOptions,\n} from \"chat\";\nimport {\n ConsoleLogger,\n convertEmojiPlaceholders,\n defaultEmojiResolver,\n Message,\n NotImplementedError,\n} from \"chat\";\nimport { cardToAdaptiveCard } from \"./cards\";\nimport { TeamsFormatConverter } from \"./markdown\";\n\nconst MESSAGEID_CAPTURE_PATTERN = /messageid=(\\d+)/;\nconst MESSAGEID_STRIP_PATTERN = /;messageid=\\d+/;\nconst SEMICOLON_MESSAGEID_CAPTURE_PATTERN = /;messageid=(\\d+)/;\n\n/** Microsoft Graph API chat message type */\ninterface GraphChatMessage {\n attachments?: Array<{\n id?: string;\n contentType?: string;\n contentUrl?: string;\n content?: string; // JSON string for adaptive cards\n name?: string;\n }>;\n body?: {\n content?: string;\n contentType?: \"text\" | \"html\";\n };\n createdDateTime?: string;\n from?: {\n user?: {\n id?: string;\n displayName?: string;\n };\n application?: {\n id?: string;\n displayName?: string;\n };\n };\n id: string;\n lastModifiedDateTime?: string;\n replyToId?: string; // ID of parent message for channel threads\n}\n\nexport interface TeamsAdapterConfig {\n /** Microsoft App ID */\n appId: string;\n /** Microsoft App Password */\n appPassword: string;\n /** Microsoft App Tenant ID */\n appTenantId?: string;\n /** Microsoft App Type */\n appType?: \"MultiTenant\" | \"SingleTenant\";\n /** Logger instance for error reporting */\n logger: Logger;\n /** Override bot username (optional) */\n userName?: string;\n}\n\n/** Teams-specific thread ID data */\nexport interface TeamsThreadId {\n conversationId: string;\n replyToId?: string;\n serviceUrl: string;\n}\n\n/** Teams channel context extracted from activity.channelData */\ninterface TeamsChannelContext {\n channelId: string;\n teamId: string;\n tenantId: string;\n}\n\nexport class TeamsAdapter implements Adapter<TeamsThreadId, unknown> {\n readonly name = \"teams\";\n readonly userName: string;\n readonly botUserId?: string;\n\n private readonly botAdapter: ServerlessCloudAdapter;\n private readonly graphClient: Client | null = null;\n private chat: ChatInstance | null = null;\n private readonly logger: Logger;\n private readonly formatConverter = new TeamsFormatConverter();\n private readonly config: TeamsAdapterConfig;\n\n constructor(config: TeamsAdapterConfig) {\n this.config = config;\n this.logger = config.logger;\n this.userName = config.userName || \"bot\";\n\n if (config.appType === \"SingleTenant\" && !config.appTenantId) {\n throw new ValidationError(\n \"teams\",\n \"appTenantId is required for SingleTenant app type\"\n );\n }\n\n // Pass empty config object, credentials go via factory\n const auth = new ConfigurationBotFrameworkAuthentication({\n MicrosoftAppId: config.appId,\n MicrosoftAppPassword: config.appPassword,\n MicrosoftAppType: config.appType || \"MultiTenant\",\n MicrosoftAppTenantId:\n config.appType === \"SingleTenant\" ? config.appTenantId : undefined,\n });\n\n this.botAdapter = new ServerlessCloudAdapter(auth);\n\n // Initialize Microsoft Graph client for message history (requires tenant ID)\n if (config.appTenantId) {\n const credential = new ClientSecretCredential(\n config.appTenantId,\n config.appId,\n config.appPassword\n );\n\n const authProvider = new TokenCredentialAuthenticationProvider(\n credential,\n {\n scopes: [\"https://graph.microsoft.com/.default\"],\n } as TokenCredentialAuthenticationProviderOptions\n );\n\n this.graphClient = Client.initWithMiddleware({ authProvider });\n }\n }\n\n async initialize(chat: ChatInstance): Promise<void> {\n this.chat = chat;\n }\n\n async handleWebhook(\n request: Request,\n options?: WebhookOptions\n ): Promise<Response> {\n const body = await request.text();\n this.logger.debug(\"Teams webhook raw body\", { body });\n\n let activity: Activity;\n try {\n activity = JSON.parse(body);\n } catch (e) {\n this.logger.error(\"Failed to parse request body\", { error: e });\n return new Response(\"Invalid JSON\", { status: 400 });\n }\n\n // Get the auth header for token validation\n const authHeader = request.headers.get(\"authorization\") || \"\";\n\n try {\n // Use handleActivity which takes the activity directly\n // instead of mocking Node.js req/res objects\n await this.botAdapter.handleActivity(\n authHeader,\n activity,\n async (context) => {\n await this.handleTurn(context, options);\n }\n );\n\n return new Response(JSON.stringify({}), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n this.logger.error(\"Bot adapter process error\", { error });\n return new Response(JSON.stringify({ error: \"Internal error\" }), {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n });\n }\n }\n\n private async handleTurn(\n context: TurnContext,\n options?: WebhookOptions\n ): Promise<void> {\n if (!this.chat) {\n this.logger.warn(\"Chat instance not initialized, ignoring event\");\n return;\n }\n\n const activity = context.activity;\n\n // Cache serviceUrl and tenantId for the user - needed for opening DMs later\n if (activity.from?.id && activity.serviceUrl) {\n const userId = activity.from.id;\n const channelData = activity.channelData as {\n tenant?: { id?: string };\n team?: { id?: string };\n channel?: { id?: string };\n };\n const tenantId = channelData?.tenant?.id;\n const ttl = 30 * 24 * 60 * 60 * 1000; // 30 days\n\n // Store serviceUrl and tenantId for DM creation\n this.chat\n .getState()\n .set(`teams:serviceUrl:${userId}`, activity.serviceUrl, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache serviceUrl\", {\n userId,\n error: err,\n });\n });\n if (tenantId) {\n this.chat\n .getState()\n .set(`teams:tenantId:${userId}`, tenantId, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache tenantId\", {\n userId,\n error: err,\n });\n });\n }\n\n // Cache team/channel context for proper message fetching in channel threads\n // This allows fetchMessages to use the channel-specific endpoint for thread filtering\n // The Graph API requires aadGroupId (GUID format), not the Teams thread-style ID\n // Note: The botbuilder types don't include aadGroupId, but it's present at runtime\n // aadGroupId is only available in installationUpdate/conversationUpdate events\n const team = channelData?.team as\n | { id?: string; aadGroupId?: string }\n | undefined;\n const teamAadGroupId = team?.aadGroupId;\n const teamThreadId = team?.id; // Thread-style ID like \"19:xxx@thread.tacv2\"\n const conversationId = activity.conversation?.id || \"\";\n const baseChannelId = conversationId.replace(MESSAGEID_STRIP_PATTERN, \"\");\n\n if (teamAadGroupId && channelData?.channel?.id && tenantId) {\n // We have aadGroupId (from installationUpdate/conversationUpdate) - cache it\n const context: TeamsChannelContext = {\n teamId: teamAadGroupId, // Use aadGroupId (GUID) for Graph API\n channelId: channelData.channel.id,\n tenantId,\n };\n const contextJson = JSON.stringify(context);\n\n // Cache by conversation ID (channel)\n this.chat\n .getState()\n .set(`teams:channelContext:${baseChannelId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache channel context\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n\n // Also cache by team thread-style ID for lookup from regular messages\n // (which don't have aadGroupId but do have team.id)\n if (teamThreadId) {\n this.chat\n .getState()\n .set(`teams:teamContext:${teamThreadId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache team context\", {\n teamThreadId,\n error: err,\n });\n });\n }\n\n this.logger.info(\n \"Cached Teams team GUID from installation/update event\",\n {\n activityType: activity.type,\n conversationId: baseChannelId,\n teamThreadId,\n teamGuid: context.teamId,\n channelId: context.channelId,\n }\n );\n } else if (teamThreadId && channelData?.channel?.id && tenantId) {\n // Regular message event - no aadGroupId, but try to look up from previous cache\n const cachedTeamContext = await this.chat\n .getState()\n .get<string>(`teams:teamContext:${teamThreadId}`);\n\n if (cachedTeamContext) {\n // Found cached context from installation event - also cache by channel ID\n this.chat\n .getState()\n .set(\n `teams:channelContext:${baseChannelId}`,\n cachedTeamContext,\n ttl\n )\n .catch((err) => {\n this.logger.error(\"Failed to cache channel context from team\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n this.logger.info(\"Using cached Teams team GUID for channel\", {\n conversationId: baseChannelId,\n teamThreadId,\n });\n } else {\n // No cached context - try to fetch team details via Bot Framework API\n // TeamsInfo.getTeamDetails() calls /v3/teams/{teamId} and returns aadGroupId\n try {\n const teamDetails = await TeamsInfo.getTeamDetails(context);\n if (teamDetails?.aadGroupId) {\n const fetchedContext: TeamsChannelContext = {\n teamId: teamDetails.aadGroupId,\n channelId: channelData.channel.id,\n tenantId,\n };\n const contextJson = JSON.stringify(fetchedContext);\n\n // Cache by conversation ID\n this.chat\n .getState()\n .set(`teams:channelContext:${baseChannelId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache fetched channel context\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n\n // Also cache by team thread-style ID\n this.chat\n .getState()\n .set(`teams:teamContext:${teamThreadId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache fetched team context\", {\n teamThreadId,\n error: err,\n });\n });\n\n this.logger.info(\n \"Fetched and cached Teams team GUID via TeamsInfo API\",\n {\n conversationId: baseChannelId,\n teamThreadId,\n teamGuid: teamDetails.aadGroupId,\n teamName: teamDetails.name,\n }\n );\n }\n } catch (error) {\n // TeamsInfo.getTeamDetails() only works in team scope\n this.logger.debug(\n \"Could not fetch team details (may not be a team scope)\",\n { teamThreadId, error }\n );\n }\n }\n }\n }\n\n // Handle message reactions\n if (activity.type === ActivityTypes.MessageReaction) {\n this.handleReactionActivity(activity, options);\n return;\n }\n\n // Handle adaptive card actions (button clicks)\n if (activity.type === ActivityTypes.Invoke) {\n await this.handleInvokeActivity(context, options);\n return;\n }\n\n // Only handle message activities\n if (activity.type !== ActivityTypes.Message) {\n this.logger.debug(\"Ignoring non-message activity\", {\n type: activity.type,\n });\n return;\n }\n\n // Check if this message activity is actually a button click (Action.Submit)\n // Teams sends Action.Submit as a message with value.actionId\n const actionValue = activity.value as\n | { actionId?: string; value?: string }\n | undefined;\n if (actionValue?.actionId) {\n this.handleMessageAction(activity, actionValue, options);\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n replyToId: activity.replyToId,\n });\n\n // Let Chat class handle async processing and waitUntil\n this.chat.processMessage(\n this,\n threadId,\n this.parseTeamsMessage(activity, threadId),\n options\n );\n }\n\n /**\n * Handle Action.Submit button clicks sent as message activities.\n * Teams sends these with type \"message\" and value.actionId.\n */\n private handleMessageAction(\n activity: Activity,\n actionValue: { actionId?: string; value?: string },\n options?: WebhookOptions\n ): void {\n if (!(this.chat && actionValue.actionId)) {\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const actionEvent: Omit<ActionEvent, \"thread\" | \"openModal\"> & {\n adapter: TeamsAdapter;\n } = {\n actionId: actionValue.actionId,\n value: actionValue.value,\n user: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: false,\n isMe: false,\n },\n messageId: activity.replyToId || activity.id || \"\",\n threadId,\n adapter: this,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams message action (Action.Submit)\", {\n actionId: actionValue.actionId,\n value: actionValue.value,\n messageId: actionEvent.messageId,\n threadId,\n });\n\n this.chat.processAction(actionEvent, options);\n }\n\n /**\n * Handle invoke activities (adaptive card actions, etc.).\n */\n private async handleInvokeActivity(\n context: TurnContext,\n options?: WebhookOptions\n ): Promise<void> {\n const activity = context.activity;\n\n // Handle adaptive card action invokes\n if (activity.name === \"adaptiveCard/action\") {\n await this.handleAdaptiveCardAction(context, activity, options);\n return;\n }\n\n this.logger.debug(\"Ignoring unsupported invoke\", {\n name: activity.name,\n });\n }\n\n /**\n * Handle adaptive card button clicks.\n * The action data is in activity.value with our { actionId, value } structure.\n */\n private async handleAdaptiveCardAction(\n context: TurnContext,\n activity: Activity,\n options?: WebhookOptions\n ): Promise<void> {\n if (!this.chat) {\n return;\n }\n\n // Activity.value contains our action data\n const actionData = activity.value?.action?.data as\n | { actionId?: string; value?: string }\n | undefined;\n\n if (!actionData?.actionId) {\n this.logger.debug(\"Adaptive card action missing actionId\", {\n value: activity.value,\n });\n // Send acknowledgment response\n await context.sendActivity({\n type: ActivityTypes.InvokeResponse,\n value: { status: 200 },\n });\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const actionEvent: Omit<ActionEvent, \"thread\" | \"openModal\"> & {\n adapter: TeamsAdapter;\n } = {\n actionId: actionData.actionId,\n value: actionData.value,\n user: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: false,\n isMe: false,\n },\n messageId: activity.replyToId || activity.id || \"\",\n threadId,\n adapter: this,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams adaptive card action\", {\n actionId: actionData.actionId,\n value: actionData.value,\n messageId: actionEvent.messageId,\n threadId,\n });\n\n this.chat.processAction(actionEvent, options);\n\n // Send acknowledgment response to prevent timeout\n await context.sendActivity({\n type: ActivityTypes.InvokeResponse,\n value: { status: 200 },\n });\n }\n\n /**\n * Handle Teams reaction events (reactionsAdded/reactionsRemoved).\n */\n private handleReactionActivity(\n activity: Activity,\n options?: WebhookOptions\n ): void {\n if (!this.chat) {\n return;\n }\n\n // Extract the message ID from conversation ID\n // Format: \"19:xxx@thread.tacv2;messageid=1767297849909\"\n const conversationId = activity.conversation?.id || \"\";\n const messageIdMatch = conversationId.match(MESSAGEID_CAPTURE_PATTERN);\n const messageId = messageIdMatch?.[1] || activity.replyToId || \"\";\n\n // Build thread ID - KEEP the full conversation ID including ;messageid=XXX\n // This is required for Teams to reply in the correct thread\n const threadId = this.encodeThreadId({\n conversationId,\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const user = {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name,\n isBot: false,\n isMe: this.isMessageFromSelf(activity),\n };\n\n // Process added reactions\n const reactionsAdded = activity.reactionsAdded || [];\n for (const reaction of reactionsAdded) {\n const rawEmoji = reaction.type || \"\";\n const emojiValue = defaultEmojiResolver.fromTeams(rawEmoji);\n\n const event: Omit<ReactionEvent, \"adapter\" | \"thread\"> = {\n emoji: emojiValue,\n rawEmoji,\n added: true,\n user,\n messageId,\n threadId,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams reaction added\", {\n emoji: emojiValue.name,\n rawEmoji,\n messageId,\n });\n\n this.chat.processReaction({ ...event, adapter: this }, options);\n }\n\n // Process removed reactions\n const reactionsRemoved = activity.reactionsRemoved || [];\n for (const reaction of reactionsRemoved) {\n const rawEmoji = reaction.type || \"\";\n const emojiValue = defaultEmojiResolver.fromTeams(rawEmoji);\n\n const event: Omit<ReactionEvent, \"adapter\" | \"thread\"> = {\n emoji: emojiValue,\n rawEmoji,\n added: false,\n user,\n messageId,\n threadId,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams reaction removed\", {\n emoji: emojiValue.name,\n rawEmoji,\n messageId,\n });\n\n this.chat.processReaction({ ...event, adapter: this }, options);\n }\n }\n\n private parseTeamsMessage(\n activity: Activity,\n threadId: string\n ): Message<unknown> {\n const text = activity.text || \"\";\n // Normalize mentions - format converter will convert <at>name</at> to @name\n const normalizedText = this.normalizeMentions(text, activity);\n\n const isMe = this.isMessageFromSelf(activity);\n\n return new Message({\n id: activity.id || \"\",\n threadId,\n text: this.formatConverter.extractPlainText(normalizedText),\n formatted: this.formatConverter.toAst(normalizedText),\n raw: activity,\n author: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: activity.from?.role === \"bot\",\n isMe,\n },\n metadata: {\n dateSent: activity.timestamp\n ? new Date(activity.timestamp)\n : new Date(),\n edited: false,\n },\n attachments: (activity.attachments || [])\n .filter(\n (att) =>\n // Filter out adaptive cards (handled separately as cards, not attachments)\n att.contentType !== \"application/vnd.microsoft.card.adaptive\" &&\n // Filter out text/html without contentUrl - this is just the formatted\n // version of the message text, not an actual file attachment.\n // Real HTML file attachments would have a contentUrl.\n !(att.contentType === \"text/html\" && !att.contentUrl)\n )\n .map((att) => this.createAttachment(att)),\n });\n }\n\n /**\n * Create an Attachment object from a Teams attachment.\n */\n private createAttachment(att: {\n contentType?: string;\n contentUrl?: string;\n name?: string;\n }): Attachment {\n const url = att.contentUrl;\n\n // Determine type based on contentType\n let type: Attachment[\"type\"] = \"file\";\n if (att.contentType?.startsWith(\"image/\")) {\n type = \"image\";\n } else if (att.contentType?.startsWith(\"video/\")) {\n type = \"video\";\n } else if (att.contentType?.startsWith(\"audio/\")) {\n type = \"audio\";\n }\n\n return {\n type,\n url,\n name: att.name,\n mimeType: att.contentType,\n fetchData: url\n ? async () => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new NetworkError(\n \"teams\",\n `Failed to fetch file: ${response.status} ${response.statusText}`\n );\n }\n const arrayBuffer = await response.arrayBuffer();\n return Buffer.from(arrayBuffer);\n }\n : undefined,\n };\n }\n\n private normalizeMentions(text: string, _activity: Activity): string {\n // Don't strip mentions - the format converter will convert <at>name</at> to @name\n // Just trim any leading/trailing whitespace that might result from mention placement\n return text.trim();\n }\n\n async postMessage(\n threadId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n // Check for files to upload\n const files = extractFiles(message);\n const fileAttachments =\n files.length > 0 ? await this.filesToAttachments(files) : [];\n\n // Check if message contains a card\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n // Render card as Adaptive Card\n const adaptiveCard = cardToAdaptiveCard(card);\n\n activity = {\n type: ActivityTypes.Message,\n // Don't include text - Teams shows both text and card if text is present\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ...fileAttachments,\n ],\n };\n\n this.logger.debug(\"Teams API: sendActivity (adaptive card)\", {\n conversationId,\n serviceUrl,\n fileCount: fileAttachments.length,\n });\n } else {\n // Regular text message\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n\n activity = {\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n attachments: fileAttachments.length > 0 ? fileAttachments : undefined,\n };\n\n this.logger.debug(\"Teams API: sendActivity (message)\", {\n conversationId,\n serviceUrl,\n textLength: text.length,\n fileCount: fileAttachments.length,\n });\n }\n\n // Use the adapter to send the message\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n let messageId = \"\";\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n const response = await context.sendActivity(activity);\n messageId = response?.id || \"\";\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: sendActivity failed\", {\n conversationId,\n error,\n });\n this.handleTeamsError(error, \"postMessage\");\n }\n\n this.logger.debug(\"Teams API: sendActivity response\", { messageId });\n\n return {\n id: messageId,\n threadId,\n raw: activity,\n };\n }\n\n /**\n * Convert files to Teams attachments.\n * Uses inline data URIs for small files.\n */\n private async filesToAttachments(\n files: FileUpload[]\n ): Promise<Array<{ contentType: string; contentUrl: string; name: string }>> {\n const attachments: Array<{\n contentType: string;\n contentUrl: string;\n name: string;\n }> = [];\n\n for (const file of files) {\n // Convert data to Buffer using shared utility\n const buffer = await toBuffer(file.data, {\n platform: \"teams\",\n throwOnUnsupported: false,\n });\n if (!buffer) {\n continue;\n }\n\n // Create data URI using shared utility\n const mimeType = file.mimeType || \"application/octet-stream\";\n const dataUri = bufferToDataUri(buffer, mimeType);\n\n attachments.push({\n contentType: mimeType,\n contentUrl: dataUri,\n name: file.filename,\n });\n }\n\n return attachments;\n }\n\n async editMessage(\n threadId: string,\n messageId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n // Check if message contains a card\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n // Render card as Adaptive Card\n const adaptiveCard = cardToAdaptiveCard(card);\n\n activity = {\n id: messageId,\n type: ActivityTypes.Message,\n // Don't include text - Teams shows both text and card if text is present\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ],\n };\n\n this.logger.debug(\"Teams API: updateActivity (adaptive card)\", {\n conversationId,\n messageId,\n });\n } else {\n // Regular text message\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n\n activity = {\n id: messageId,\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n };\n\n this.logger.debug(\"Teams API: updateActivity\", {\n conversationId,\n messageId,\n textLength: text.length,\n });\n }\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.updateActivity(activity);\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: updateActivity failed\", {\n conversationId,\n messageId,\n error,\n });\n this.handleTeamsError(error, \"editMessage\");\n }\n\n this.logger.debug(\"Teams API: updateActivity response\", { ok: true });\n\n return {\n id: messageId,\n threadId,\n raw: activity,\n };\n }\n\n async deleteMessage(threadId: string, messageId: string): Promise<void> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n this.logger.debug(\"Teams API: deleteActivity\", {\n conversationId,\n messageId,\n });\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.deleteActivity(messageId);\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: deleteActivity failed\", {\n conversationId,\n messageId,\n error,\n });\n this.handleTeamsError(error, \"deleteMessage\");\n }\n\n this.logger.debug(\"Teams API: deleteActivity response\", { ok: true });\n }\n\n async addReaction(\n _threadId: string,\n _messageId: string,\n _emoji: EmojiValue | string\n ): Promise<void> {\n throw new NotImplementedError(\n \"Teams Bot Framework does not expose reaction APIs\",\n \"addReaction\"\n );\n }\n\n async removeReaction(\n _threadId: string,\n _messageId: string,\n _emoji: EmojiValue | string\n ): Promise<void> {\n throw new NotImplementedError(\n \"Teams Bot Framework does not expose reaction APIs\",\n \"removeReaction\"\n );\n }\n\n async startTyping(threadId: string, _status?: string): Promise<void> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n this.logger.debug(\"Teams API: sendActivity (typing)\", { conversationId });\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.sendActivity({ type: ActivityTypes.Typing });\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: sendActivity (typing) failed\", {\n conversationId,\n error,\n });\n this.handleTeamsError(error, \"startTyping\");\n }\n\n this.logger.debug(\"Teams API: sendActivity (typing) response\", {\n ok: true,\n });\n }\n\n /**\n * Open a direct message conversation with a user.\n * Returns a thread ID that can be used to post messages.\n *\n * The serviceUrl and tenantId are automatically resolved from cached user interactions.\n * If no cached values are found, defaults are used (which may not work for all tenants).\n */\n async openDM(userId: string): Promise<string> {\n // Look up cached serviceUrl and tenantId for this user from state\n const cachedServiceUrl = await this.chat\n ?.getState()\n .get<string>(`teams:serviceUrl:${userId}`);\n const cachedTenantId = await this.chat\n ?.getState()\n .get<string>(`teams:tenantId:${userId}`);\n\n const serviceUrl =\n cachedServiceUrl || \"https://smba.trafficmanager.net/teams/\";\n // Use cached tenant ID, config tenant ID, or undefined (will fail for multi-tenant)\n const tenantId = cachedTenantId || this.config.appTenantId;\n\n this.logger.debug(\"Teams: creating 1:1 conversation\", {\n userId,\n serviceUrl,\n tenantId,\n cachedServiceUrl: !!cachedServiceUrl,\n cachedTenantId: !!cachedTenantId,\n });\n\n if (!tenantId) {\n throw new ValidationError(\n \"teams\",\n \"Cannot open DM: tenant ID not found. User must interact with the bot first (via @mention) to cache their tenant ID.\"\n );\n }\n\n let conversationId = \"\";\n\n // Create the 1:1 conversation using createConversationAsync\n // The conversation ID is captured from within the callback, not from the return value\n // biome-ignore lint/suspicious/noExplicitAny: BotBuilder types are incomplete\n await (this.botAdapter as any).createConversationAsync(\n this.config.appId,\n \"msteams\",\n serviceUrl,\n \"\", // empty audience\n {\n isGroup: false,\n bot: { id: this.config.appId, name: this.userName },\n members: [{ id: userId }],\n tenantId,\n channelData: {\n tenant: { id: tenantId },\n },\n },\n async (turnContext: TurnContext) => {\n // Capture the conversation ID from the new context\n conversationId = turnContext?.activity?.conversation?.id || \"\";\n this.logger.debug(\"Teams: conversation created in callback\", {\n conversationId,\n activityId: turnContext?.activity?.id,\n });\n }\n );\n\n if (!conversationId) {\n throw new NetworkError(\n \"teams\",\n \"Failed to create 1:1 conversation - no ID returned\"\n );\n }\n\n this.logger.debug(\"Teams: 1:1 conversation created\", { conversationId });\n\n return this.encodeThreadId({\n conversationId,\n serviceUrl,\n });\n }\n\n async fetchMessages(\n threadId: string,\n options: FetchOptions = {}\n ): Promise<FetchResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams fetchMessages requires appTenantId to be configured for Microsoft Graph API access.\",\n \"fetchMessages\"\n );\n }\n\n const { conversationId } = this.decodeThreadId(threadId);\n const limit = options.limit || 50;\n const cursor = options.cursor;\n const direction = options.direction ?? \"backward\";\n\n // Extract message ID for thread filtering (format: \"19:xxx@thread.tacv2;messageid=123456\")\n const messageIdMatch = conversationId.match(\n SEMICOLON_MESSAGEID_CAPTURE_PATTERN\n );\n const threadMessageId = messageIdMatch?.[1];\n\n // Strip ;messageid= from conversation ID\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n // Try to get cached channel context for proper thread-level message fetching\n let channelContext: TeamsChannelContext | null = null;\n if (threadMessageId && this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Invalid cached data, ignore\n }\n }\n\n // Note: Team GUID is cached during webhook handling via TeamsInfo.getTeamDetails()\n // If no cached context, we'll fall back to the chat endpoint (less accurate for channels)\n }\n\n try {\n this.logger.debug(\"Teams Graph API: fetching messages\", {\n conversationId: baseConversationId,\n threadMessageId,\n hasChannelContext: !!channelContext,\n limit,\n cursor,\n direction,\n });\n\n // If we have channel context and a thread message ID, use the channel replies endpoint\n // This gives us proper thread-level filtering instead of all messages in the channel\n if (channelContext && threadMessageId) {\n return this.fetchChannelThreadMessages(\n channelContext,\n threadMessageId,\n threadId,\n options\n );\n }\n\n // Teams conversation IDs:\n // - Channels: \"19:xxx@thread.tacv2\"\n // - Group chats: \"19:xxx@thread.v2\"\n // - 1:1 chats: other formats (e.g., \"a]xxx\", \"8:orgid:xxx\")\n // For Graph API, we use /chats/{chat-id}/messages for all chat types\n\n // Note: Teams Graph API only supports orderby(\"createdDateTime desc\")\n // Ascending order is not supported, so we work around this limitation.\n // Also, max page size is 50 messages per request.\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (direction === \"forward\") {\n // Forward direction: need to fetch ALL messages to find the oldest ones\n // since API only supports descending order. Paginate with max 50 per request.\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient\n .api(apiUrl)\n .top(50) // Max allowed by Teams API\n .orderby(\"createdDateTime desc\");\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allMessages.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse to get chronological order (oldest first)\n allMessages.reverse();\n\n // Find starting position based on cursor (cursor is a timestamp)\n let startIndex = 0;\n if (cursor) {\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n\n // Check if there are more messages beyond our slice\n hasMoreMessages = startIndex + limit < allMessages.length;\n // Take only the requested limit\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n // Backward direction: simple pagination\n let request = this.graphClient\n .api(`/chats/${encodeURIComponent(baseConversationId)}/messages`)\n .top(limit)\n .orderby(\"createdDateTime desc\");\n\n if (cursor) {\n // Get messages older than cursor\n request = request.filter(`createdDateTime lt ${cursor}`);\n }\n\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n\n // API returns newest first, reverse to get chronological order\n graphMessages.reverse();\n\n // We have more if we got a full page\n hasMoreMessages = graphMessages.length >= limit;\n }\n\n // For group chats (non-channel), filter to only messages from the \"thread\" onwards.\n // Teams group chats don't have real threading - the messageid in the conversation ID\n // is just UI context. We filter by message ID (which is a timestamp) to simulate threading.\n if (threadMessageId && !channelContext) {\n graphMessages = graphMessages.filter((msg) => {\n // Include messages with ID >= thread message ID (IDs are timestamps)\n return msg.id && msg.id >= threadMessageId;\n });\n this.logger.debug(\"Filtered group chat messages to thread\", {\n threadMessageId,\n filteredCount: graphMessages.length,\n });\n }\n\n this.logger.debug(\"Teams Graph API: fetched messages\", {\n count: graphMessages.length,\n direction,\n hasMoreMessages,\n });\n\n const messages = graphMessages.map((msg: GraphChatMessage) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n return new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n // Determine nextCursor based on direction\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n // Forward: use the newest message's timestamp (last in returned slice)\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n // Backward: use the oldest message's timestamp (first in returned array)\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n } catch (error) {\n this.logger.error(\"Teams Graph API: fetchMessages error\", { error });\n\n // Check if it's a permission error\n if (error instanceof Error && error.message?.includes(\"403\")) {\n throw new NotImplementedError(\n \"Teams fetchMessages requires one of these Azure AD app permissions: ChatMessage.Read.Chat, Chat.Read.All, or Chat.Read.WhereInstalled\",\n \"fetchMessages\"\n );\n }\n\n throw error;\n }\n }\n\n /**\n * Fetch messages from a Teams channel thread using the channel-specific Graph API endpoint.\n * This provides proper thread-level filtering by fetching only replies to a specific message.\n *\n * Endpoint: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies\n */\n private async fetchChannelThreadMessages(\n context: TeamsChannelContext,\n threadMessageId: string,\n threadId: string,\n options: FetchOptions\n ): Promise<FetchResult<unknown>> {\n const limit = options.limit || 50;\n const cursor = options.cursor;\n const direction = options.direction ?? \"backward\";\n\n this.logger.debug(\"Teams Graph API: fetching channel thread messages\", {\n teamId: context.teamId,\n channelId: context.channelId,\n threadMessageId,\n limit,\n cursor,\n direction,\n });\n\n // Build the endpoint URLs:\n // Parent message: /teams/{team-id}/channels/{channel-id}/messages/{message-id}\n // Replies: /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies\n const parentUrl = `/teams/${encodeURIComponent(context.teamId)}/channels/${encodeURIComponent(context.channelId)}/messages/${encodeURIComponent(threadMessageId)}`;\n const repliesUrl = `${parentUrl}/replies`;\n\n const graphClient = this.graphClient;\n if (!graphClient) {\n throw new AuthenticationError(\"teams\", \"Graph client not initialized\");\n }\n\n // Fetch the parent message (the original message that started the thread)\n let parentMessage: GraphChatMessage | null = null;\n try {\n parentMessage = (await graphClient\n .api(parentUrl)\n .get()) as GraphChatMessage;\n } catch (err) {\n this.logger.warn(\"Failed to fetch parent message\", {\n threadMessageId,\n err,\n });\n }\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (direction === \"forward\") {\n // Forward direction: fetch all replies and paginate in chronological order (oldest first)\n // Graph API returns messages in descending order (newest first), so we must reverse\n const allReplies: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n\n do {\n const request = nextLink\n ? graphClient.api(nextLink)\n : graphClient.api(repliesUrl).top(50);\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allReplies.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse replies to get chronological order (oldest first)\n allReplies.reverse();\n\n // Prepend parent message (it's the oldest - started the thread)\n const allMessages = parentMessage\n ? [parentMessage, ...allReplies]\n : allReplies;\n\n // Find starting position based on cursor\n let startIndex = 0;\n if (cursor) {\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n // Backward direction: return most recent messages in chronological order\n // Graph API returns messages in descending order (newest first)\n const allReplies: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n\n do {\n const request = nextLink\n ? graphClient.api(nextLink)\n : graphClient.api(repliesUrl).top(50);\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allReplies.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse replies to get chronological order (oldest first)\n allReplies.reverse();\n\n // Prepend parent message (it's the oldest - started the thread)\n const allMessages = parentMessage\n ? [parentMessage, ...allReplies]\n : allReplies;\n\n if (cursor) {\n // Find position of cursor (cursor is timestamp of the oldest message in previous batch)\n // We want messages OLDER than cursor (earlier in chronological order)\n const cursorIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime >= cursor\n );\n if (cursorIndex > 0) {\n // Take messages before the cursor position\n const sliceStart = Math.max(0, cursorIndex - limit);\n graphMessages = allMessages.slice(sliceStart, cursorIndex);\n hasMoreMessages = sliceStart > 0;\n } else {\n // Cursor not found or at start - take the most recent (end of array)\n graphMessages = allMessages.slice(-limit);\n hasMoreMessages = allMessages.length > limit;\n }\n } else {\n // No cursor - get the most recent messages (end of chronological array)\n graphMessages = allMessages.slice(-limit);\n hasMoreMessages = allMessages.length > limit;\n }\n }\n\n this.logger.debug(\"Teams Graph API: fetched channel thread messages\", {\n count: graphMessages.length,\n direction,\n hasMoreMessages,\n });\n\n const messages = graphMessages.map((msg: GraphChatMessage) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n return new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId: msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n // Determine nextCursor\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n }\n\n /**\n * Extract plain text from a Graph API message.\n */\n private extractTextFromGraphMessage(msg: GraphChatMessage): string {\n // body.content contains the message text (HTML or text depending on contentType)\n if (msg.body?.contentType === \"text\") {\n return msg.body.content || \"\";\n }\n\n // For HTML content, strip tags (basic implementation)\n let text = \"\";\n if (msg.body?.content) {\n text = msg.body.content.replace(/<[^>]*>/g, \"\").trim();\n }\n\n // If text is empty but message has adaptive card attachments, try to extract card title\n if (!text && msg.attachments?.length) {\n for (const att of msg.attachments) {\n if (att.contentType === \"application/vnd.microsoft.card.adaptive\") {\n try {\n const card = JSON.parse(att.content || \"{}\");\n // Look for title in common locations\n const title = this.extractCardTitle(card);\n if (title) {\n return title;\n }\n return \"[Card]\";\n } catch {\n return \"[Card]\";\n }\n }\n }\n }\n\n return text;\n }\n\n /**\n * Extract a title/summary from an Adaptive Card structure.\n */\n private extractCardTitle(card: unknown): string | null {\n if (!card || typeof card !== \"object\") {\n return null;\n }\n\n const cardObj = card as Record<string, unknown>;\n\n // Check for body array and find first TextBlock with large/bolder style (likely title)\n if (Array.isArray(cardObj.body)) {\n for (const element of cardObj.body) {\n if (\n element &&\n typeof element === \"object\" &&\n (element as Record<string, unknown>).type === \"TextBlock\"\n ) {\n const textBlock = element as Record<string, unknown>;\n // Title blocks often have weight: \"bolder\" or size: \"large\"\n if (\n textBlock.weight === \"bolder\" ||\n textBlock.size === \"large\" ||\n textBlock.size === \"extraLarge\"\n ) {\n const text = textBlock.text;\n if (typeof text === \"string\") {\n return text;\n }\n }\n }\n }\n // Fallback: just get first TextBlock's text\n for (const element of cardObj.body) {\n if (\n element &&\n typeof element === \"object\" &&\n (element as Record<string, unknown>).type === \"TextBlock\"\n ) {\n const text = (element as Record<string, unknown>).text;\n if (typeof text === \"string\") {\n return text;\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Extract attachments from a Graph API message.\n */\n private extractAttachmentsFromGraphMessage(\n msg: GraphChatMessage\n ): Attachment[] {\n if (!msg.attachments?.length) {\n return [];\n }\n\n return msg.attachments.map((att) => ({\n type: att.contentType?.includes(\"image\") ? \"image\" : \"file\",\n name: att.name || undefined,\n url: att.contentUrl || undefined,\n mimeType: att.contentType || undefined,\n }));\n }\n\n async fetchThread(threadId: string): Promise<ThreadInfo> {\n const { conversationId } = this.decodeThreadId(threadId);\n\n return {\n id: threadId,\n channelId: conversationId,\n metadata: {},\n };\n }\n\n /**\n * Derive channel ID from a Teams thread ID.\n * Teams conversation IDs may include \";messageid=XXX\" for threading.\n * Strip the messageid part to get the base channel/conversation.\n */\n channelIdFromThreadId(threadId: string): string {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n // Strip ;messageid=XXX from conversation ID\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n return this.encodeThreadId({\n conversationId: baseConversationId,\n serviceUrl,\n });\n }\n\n /**\n * Fetch channel-level messages (all messages in the conversation, not filtered by thread).\n * Uses the Graph API for chat messages.\n */\n async fetchChannelMessages(\n channelId: string,\n options: FetchOptions = {}\n ): Promise<FetchResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams fetchChannelMessages requires appTenantId for Microsoft Graph API access.\",\n \"fetchChannelMessages\"\n );\n }\n\n const { conversationId } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n const limit = options.limit || 50;\n const direction = options.direction ?? \"backward\";\n\n try {\n // Check if we have channel context (team channel vs group chat)\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore invalid cache\n }\n }\n }\n\n this.logger.debug(\"Teams Graph API: fetchChannelMessages\", {\n conversationId: baseConversationId,\n hasChannelContext: !!channelContext,\n limit,\n direction,\n });\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (channelContext) {\n // Team channel: use /teams/{teamId}/channels/{channelId}/messages\n const apiUrl = `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}/messages`;\n\n if (direction === \"forward\") {\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient.api(apiUrl).top(50);\n const response = await request.get();\n allMessages.push(...((response.value || []) as GraphChatMessage[]));\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n allMessages.reverse();\n let startIndex = 0;\n if (options.cursor) {\n const cursor = options.cursor;\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n const request = this.graphClient.api(apiUrl).top(limit);\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n graphMessages.reverse();\n hasMoreMessages = graphMessages.length >= limit;\n }\n } else {\n // Group chat / 1:1: use /chats/{chatId}/messages\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n\n if (direction === \"forward\") {\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient\n .api(apiUrl)\n .top(50)\n .orderby(\"createdDateTime desc\");\n const response = await request.get();\n allMessages.push(...((response.value || []) as GraphChatMessage[]));\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n allMessages.reverse();\n let startIndex = 0;\n if (options.cursor) {\n const cursor = options.cursor;\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n let request = this.graphClient\n .api(apiUrl)\n .top(limit)\n .orderby(\"createdDateTime desc\");\n if (options.cursor) {\n request = request.filter(`createdDateTime lt ${options.cursor}`);\n }\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n graphMessages.reverse();\n hasMoreMessages = graphMessages.length >= limit;\n }\n }\n\n const messages = graphMessages.map((msg) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n return new Message({\n id: msg.id,\n threadId: channelId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n } catch (error) {\n this.logger.error(\"Teams Graph API: fetchChannelMessages error\", {\n error,\n });\n throw error;\n }\n }\n\n /**\n * List threads in a Teams channel.\n * For team channels, fetches messages and filters for those with replies.\n * For group chats, threads are based on message IDs in conversation references.\n */\n async listThreads(\n channelId: string,\n options: ListThreadsOptions = {}\n ): Promise<ListThreadsResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams listThreads requires appTenantId for Microsoft Graph API access.\",\n \"listThreads\"\n );\n }\n\n const { conversationId, serviceUrl } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n const limit = options.limit || 50;\n\n try {\n // Check for channel context\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore\n }\n }\n }\n\n this.logger.debug(\"Teams Graph API: listThreads\", {\n conversationId: baseConversationId,\n hasChannelContext: !!channelContext,\n limit,\n });\n\n const threads: ThreadSummary[] = [];\n\n if (channelContext) {\n // Team channel: fetch messages and find those with replies\n const apiUrl = `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}/messages`;\n const response = await this.graphClient.api(apiUrl).top(limit).get();\n const messages = (response.value || []) as (GraphChatMessage & {\n replies?: GraphChatMessage[];\n })[];\n\n for (const msg of messages) {\n if (!msg.id) {\n continue;\n }\n const threadId = this.encodeThreadId({\n conversationId: `${baseConversationId};messageid=${msg.id}`,\n serviceUrl,\n });\n\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n threads.push({\n id: threadId,\n rootMessage: new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n }),\n lastReplyAt: msg.lastModifiedDateTime\n ? new Date(msg.lastModifiedDateTime)\n : undefined,\n });\n }\n } else {\n // Group chat: list recent messages as \"threads\"\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n const response = await this.graphClient\n .api(apiUrl)\n .top(limit)\n .orderby(\"createdDateTime desc\")\n .get();\n\n const messages = (response.value || []) as GraphChatMessage[];\n\n for (const msg of messages) {\n if (!msg.id) {\n continue;\n }\n const threadId = this.encodeThreadId({\n conversationId: `${baseConversationId};messageid=${msg.id}`,\n serviceUrl,\n });\n\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n threads.push({\n id: threadId,\n rootMessage: new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n }),\n });\n }\n }\n\n this.logger.debug(\"Teams Graph API: listThreads result\", {\n threadCount: threads.length,\n });\n\n return { threads };\n } catch (error) {\n this.logger.error(\"Teams Graph API: listThreads error\", { error });\n throw error;\n }\n }\n\n /**\n * Fetch Teams channel/conversation info.\n */\n async fetchChannelInfo(channelId: string): Promise<ChannelInfo> {\n const { conversationId } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n // Check for channel context\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore\n }\n }\n }\n\n if (channelContext && this.graphClient) {\n try {\n this.logger.debug(\"Teams Graph API: GET channel info\", {\n teamId: channelContext.teamId,\n channelId: channelContext.channelId,\n });\n\n const response = await this.graphClient\n .api(\n `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}`\n )\n .get();\n\n return {\n id: channelId,\n name: response.displayName,\n isDM: false,\n memberCount: response.memberCount,\n metadata: {\n membershipType: response.membershipType,\n description: response.description,\n raw: response,\n },\n };\n } catch (error) {\n this.logger.warn(\"Teams Graph API: channel info failed\", { error });\n }\n }\n\n // Fallback for group chats or when Graph API is not available\n return {\n id: channelId,\n isDM: this.isDM(channelId),\n metadata: {\n conversationId: baseConversationId,\n },\n };\n }\n\n /**\n * Post a message to the channel top-level (not in a thread).\n * Uses a conversation reference without ;messageid= to post at the top level.\n */\n async postChannelMessage(\n channelId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(channelId);\n // Ensure we use the base conversation ID (no messageid)\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n const files = extractFiles(message);\n const fileAttachments =\n files.length > 0 ? await this.filesToAttachments(files) : [];\n\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n const adaptiveCard = cardToAdaptiveCard(card);\n activity = {\n type: ActivityTypes.Message,\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ...fileAttachments,\n ],\n };\n } else {\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n activity = {\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n attachments: fileAttachments.length > 0 ? fileAttachments : undefined,\n };\n }\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: baseConversationId },\n };\n\n let messageId = \"\";\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n const response = await context.sendActivity(activity);\n messageId = response?.id || \"\";\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: postChannelMessage failed\", {\n conversationId: baseConversationId,\n error,\n });\n this.handleTeamsError(error, \"postChannelMessage\");\n }\n\n this.logger.debug(\"Teams API: postChannelMessage response\", { messageId });\n\n return {\n id: messageId,\n threadId: channelId,\n raw: activity,\n };\n }\n\n encodeThreadId(platformData: TeamsThreadId): string {\n // Base64 encode both since conversationId and serviceUrl can contain special characters\n const encodedConversationId = Buffer.from(\n platformData.conversationId\n ).toString(\"base64url\");\n const encodedServiceUrl = Buffer.from(platformData.serviceUrl).toString(\n \"base64url\"\n );\n return `teams:${encodedConversationId}:${encodedServiceUrl}`;\n }\n\n /**\n * Check if a thread is a direct message conversation.\n * Teams DMs have conversation IDs that don't start with \"19:\" (which is for groups/channels).\n */\n isDM(threadId: string): boolean {\n const { conversationId } = this.decodeThreadId(threadId);\n // Group chats and channels start with \"19:\", DMs don't\n return !conversationId.startsWith(\"19:\");\n }\n\n decodeThreadId(threadId: string): TeamsThreadId {\n const parts = threadId.split(\":\");\n if (parts.length !== 3 || parts[0] !== \"teams\") {\n throw new ValidationError(\n \"teams\",\n `Invalid Teams thread ID: ${threadId}`\n );\n }\n const conversationId = Buffer.from(\n parts[1] as string,\n \"base64url\"\n ).toString(\"utf-8\");\n const serviceUrl = Buffer.from(parts[2] as string, \"base64url\").toString(\n \"utf-8\"\n );\n return { conversationId, serviceUrl };\n }\n\n parseMessage(raw: unknown): Message<unknown> {\n const activity = raw as Activity;\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n return this.parseTeamsMessage(activity, threadId);\n }\n\n /**\n * Check if a Teams activity is from this bot.\n *\n * Teams bot IDs can appear in different formats:\n * - Just the app ID: \"abc123-def456-...\"\n * - With prefix: \"28:abc123-def456-...\"\n *\n * We check both exact match and suffix match (after colon delimiter)\n * to handle all formats safely.\n */\n private isMessageFromSelf(activity: Activity): boolean {\n const fromId = activity.from?.id;\n if (!(fromId && this.config.appId)) {\n return false;\n }\n\n // Exact match (bot ID is just the app ID)\n if (fromId === this.config.appId) {\n return true;\n }\n\n // Teams format: \"28:{appId}\" or similar prefix patterns\n // Check if it ends with our appId after a colon delimiter\n if (fromId.endsWith(`:${this.config.appId}`)) {\n return true;\n }\n\n return false;\n }\n\n renderFormatted(content: FormattedContent): string {\n return this.formatConverter.fromAst(content);\n }\n\n /**\n * Convert Teams/BotBuilder errors to standardized AdapterError types.\n */\n private handleTeamsError(error: unknown, operation: string): never {\n // Handle BotBuilder errors with status codes\n if (error && typeof error === \"object\") {\n const err = error as Record<string, unknown>;\n\n // Check for HTTP status code\n const statusCode =\n (err.statusCode as number) ||\n (err.status as number) ||\n (err.code as number);\n\n if (statusCode === 401 || statusCode === 403) {\n throw new AuthenticationError(\n \"teams\",\n `Authentication failed for ${operation}: ${err.message || \"unauthorized\"}`\n );\n }\n\n if (statusCode === 404) {\n throw new NetworkError(\n \"teams\",\n `Resource not found during ${operation}: conversation or message may no longer exist`,\n error instanceof Error ? error : undefined\n );\n }\n\n if (statusCode === 429) {\n const retryAfter =\n typeof err.retryAfter === \"number\" ? err.retryAfter : undefined;\n throw new AdapterRateLimitError(\"teams\", retryAfter);\n }\n\n // Permission errors\n if (\n statusCode === 403 ||\n (err.message &&\n typeof err.message === \"string\" &&\n err.message.toLowerCase().includes(\"permission\"))\n ) {\n throw new PermissionError(\"teams\", operation);\n }\n\n // Generic error with message\n if (err.message && typeof err.message === \"string\") {\n throw new NetworkError(\n \"teams\",\n `Teams API error during ${operation}: ${err.message}`,\n error instanceof Error ? error : undefined\n );\n }\n }\n\n // Fallback for unknown error types\n throw new NetworkError(\n \"teams\",\n `Teams API error during ${operation}: ${String(error)}`,\n error instanceof Error ? error : undefined\n );\n }\n}\n\nexport function createTeamsAdapter(\n config?: Partial<TeamsAdapterConfig>\n): TeamsAdapter {\n const appId = config?.appId ?? process.env.TEAMS_APP_ID;\n if (!appId) {\n throw new ValidationError(\n \"teams\",\n \"appId is required. Set TEAMS_APP_ID or provide it in config.\"\n );\n }\n const appPassword = config?.appPassword ?? process.env.TEAMS_APP_PASSWORD;\n if (!appPassword) {\n throw new ValidationError(\n \"teams\",\n \"appPassword is required. Set TEAMS_APP_PASSWORD or provide it in config.\"\n );\n }\n const resolved: TeamsAdapterConfig = {\n appId,\n appPassword,\n appTenantId: config?.appTenantId ?? process.env.TEAMS_APP_TENANT_ID,\n appType: config?.appType,\n logger: config?.logger ?? new ConsoleLogger(\"info\").child(\"teams\"),\n userName: config?.userName,\n };\n return new TeamsAdapter(resolved);\n}\n\n// Re-export card converter for advanced use\nexport { cardToAdaptiveCard, cardToFallbackText } from \"./cards\";\nexport { TeamsFormatConverter } from \"./markdown\";\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @enum\n * Enum for RequestMethods\n * @property {string} GET - The get request type\n * @property {string} PATCH - The patch request type\n * @property {string} POST - The post request type\n * @property {string} PUT - The put request type\n * @property {string} DELETE - The delete request type\n */\nexport enum RequestMethod {\n\tGET = \"GET\",\n\tPATCH = \"PATCH\",\n\tPOST = \"POST\",\n\tPUT = \"PUT\",\n\tDELETE = \"DELETE\",\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module BatchRequestContent\n */\nimport { RequestMethod } from \"../RequestMethod\";\n\n/**\n * @interface\n * Signature to represent the buffer request body parsing method\n * @property {Function} buffer - Returns a promise that resolves to a buffer of the request body\n */\ninterface NodeBody {\n\tbuffer(): Promise<Buffer>;\n}\n\n/**\n * @interface\n * Signature to represent the Request for both Node and browser environments\n * @extends Request\n * @extends NodeBody\n */\ninterface IsomorphicRequest extends Request, NodeBody {}\n\n/**\n * @interface\n * Signature representing BatchRequestStep data\n * @property {string} id - Unique identity for the request, Should not be an empty string\n * @property {string[]} [dependsOn] - Array of dependencies\n * @property {Request} request - The Request object\n */\nexport interface BatchRequestStep {\n\tid: string;\n\tdependsOn?: string[];\n\trequest: Request;\n}\n\n/**\n * @interface\n * Signature representing single request in a Batching\n * @extends RequestInit\n * @see {@link https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L1337} and {@link https://fetch.spec.whatwg.org/#requestinit}\n *\n * @property {string} url - The url value of the request\n */\n\nexport interface RequestData extends RequestInit {\n\turl: string;\n}\n\n/**\n * @interface\n * Signature representing batch request data\n * @property {string} id - Unique identity for the request, Should not be an empty string\n * @property {string[]} [dependsOn] - Array of dependencies\n */\nexport interface BatchRequestData extends RequestData {\n\tid: string;\n\tdependsOn?: string[];\n}\n\n/**\n * @interface\n * Signature representing batch request body\n * @property {BatchRequestData[]} requests - Array of request data, a json representation of requests for batch\n */\n\nexport interface BatchRequestBody {\n\trequests: BatchRequestData[];\n}\n\n/**\n * @class\n * Class for handling BatchRequestContent\n */\nexport class BatchRequestContent {\n\t/**\n\t * @private\n\t * @static\n\t * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}\n\t */\n\tprivate static requestLimit = 20;\n\n\t/**\n\t * @public\n\t * To keep track of requests, key will be id of the request and value will be the request json\n\t */\n\tpublic requests: Map<string, BatchRequestStep>;\n\n\t/**\n\t * @private\n\t * @static\n\t * Validates the dependency chain of the requests\n\t *\n\t * Note:\n\t * 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:\n\t * 1. Parallel - no individual request states a dependency in the dependsOn property.\n\t * 2. Serial - all individual requests depend on the previous individual request.\n\t * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.\n\t * As JSON batching matures, these limitations will be removed.\n\t * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}\n\t *\n\t * @param {Map<string, BatchRequestStep>} requests - The map of requests.\n\t * @returns The boolean indicating the validation status\n\t */\n\n\tprivate static validateDependencies(requests: Map<string, BatchRequestStep>): boolean {\n\t\tconst isParallel = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq = cur.value[1];\n\t\t\t\tif (curReq.dependsOn !== undefined && curReq.dependsOn.length > 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tconst isSerial = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\tconst firstRequest: BatchRequestStep = cur.value[1];\n\t\t\tif (firstRequest.dependsOn !== undefined && firstRequest.dependsOn.length > 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tlet prev = cur;\n\t\t\tcur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq: BatchRequestStep = cur.value[1];\n\t\t\t\tif (curReq.dependsOn === undefined || curReq.dependsOn.length !== 1 || curReq.dependsOn[0] !== prev.value[1].id) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tprev = cur;\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tconst isSame = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\tconst firstRequest: BatchRequestStep = cur.value[1];\n\t\t\tlet dependencyId: string;\n\t\t\tif (firstRequest.dependsOn === undefined || firstRequest.dependsOn.length === 0) {\n\t\t\t\tdependencyId = firstRequest.id;\n\t\t\t} else {\n\t\t\t\tif (firstRequest.dependsOn.length === 1) {\n\t\t\t\t\tconst fDependencyId = firstRequest.dependsOn[0];\n\t\t\t\t\tif (fDependencyId !== firstRequest.id && reqs.has(fDependencyId)) {\n\t\t\t\t\t\tdependencyId = fDependencyId;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq = cur.value[1];\n\t\t\t\tif ((curReq.dependsOn === undefined || curReq.dependsOn.length === 0) && dependencyId !== curReq.id) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (curReq.dependsOn !== undefined && curReq.dependsOn.length !== 0) {\n\t\t\t\t\tif (curReq.dependsOn.length === 1 && (curReq.id === dependencyId || curReq.dependsOn[0] !== dependencyId)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (curReq.dependsOn.length > 1) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tif (requests.size === 0) {\n\t\t\tconst error = new Error(\"Empty requests map, Please provide at least one request.\");\n\t\t\terror.name = \"Empty Requests Error\";\n\t\t\tthrow error;\n\t\t}\n\t\treturn isParallel(requests) || isSerial(requests) || isSame(requests);\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Converts Request Object instance to a JSON\n\t * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance\n\t * @returns A promise that resolves to JSON representation of a request\n\t */\n\tprivate static async getRequestData(request: IsomorphicRequest): Promise<RequestData> {\n\t\tconst requestData: RequestData = {\n\t\t\turl: \"\",\n\t\t};\n\t\tconst hasHttpRegex = new RegExp(\"^https?://\");\n\t\t// Stripping off hostname, port and url scheme\n\t\trequestData.url = hasHttpRegex.test(request.url) ? \"/\" + request.url.split(/.*?\\/\\/.*?\\//)[1] : request.url;\n\t\trequestData.method = request.method;\n\t\tconst headers = {};\n\t\trequest.headers.forEach((value, key) => {\n\t\t\theaders[key] = value;\n\t\t});\n\t\tif (Object.keys(headers).length) {\n\t\t\trequestData.headers = headers;\n\t\t}\n\t\tif (request.method === RequestMethod.PATCH || request.method === RequestMethod.POST || request.method === RequestMethod.PUT) {\n\t\t\trequestData.body = await BatchRequestContent.getRequestBody(request);\n\t\t}\n\t\t/**\n\t\t * TODO: Check any other property needs to be used from the Request object and add them\n\t\t */\n\t\treturn requestData;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Gets the body of a Request object instance\n\t * @param {IsomorphicRequest} request - The IsomorphicRequest object instance\n\t * @returns The Promise that resolves to a body value of a Request\n\t */\n\tprivate static async getRequestBody(request: IsomorphicRequest): Promise<any> {\n\t\tlet bodyParsed = false;\n\t\tlet body;\n\t\ttry {\n\t\t\tconst cloneReq = request.clone();\n\t\t\tbody = await cloneReq.json();\n\t\t\tbodyParsed = true;\n\t\t} catch (e) {\n\t\t\t//TODO- Handle empty catches\n\t\t}\n\t\tif (!bodyParsed) {\n\t\t\ttry {\n\t\t\t\tif (typeof Blob !== \"undefined\") {\n\t\t\t\t\tconst blob = await request.blob();\n\t\t\t\t\tconst reader = new FileReader();\n\t\t\t\t\tbody = await new Promise((resolve) => {\n\t\t\t\t\t\treader.addEventListener(\n\t\t\t\t\t\t\t\"load\",\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tconst dataURL = reader.result as string;\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Some valid dataURL schemes:\n\t\t\t\t\t\t\t\t * 1. data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh\n\t\t\t\t\t\t\t\t * 2. data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678\n\t\t\t\t\t\t\t\t * 3. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * 4. data:image/png,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * 5. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * @see Syntax {@link https://en.wikipedia.org/wiki/Data_URI_scheme} for more\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst regex = new RegExp(\"^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$\");\n\t\t\t\t\t\t\t\tconst segments = regex.exec(dataURL);\n\t\t\t\t\t\t\t\tresolve(segments[4]);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treader.readAsDataURL(blob);\n\t\t\t\t\t});\n\t\t\t\t} else if (typeof Buffer !== \"undefined\") {\n\t\t\t\t\tconst buffer = await request.buffer();\n\t\t\t\t\tbody = buffer.toString(\"base64\");\n\t\t\t\t}\n\t\t\t\tbodyParsed = true;\n\t\t\t} catch (e) {\n\t\t\t\t// TODO-Handle empty catches\n\t\t\t}\n\t\t}\n\t\treturn body;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a BatchRequestContent instance\n\t * @param {BatchRequestStep[]} [requests] - Array of requests value\n\t * @returns An instance of a BatchRequestContent\n\t */\n\tpublic constructor(requests?: BatchRequestStep[]) {\n\t\tthis.requests = new Map();\n\t\tif (typeof requests !== \"undefined\") {\n\t\t\tconst limit = BatchRequestContent.requestLimit;\n\t\t\tif (requests.length > limit) {\n\t\t\t\tconst error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);\n\t\t\t\terror.name = \"Limit Exceeded Error\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tfor (const req of requests) {\n\t\t\t\tthis.addRequest(req);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Adds a request to the batch request content\n\t * @param {BatchRequestStep} request - The request value\n\t * @returns The id of the added request\n\t */\n\tpublic addRequest(request: BatchRequestStep): string {\n\t\tconst limit = BatchRequestContent.requestLimit;\n\t\tif (request.id === \"\") {\n\t\t\tconst error = new Error(`Id for a request is empty, Please provide an unique id`);\n\t\t\terror.name = \"Empty Id For Request\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (this.requests.size === limit) {\n\t\t\tconst error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);\n\t\t\terror.name = \"Limit Exceeded Error\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (this.requests.has(request.id)) {\n\t\t\tconst error = new Error(`Adding request with duplicate id ${request.id}, Make the id of the requests unique`);\n\t\t\terror.name = \"Duplicate RequestId Error\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.requests.set(request.id, request);\n\t\treturn request.id;\n\t}\n\n\t/**\n\t * @public\n\t * Removes request from the batch payload and its dependencies from all dependents\n\t * @param {string} requestId - The id of a request that needs to be removed\n\t * @returns The boolean indicating removed status\n\t */\n\tpublic removeRequest(requestId: string): boolean {\n\t\tconst deleteStatus = this.requests.delete(requestId);\n\t\tconst iterator = this.requests.entries();\n\t\tlet cur = iterator.next();\n\t\t/**\n\t\t * Removing dependencies where this request is present as a dependency\n\t\t */\n\t\twhile (!cur.done) {\n\t\t\tconst dependencies = cur.value[1].dependsOn;\n\t\t\tif (typeof dependencies !== \"undefined\") {\n\t\t\t\tconst index = dependencies.indexOf(requestId);\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tdependencies.splice(index, 1);\n\t\t\t\t}\n\t\t\t\tif (dependencies.length === 0) {\n\t\t\t\t\tdelete cur.value[1].dependsOn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcur = iterator.next();\n\t\t}\n\t\treturn deleteStatus;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Serialize content from BatchRequestContent instance\n\t * @returns The body content to make batch request\n\t */\n\tpublic async getContent(): Promise<BatchRequestBody> {\n\t\tconst requests: BatchRequestData[] = [];\n\t\tconst requestBody: BatchRequestBody = {\n\t\t\trequests,\n\t\t};\n\t\tconst iterator = this.requests.entries();\n\t\tlet cur = iterator.next();\n\t\tif (cur.done) {\n\t\t\tconst error = new Error(\"No requests added yet, Please add at least one request.\");\n\t\t\terror.name = \"Empty Payload\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (!BatchRequestContent.validateDependencies(this.requests)) {\n\t\t\tconst error = new Error(`Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.`);\n\t\t\terror.name = \"Invalid Dependency\";\n\t\t\tthrow error;\n\t\t}\n\t\twhile (!cur.done) {\n\t\t\tconst requestStep: BatchRequestStep = cur.value[1];\n\t\t\tconst batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData;\n\t\t\t/**\n\t\t\t * @see{@https://tools.ietf.org/html/rfc7578#section-4.4}\n\t\t\t * TODO- Setting/Defaulting of content-type header to the correct value\n\t\t\t * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format}\n\t\t\t */\n\t\t\tif (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers[\"content-type\"] === undefined)) {\n\t\t\t\tconst error = new Error(`Content-type header is not mentioned for request #${requestStep.id}, For request having body, Content-type header should be mentioned`);\n\t\t\t\terror.name = \"Invalid Content-type header\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbatchRequestData.id = requestStep.id;\n\t\t\tif (requestStep.dependsOn !== undefined && requestStep.dependsOn.length > 0) {\n\t\t\t\tbatchRequestData.dependsOn = requestStep.dependsOn;\n\t\t\t}\n\t\t\trequests.push(batchRequestData);\n\t\t\tcur = iterator.next();\n\t\t}\n\t\trequestBody.requests = requests;\n\t\treturn requestBody;\n\t}\n\n\t/**\n\t * @public\n\t * Adds a dependency for a given dependent request\n\t * @param {string} dependentId - The id of the dependent request\n\t * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency\n\t * @returns Nothing\n\t */\n\tpublic addDependency(dependentId: string, dependencyId?: string): void {\n\t\tif (!this.requests.has(dependentId)) {\n\t\t\tconst error = new Error(`Dependent ${dependentId} does not exists, Please check the id`);\n\t\t\terror.name = \"Invalid Dependent\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\" && !this.requests.has(dependencyId)) {\n\t\t\tconst error = new Error(`Dependency ${dependencyId} does not exists, Please check the id`);\n\t\t\terror.name = \"Invalid Dependency\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\") {\n\t\t\tconst dependent = this.requests.get(dependentId);\n\t\t\tif (dependent.dependsOn === undefined) {\n\t\t\t\tdependent.dependsOn = [];\n\t\t\t}\n\t\t\tif (dependent.dependsOn.indexOf(dependencyId) !== -1) {\n\t\t\t\tconst error = new Error(`Dependency ${dependencyId} is already added for the request ${dependentId}`);\n\t\t\t\terror.name = \"Duplicate Dependency\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tdependent.dependsOn.push(dependencyId);\n\t\t} else {\n\t\t\tconst iterator = this.requests.entries();\n\t\t\tlet prev;\n\t\t\tlet cur = iterator.next();\n\t\t\twhile (!cur.done && cur.value[1].id !== dependentId) {\n\t\t\t\tprev = cur;\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\tif (typeof prev !== \"undefined\") {\n\t\t\t\tconst dId = prev.value[0];\n\t\t\t\tif (cur.value[1].dependsOn === undefined) {\n\t\t\t\t\tcur.value[1].dependsOn = [];\n\t\t\t\t}\n\t\t\t\tif (cur.value[1].dependsOn.indexOf(dId) !== -1) {\n\t\t\t\t\tconst error = new Error(`Dependency ${dId} is already added for the request ${dependentId}`);\n\t\t\t\t\terror.name = \"Duplicate Dependency\";\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tcur.value[1].dependsOn.push(dId);\n\t\t\t} else {\n\t\t\t\tconst error = new Error(`Can't add dependency ${dependencyId}, There is only a dependent request in the batch`);\n\t\t\t\terror.name = \"Invalid Dependency Addition\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Removes a dependency for a given dependent request id\n\t * @param {string} dependentId - The id of the dependent request\n\t * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request\n\t * @returns The boolean indicating removed status\n\t */\n\tpublic removeDependency(dependentId: string, dependencyId?: string): boolean {\n\t\tconst request = this.requests.get(dependentId);\n\t\tif (typeof request === \"undefined\" || request.dependsOn === undefined || request.dependsOn.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\") {\n\t\t\tconst index = request.dependsOn.indexOf(dependencyId);\n\t\t\tif (index === -1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\trequest.dependsOn.splice(index, 1);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tdelete request.dependsOn;\n\t\t\treturn true;\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Constants\n */\n\n/**\n * @constant\n * A Default API endpoint version for a request\n */\nexport const GRAPH_API_VERSION = \"v1.0\";\n\n/**\n * @constant\n * A Default base url for a request\n */\nexport const GRAPH_BASE_URL = \"https://graph.microsoft.com/\";\n\n/**\n * To hold list of the service root endpoints for Microsoft Graph and Graph Explorer for each national cloud.\n * Set(iterable:Object) is not supported in Internet Explorer. The consumer is recommended to use a suitable polyfill.\n */\nexport const GRAPH_URLS = new Set<string>([\"graph.microsoft.com\", \"graph.microsoft.us\", \"dod-graph.microsoft.us\", \"graph.microsoft.de\", \"microsoftgraph.chinacloudapi.cn\", \"canary.graph.microsoft.com\"]);\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphClientError\n */\n\n/**\n * @class\n * Create GraphClientError object to handle client-side errors\n * encountered within the JavaScript Client SDK.\n * Whereas GraphError Class should be used to handle errors in the response from the Graph API.\n */\n\nexport class GraphClientError extends Error {\n\t/**\n\t * @public\n\t * A custom error. This property should set be when the error is not of instanceOf Error/GraphClientError.\n\t * Example =\n\t * const client = MicrosoftGraph.Client.init({\n\t * \t\tdefaultVersion: \"v1.0\",\n\t * \tauthProvider: (done) => { done({TokenError:\"AccessToken cannot be null\"}, \"<ACCESS_TOKEN>\");\n\t * });\n\t */\n\tpublic customError?: any;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To set the GraphClientError object\n\t * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request\n\t * @returns GraphClientError object set to the error passed\n\t */\n\tpublic static setGraphClientError(error: any): GraphClientError {\n\t\tlet graphClientError: GraphClientError;\n\t\tif (error instanceof Error) {\n\t\t\tgraphClientError = error;\n\t\t} else {\n\t\t\tgraphClientError = new GraphClientError();\n\t\t\tgraphClientError.customError = error;\n\t\t}\n\t\treturn graphClientError;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphClientError\n\t * @param {string} message? - Error message\n\t * @returns An instance of GraphClientError\n\t */\n\tpublic constructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, GraphClientError.prototype);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphRequestUtil\n */\nimport { GRAPH_URLS } from \"./Constants\";\nimport { GraphClientError } from \"./GraphClientError\";\n/**\n * To hold list of OData query params\n */\nexport const oDataQueryNames = [\"$select\", \"$expand\", \"$orderby\", \"$filter\", \"$top\", \"$skip\", \"$skipToken\", \"$count\"];\n\n/**\n * To construct the URL by appending the segments with \"/\"\n * @param {string[]} urlSegments - The array of strings\n * @returns The constructed URL string\n */\nexport const urlJoin = (urlSegments: string[]): string => {\n\tconst removePostSlash = (s) => s.replace(/\\/+$/, \"\");\n\tconst removePreSlash = (s) => s.replace(/^\\/+/, \"\");\n\tconst joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join(\"/\");\n\tconst parts = Array.prototype.slice.call(urlSegments);\n\treturn parts.reduce(joiner);\n};\n\n/**\n * Serializes the content\n * @param {any} content - The content value that needs to be serialized\n * @returns The serialized content\n *\n * Note:\n * This conversion is required due to the following reasons:\n * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string.\n * 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.\n * 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`.\n * If the data received is in JSON format, `serializeContent` converts the JSON to string.\n */\n\nexport const serializeContent = (content: any): any => {\n\tconst className: string = content && content.constructor && content.constructor.name;\n\tif (className === \"Buffer\" || className === \"Blob\" || className === \"File\" || className === \"FormData\" || typeof content === \"string\") {\n\t\treturn content;\n\t}\n\tif (className === \"ArrayBuffer\") {\n\t\tcontent = Buffer.from(content);\n\t} else if (className === \"Int8Array\" || className === \"Int16Array\" || className === \"Int32Array\" || className === \"Uint8Array\" || className === \"Uint16Array\" || className === \"Uint32Array\" || className === \"Uint8ClampedArray\" || className === \"Float32Array\" || className === \"Float64Array\" || className === \"DataView\") {\n\t\tcontent = Buffer.from(content.buffer);\n\t} else {\n\t\ttry {\n\t\t\tcontent = JSON.stringify(content);\n\t\t} catch (error) {\n\t\t\tthrow new Error(\"Unable to stringify the content\");\n\t\t}\n\t}\n\treturn content;\n};\n\n/**\n * Checks if the url is one of the service root endpoints for Microsoft Graph and Graph Explorer.\n * @param {string} url - The url to be verified\n * @returns {boolean} - Returns true if the url is a Graph URL\n */\nexport const isGraphURL = (url: string): boolean => {\n\treturn isValidEndpoint(url);\n};\n\n/**\n * Checks if the url is for one of the custom hosts provided during client initialization\n * @param {string} url - The url to be verified\n * @param {Set} customHosts - The url to be verified\n * @returns {boolean} - Returns true if the url is a for a custom host\n */\nexport const isCustomHost = (url: string, customHosts: Set<string>): boolean => {\n\tcustomHosts.forEach((host) => isCustomHostValid(host));\n\treturn isValidEndpoint(url, customHosts);\n};\n\n/**\n * Checks if the url is for one of the provided hosts.\n * @param {string} url - The url to be verified\n * @param {Set<string>} allowedHosts - A set of hosts.\n * @returns {boolean} - Returns true is for one of the provided endpoints.\n */\nconst isValidEndpoint = (url: string, allowedHosts: Set<string> = GRAPH_URLS): boolean => {\n\t// Valid Graph URL pattern - https://graph.microsoft.com/{version}/{resource}?{query-parameters}\n\t// Valid Graph URL example - https://graph.microsoft.com/v1.0/\n\turl = url.toLowerCase();\n\n\tif (url.indexOf(\"https://\") !== -1) {\n\t\turl = url.replace(\"https://\", \"\");\n\n\t\t// Find where the host ends\n\t\tconst startofPortNoPos = url.indexOf(\":\");\n\t\tconst endOfHostStrPos = url.indexOf(\"/\");\n\t\tlet hostName = \"\";\n\t\tif (endOfHostStrPos !== -1) {\n\t\t\tif (startofPortNoPos !== -1 && startofPortNoPos < endOfHostStrPos) {\n\t\t\t\thostName = url.substring(0, startofPortNoPos);\n\t\t\t\treturn allowedHosts.has(hostName);\n\t\t\t}\n\t\t\t// Parse out the host\n\t\t\thostName = url.substring(0, endOfHostStrPos);\n\t\t\treturn allowedHosts.has(hostName);\n\t\t}\n\t}\n\n\treturn false;\n};\n\n/**\n * Throws error if the string is not a valid host/hostname and contains other url parts.\n * @param {string} host - The host to be verified\n */\nconst isCustomHostValid = (host: string) => {\n\tif (host.indexOf(\"/\") !== -1) {\n\t\tthrow new GraphClientError(\"Please add only hosts or hostnames to the CustomHosts config. If the url is `http://example.com:3000/`, host is `example:3000`\");\n\t}\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module MiddlewareControl\n */\n\nimport { MiddlewareOptions } from \"./options/IMiddlewareOptions\";\n\n/**\n * @class\n * Class representing MiddlewareControl\n */\nexport class MiddlewareControl {\n\t/**\n\t * @private\n\t * A member holding map of MiddlewareOptions\n\t */\n\tprivate middlewareOptions: Map<Function, MiddlewareOptions>;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of MiddlewareControl\n\t * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions\n\t * @returns The instance of MiddlewareControl\n\t */\n\tpublic constructor(middlewareOptions: MiddlewareOptions[] = []) {\n\t\tthis.middlewareOptions = new Map<Function, MiddlewareOptions>();\n\t\tfor (const option of middlewareOptions) {\n\t\t\tconst fn = option.constructor;\n\t\t\tthis.middlewareOptions.set(fn, option);\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * To get the middleware option using the class of the option\n\t * @param {Function} fn - The class of the strongly typed option class\n\t * @returns The middleware option\n\t * @example\n\t * // if you wanted to return the middleware option associated with this class (MiddlewareControl)\n\t * // call this function like this:\n\t * getMiddlewareOptions(MiddlewareControl)\n\t */\n\tpublic getMiddlewareOptions(fn: Function): MiddlewareOptions {\n\t\treturn this.middlewareOptions.get(fn);\n\t}\n\n\t/**\n\t * @public\n\t * To set the middleware options using the class of the option\n\t * @param {Function} fn - The class of the strongly typed option class\n\t * @param {MiddlewareOptions} option - The strongly typed middleware option\n\t * @returns nothing\n\t */\n\tpublic setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void {\n\t\tthis.middlewareOptions.set(fn, option);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module MiddlewareUtil\n */\n\nimport { FetchOptions } from \"../IFetchOptions\";\n\n/**\n * @constant\n * To generate the UUID\n * @returns The UUID string\n */\nexport const generateUUID = (): string => {\n\tlet uuid = \"\";\n\tfor (let j = 0; j < 32; j++) {\n\t\tif (j === 8 || j === 12 || j === 16 || j === 20) {\n\t\t\tuuid += \"-\";\n\t\t}\n\t\tuuid += Math.floor(Math.random() * 16).toString(16);\n\t}\n\treturn uuid;\n};\n\n/**\n * @constant\n * To get the request header from the request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @returns A header value for the given key from the request\n */\nexport const getRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string): string | null => {\n\tlet value: string = null;\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\tvalue = (request as Request).headers.get(key);\n\t} else if (typeof options !== \"undefined\" && options.headers !== undefined) {\n\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\tvalue = (options.headers as Headers).get(key);\n\t\t} else if (options.headers instanceof Array) {\n\t\t\tconst headers = options.headers as string[][];\n\t\t\tfor (let i = 0, l = headers.length; i < l; i++) {\n\t\t\t\tif (headers[i][0] === key) {\n\t\t\t\t\tvalue = headers[i][1];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (options.headers[key] !== undefined) {\n\t\t\tvalue = options.headers[key];\n\t\t}\n\t}\n\treturn value;\n};\n\n/**\n * @constant\n * To set the header value to the given request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @param {string } value - The header value string\n * @returns Nothing\n */\nexport const setRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\t(request as Request).headers.set(key, value);\n\t} else if (typeof options !== \"undefined\") {\n\t\tif (options.headers === undefined) {\n\t\t\toptions.headers = new Headers({\n\t\t\t\t[key]: value,\n\t\t\t});\n\t\t} else {\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\t\t(options.headers as Headers).set(key, value);\n\t\t\t} else if (options.headers instanceof Array) {\n\t\t\t\tlet i = 0;\n\t\t\t\tconst l = options.headers.length;\n\t\t\t\tfor (; i < l; i++) {\n\t\t\t\t\tconst header = options.headers[i];\n\t\t\t\t\tif (header[0] === key) {\n\t\t\t\t\t\theader[1] = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i === l) {\n\t\t\t\t\t(options.headers as string[][]).push([key, value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tObject.assign(options.headers, { [key]: value });\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * @constant\n * To append the header value to the given request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @param {string } value - The header value string\n * @returns Nothing\n */\nexport const appendRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\t(request as Request).headers.append(key, value);\n\t} else if (typeof options !== \"undefined\") {\n\t\tif (options.headers === undefined) {\n\t\t\toptions.headers = new Headers({\n\t\t\t\t[key]: value,\n\t\t\t});\n\t\t} else {\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\t\t(options.headers as Headers).append(key, value);\n\t\t\t} else if (options.headers instanceof Array) {\n\t\t\t\t(options.headers as string[][]).push([key, value]);\n\t\t\t} else if (options.headers === undefined) {\n\t\t\t\toptions.headers = { [key]: value };\n\t\t\t} else if (options.headers[key] === undefined) {\n\t\t\t\toptions.headers[key] = value;\n\t\t\t} else {\n\t\t\t\toptions.headers[key] += `, ${value}`;\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * @constant\n * To clone the request with the new url\n * @param {string} url - The new url string\n * @param {Request} request - The request object\n * @returns A promise that resolves to request object\n */\nexport const cloneRequestWithNewUrl = async (newUrl: string, request: Request): Promise<Request> => {\n\tconst body = request.headers.get(\"Content-Type\") ? await request.blob() : await Promise.resolve(undefined);\n\tconst { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request;\n\treturn new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal });\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module AuthenticationHandlerOptions\n */\n\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\nimport { AuthenticationProviderOptions } from \"../../IAuthenticationProviderOptions\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class representing AuthenticationHandlerOptions\n */\nexport class AuthenticationHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @public\n\t * A member holding an instance of an authentication provider\n\t */\n\tpublic authenticationProvider: AuthenticationProvider;\n\n\t/**\n\t * @public\n\t * A member holding an instance of authentication provider options\n\t */\n\tpublic authenticationProviderOptions: AuthenticationProviderOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of AuthenticationHandlerOptions\n\t * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance\n\t * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance\n\t * @returns An instance of AuthenticationHandlerOptions\n\t */\n\tpublic constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions) {\n\t\tthis.authenticationProvider = authenticationProvider;\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module TelemetryHandlerOptions\n */\n\nimport { Context } from \"../../IContext\";\nimport { MiddlewareControl } from \"../MiddlewareControl\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @enum\n * @property {number} NONE - The hexadecimal flag value for nothing enabled\n * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled\n * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled\n * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled\n */\n\nexport enum FeatureUsageFlag {\n\t/* eslint-disable @typescript-eslint/naming-convention */\n\tNONE = 0x0,\n\tREDIRECT_HANDLER_ENABLED = 0x1,\n\tRETRY_HANDLER_ENABLED = 0x2,\n\tAUTHENTICATION_HANDLER_ENABLED = 0x4,\n\t/* eslint-enable @typescript-eslint/naming-convention */\n}\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class for TelemetryHandlerOptions\n */\n\nexport class TelemetryHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * A member to hold the OR of feature usage flags\n\t */\n\tprivate featureUsage: FeatureUsageFlag = FeatureUsageFlag.NONE;\n\n\t/**\n\t * @public\n\t * @static\n\t * To update the feature usage in the context object\n\t * @param {Context} context - The request context object containing middleware options\n\t * @param {FeatureUsageFlag} flag - The flag value\n\t * @returns nothing\n\t */\n\tpublic static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void {\n\t\tlet options: TelemetryHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\n\t\t} else {\n\t\t\tcontext.middlewareControl = new MiddlewareControl();\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = new TelemetryHandlerOptions();\n\t\t\tcontext.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options);\n\t\t}\n\t\toptions.setFeatureUsage(flag);\n\t}\n\n\t/**\n\t * @private\n\t * To set the feature usage flag\n\t * @param {FeatureUsageFlag} flag - The flag value\n\t * @returns nothing\n\t */\n\tprivate setFeatureUsage(flag: FeatureUsageFlag): void {\n\t\tthis.featureUsage = this.featureUsage | flag;\n\t}\n\n\t/**\n\t * @public\n\t * To get the feature usage\n\t * @returns A feature usage flag as hexadecimal string\n\t */\n\tpublic getFeatureUsage(): string {\n\t\treturn this.featureUsage.toString(16);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module AuthenticationHandler\n */\n\nimport { isCustomHost, isGraphURL } from \"../GraphRequestUtil\";\nimport { AuthenticationProvider } from \"../IAuthenticationProvider\";\nimport { AuthenticationProviderOptions } from \"../IAuthenticationProviderOptions\";\nimport { Context } from \"../IContext\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { appendRequestHeader } from \"./MiddlewareUtil\";\nimport { AuthenticationHandlerOptions } from \"./options/AuthenticationHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class representing AuthenticationHandler\n */\nexport class AuthenticationHandler implements Middleware {\n\t/**\n\t * @private\n\t * A member representing the authorization header name\n\t */\n\tprivate static AUTHORIZATION_HEADER = \"Authorization\";\n\n\t/**\n\t * @private\n\t * A member to hold an AuthenticationProvider instance\n\t */\n\tprivate authenticationProvider: AuthenticationProvider;\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of AuthenticationHandler\n\t * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler\n\t */\n\tpublic constructor(authenticationProvider: AuthenticationProvider) {\n\t\tthis.authenticationProvider = authenticationProvider;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\n\t\tif (isGraphURL(url) || (context.customHosts && isCustomHost(url, context.customHosts))) {\n\t\t\tlet options: AuthenticationHandlerOptions;\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions) as AuthenticationHandlerOptions;\n\t\t\t}\n\t\t\tlet authenticationProvider: AuthenticationProvider;\n\t\t\tlet authenticationProviderOptions: AuthenticationProviderOptions;\n\t\t\tif (options) {\n\t\t\t\tauthenticationProvider = options.authenticationProvider;\n\t\t\t\tauthenticationProviderOptions = options.authenticationProviderOptions;\n\t\t\t}\n\t\t\tif (!authenticationProvider) {\n\t\t\t\tauthenticationProvider = this.authenticationProvider;\n\t\t\t}\n\t\t\tconst token: string = await authenticationProvider.getAccessToken(authenticationProviderOptions);\n\t\t\tconst bearerKey = `Bearer ${token}`;\n\t\t\tappendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey);\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED);\n\t\t} else {\n\t\t\tif (context.options.headers) {\n\t\t\t\tdelete context.options.headers[AuthenticationHandler.AUTHORIZATION_HEADER];\n\t\t\t}\n\t\t}\n\t\treturn await this.nextMiddleware.execute(context);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPMessageHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { Middleware } from \"./IMiddleware\";\n\n/**\n * @class\n * @implements Middleware\n * Class for HTTPMessageHandler\n */\nexport class HTTPMessageHandler implements Middleware {\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The request context object\n\t * @returns A promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tcontext.response = await fetch(context.request, context.options);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RetryHandlerOptions\n */\n\nimport { FetchOptions } from \"../../IFetchOptions\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @type\n * A type declaration for shouldRetry callback\n */\nexport type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean;\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class for RetryHandlerOptions\n */\n\nexport class RetryHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default delay value in seconds\n\t */\n\tprivate static DEFAULT_DELAY = 3;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default maxRetries value\n\t */\n\tprivate static DEFAULT_MAX_RETRIES = 3;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum delay value in seconds\n\t */\n\tprivate static MAX_DELAY = 180;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum maxRetries value\n\t */\n\tprivate static MAX_MAX_RETRIES = 10;\n\n\t/**\n\t * @public\n\t * A member holding delay value in seconds\n\t */\n\tpublic delay: number;\n\n\t/**\n\t * @public\n\t * A member holding maxRetries value\n\t */\n\tpublic maxRetries: number;\n\n\t/**\n\t * @public\n\t * A member holding shouldRetry callback\n\t */\n\tpublic shouldRetry: ShouldRetry;\n\n\t/**\n\t * @private\n\t * A member holding default shouldRetry callback\n\t */\n\tprivate static defaultShouldRetry: ShouldRetry = () => true;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RetryHandlerOptions\n\t * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds\n\t * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value\n\t * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function\n\t * @returns An instance of RetryHandlerOptions\n\t */\n\tpublic constructor(delay: number = RetryHandlerOptions.DEFAULT_DELAY, maxRetries: number = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry: ShouldRetry = RetryHandlerOptions.defaultShouldRetry) {\n\t\tif (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (delay > RetryHandlerOptions.MAX_DELAY) {\n\t\t\tconst error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\n\t\t\tconst error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (delay < 0 && maxRetries < 0) {\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t} else if (delay < 0) {\n\t\t\tconst error = new Error(`Delay should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t} else if (maxRetries < 0) {\n\t\t\tconst error = new Error(`MaxRetries should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY);\n\t\tthis.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES);\n\t\tthis.shouldRetry = shouldRetry;\n\t}\n\n\t/**\n\t * @public\n\t * To get the maximum delay\n\t * @returns A maximum delay\n\t */\n\tpublic getMaxDelay(): number {\n\t\treturn RetryHandlerOptions.MAX_DELAY;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RetryHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { FetchOptions } from \"../IFetchOptions\";\nimport { RequestMethod } from \"../RequestMethod\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\nimport { RetryHandlerOptions } from \"./options/RetryHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class for RetryHandler\n */\nexport class RetryHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A list of status codes that needs to be retried\n\t */\n\tprivate static RETRY_STATUS_CODES: number[] = [\n\t\t429, // Too many requests\n\t\t503, // Service unavailable\n\t\t504, // Gateway timeout\n\t];\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of retry attempt header\n\t */\n\tprivate static RETRY_ATTEMPT_HEADER = \"Retry-Attempt\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of retry after header\n\t */\n\tprivate static RETRY_AFTER_HEADER = \"Retry-After\";\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @private\n\t * A member holding the retry handler options\n\t */\n\tprivate options: RetryHandlerOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RetryHandler\n\t * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value\n\t * @returns An instance of RetryHandler\n\t */\n\tpublic constructor(options: RetryHandlerOptions = new RetryHandlerOptions()) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t *\n\t * @private\n\t * To check whether the response has the retry status code\n\t * @param {Response} response - The response object\n\t * @returns Whether the response has retry status code or not\n\t */\n\tprivate isRetry(response: Response): boolean {\n\t\treturn RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the payload is buffered or not\n\t * @param {RequestInfo} request - The url string or the request object value\n\t * @param {FetchOptions} options - The options of a request\n\t * @returns Whether the payload is buffered or not\n\t */\n\tprivate isBuffered(request: RequestInfo, options: FetchOptions | undefined): boolean {\n\t\tconst method = typeof request === \"string\" ? options.method : (request as Request).method;\n\t\tconst isPutPatchOrPost: boolean = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST;\n\t\tif (isPutPatchOrPost) {\n\t\t\tconst isStream = getRequestHeader(request, options, \"Content-Type\") === \"application/octet-stream\";\n\t\t\tif (isStream) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * @private\n\t * To get the delay for a retry\n\t * @param {Response} response - The response object\n\t * @param {number} retryAttempts - The current attempt count\n\t * @param {number} delay - The delay value in seconds\n\t * @returns A delay for a retry\n\t */\n\tprivate getDelay(response: Response, retryAttempts: number, delay: number): number {\n\t\tconst getRandomness = () => Number(Math.random().toFixed(3));\n\t\tconst retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null;\n\t\tlet newDelay: number;\n\t\tif (retryAfter !== null) {\n\t\t\tif (Number.isNaN(Number(retryAfter))) {\n\t\t\t\tnewDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000);\n\t\t\t} else {\n\t\t\t\tnewDelay = Number(retryAfter);\n\t\t\t}\n\t\t} else {\n\t\t\t// Adding randomness to avoid retrying at a same\n\t\t\tnewDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness();\n\t\t}\n\t\treturn Math.min(newDelay, this.options.getMaxDelay() + getRandomness());\n\t}\n\n\t/**\n\t * @private\n\t * To get an exponential back off value\n\t * @param {number} attempts - The current attempt count\n\t * @returns An exponential back off value\n\t */\n\tprivate getExponentialBackOffTime(attempts: number): number {\n\t\treturn Math.round((1 / 2) * (2 ** attempts - 1));\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To add delay for the execution\n\t * @param {number} delaySeconds - The delay value in seconds\n\t * @returns Nothing\n\t */\n\tprivate async sleep(delaySeconds: number): Promise<void> {\n\t\tconst delayMilliseconds = delaySeconds * 1000;\n\t\treturn new Promise((resolve) => setTimeout(resolve, delayMilliseconds));\n\t}\n\n\tprivate getOptions(context: Context): RetryHandlerOptions {\n\t\tlet options: RetryHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(this.options.constructor) as RetryHandlerOptions;\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = Object.assign(new RetryHandlerOptions(), this.options);\n\t\t}\n\t\treturn options;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To execute the middleware with retries\n\t * @param {Context} context - The context object\n\t * @param {number} retryAttempts - The current attempt count\n\t * @param {RetryHandlerOptions} options - The retry middleware options instance\n\t * @returns A Promise that resolves to nothing\n\t */\n\tprivate async executeWithRetry(context: Context, retryAttempts: number, options: RetryHandlerOptions): Promise<void> {\n\t\tawait this.nextMiddleware.execute(context);\n\t\tif (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) {\n\t\t\t++retryAttempts;\n\t\t\tsetRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());\n\t\t\tconst delay = this.getDelay(context.response, retryAttempts, options.delay);\n\t\t\tawait this.sleep(delay);\n\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst retryAttempts = 0;\n\t\tconst options: RetryHandlerOptions = this.getOptions(context);\n\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED);\n\t\treturn await this.executeWithRetry(context, retryAttempts, options);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RedirectHandlerOptions\n */\n\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @type\n * A type declaration for shouldRetry callback\n */\nexport type ShouldRedirect = (response: Response) => boolean;\n\n/**\n * @class\n * @implements MiddlewareOptions\n * A class representing RedirectHandlerOptions\n */\nexport class RedirectHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default max redirects value\n\t */\n\tprivate static DEFAULT_MAX_REDIRECTS = 5;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum max redirects value\n\t */\n\tprivate static MAX_MAX_REDIRECTS = 20;\n\n\t/**\n\t * @public\n\t * A member holding max redirects value\n\t */\n\tpublic maxRedirects: number;\n\n\t/**\n\t * @public\n\t * A member holding shouldRedirect callback\n\t */\n\tpublic shouldRedirect: ShouldRedirect;\n\n\t/**\n\t * @private\n\t * A member holding default shouldRedirect callback\n\t */\n\tprivate static defaultShouldRedirect: ShouldRedirect = () => true;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RedirectHandlerOptions\n\t * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value\n\t * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback\n\t * @returns An instance of RedirectHandlerOptions\n\t */\n\tpublic constructor(maxRedirects: number = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect: ShouldRedirect = RedirectHandlerOptions.defaultShouldRedirect) {\n\t\tif (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) {\n\t\t\tconst error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (maxRedirects < 0) {\n\t\t\tconst error = new Error(`MaxRedirects should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.maxRedirects = maxRedirects;\n\t\tthis.shouldRedirect = shouldRedirect;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RedirectHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { RequestMethod } from \"../RequestMethod\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { cloneRequestWithNewUrl } from \"./MiddlewareUtil\";\nimport { RedirectHandlerOptions } from \"./options/RedirectHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * Class\n * @implements Middleware\n * Class representing RedirectHandler\n */\nexport class RedirectHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the array of redirect status codes\n\t */\n\tprivate static REDIRECT_STATUS_CODES: number[] = [\n\t\t301, // Moved Permanently\n\t\t302, // Found\n\t\t303, // See Other\n\t\t307, // Temporary Permanently\n\t\t308, // Moved Permanently\n\t];\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding SeeOther status code\n\t */\n\tprivate static STATUS_CODE_SEE_OTHER = 303;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the location header\n\t */\n\tprivate static LOCATION_HEADER = \"Location\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member representing the authorization header name\n\t */\n\tprivate static AUTHORIZATION_HEADER = \"Authorization\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the manual redirect value\n\t */\n\tprivate static MANUAL_REDIRECT: RequestRedirect = \"manual\";\n\n\t/**\n\t * @private\n\t * A member holding options to customize the handler behavior\n\t */\n\tprivate options: RedirectHandlerOptions;\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RedirectHandler\n\t * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance\n\t * @returns An instance of RedirectHandler\n\t */\n\n\tpublic constructor(options: RedirectHandlerOptions = new RedirectHandlerOptions()) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the response has the redirect status code or not\n\t * @param {Response} response - The response object\n\t * @returns A boolean representing whether the response contains the redirect status code or not\n\t */\n\tprivate isRedirect(response: Response): boolean {\n\t\treturn RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the response has location header or not\n\t * @param {Response} response - The response object\n\t * @returns A boolean representing the whether the response has location header or not\n\t */\n\tprivate hasLocationHeader(response: Response): boolean {\n\t\treturn response.headers.has(RedirectHandler.LOCATION_HEADER);\n\t}\n\n\t/**\n\t * @private\n\t * To get the redirect url from location header in response object\n\t * @param {Response} response - The response object\n\t * @returns A redirect url from location header\n\t */\n\tprivate getLocationHeader(response: Response): string {\n\t\treturn response.headers.get(RedirectHandler.LOCATION_HEADER);\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the given url is a relative url or not\n\t * @param {string} url - The url string value\n\t * @returns A boolean representing whether the given url is a relative url or not\n\t */\n\tprivate isRelativeURL(url: string): boolean {\n\t\treturn url.indexOf(\"://\") === -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the authorization header in the request should be dropped for consequent redirected requests\n\t * @param {string} requestUrl - The request url value\n\t * @param {string} redirectUrl - The redirect url value\n\t * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests\n\t */\n\tprivate shouldDropAuthorizationHeader(requestUrl: string, redirectUrl: string): boolean {\n\t\tconst schemeHostRegex = /^[A-Za-z].+?:\\/\\/.+?(?=\\/|$)/;\n\t\tconst requestMatches: string[] = schemeHostRegex.exec(requestUrl);\n\t\tlet requestAuthority: string;\n\t\tlet redirectAuthority: string;\n\t\tif (requestMatches !== null) {\n\t\t\trequestAuthority = requestMatches[0];\n\t\t}\n\t\tconst redirectMatches: string[] = schemeHostRegex.exec(redirectUrl);\n\t\tif (redirectMatches !== null) {\n\t\t\tredirectAuthority = redirectMatches[0];\n\t\t}\n\t\treturn typeof requestAuthority !== \"undefined\" && typeof redirectAuthority !== \"undefined\" && requestAuthority !== redirectAuthority;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To update a request url with the redirect url\n\t * @param {string} redirectUrl - The redirect url value\n\t * @param {Context} context - The context object value\n\t * @returns Nothing\n\t */\n\tprivate async updateRequestUrl(redirectUrl: string, context: Context): Promise<void> {\n\t\tcontext.request = typeof context.request === \"string\" ? redirectUrl : await cloneRequestWithNewUrl(redirectUrl, context.request as Request);\n\t}\n\n\t/**\n\t * @private\n\t * To get the options for execution of the middleware\n\t * @param {Context} context - The context object\n\t * @returns A options for middleware execution\n\t */\n\tprivate getOptions(context: Context): RedirectHandlerOptions {\n\t\tlet options: RedirectHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions) as RedirectHandlerOptions;\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = Object.assign(new RedirectHandlerOptions(), this.options);\n\t\t}\n\t\treturn options;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To execute the next middleware and to handle in case of redirect response returned by the server\n\t * @param {Context} context - The context object\n\t * @param {number} redirectCount - The redirect count value\n\t * @param {RedirectHandlerOptions} options - The redirect handler options instance\n\t * @returns A promise that resolves to nothing\n\t */\n\tprivate async executeWithRedirect(context: Context, redirectCount: number, options: RedirectHandlerOptions): Promise<void> {\n\t\tawait this.nextMiddleware.execute(context);\n\t\tconst response = context.response;\n\t\tif (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) {\n\t\t\t++redirectCount;\n\t\t\tif (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) {\n\t\t\t\tcontext.options.method = RequestMethod.GET;\n\t\t\t\tdelete context.options.body;\n\t\t\t} else {\n\t\t\t\tconst redirectUrl: string = this.getLocationHeader(response);\n\t\t\t\tif (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) {\n\t\t\t\t\tdelete context.options.headers[RedirectHandler.AUTHORIZATION_HEADER];\n\t\t\t\t}\n\t\t\t\tawait this.updateRequestUrl(redirectUrl, context);\n\t\t\t}\n\t\t\tawait this.executeWithRedirect(context, redirectCount, options);\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst redirectCount = 0;\n\t\tconst options = this.getOptions(context);\n\t\tcontext.options.redirect = RedirectHandler.MANUAL_REDIRECT;\n\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED);\n\t\treturn await this.executeWithRedirect(context, redirectCount, options);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n// THIS FILE IS AUTO GENERATED\n// ANY CHANGES WILL BE LOST DURING BUILD\n\n/**\n * @module Version\n */\n\nexport const PACKAGE_VERSION = \"3.0.7\";\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module TelemetryHandler\n */\nimport { isCustomHost, isGraphURL } from \"../GraphRequestUtil\";\nimport { Context } from \"../IContext\";\nimport { PACKAGE_VERSION } from \"../Version\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\nimport { TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class for TelemetryHandler\n */\nexport class TelemetryHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the client request id header\n\t */\n\tprivate static CLIENT_REQUEST_ID_HEADER = \"client-request-id\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the sdk version header\n\t */\n\tprivate static SDK_VERSION_HEADER = \"SdkVersion\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the language prefix for the sdk version header value\n\t */\n\tprivate static PRODUCT_NAME = \"graph-js\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the key for the feature usage metrics\n\t */\n\tprivate static FEATURE_USAGE_STRING = \"featureUsage\";\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\n\t\tif (isGraphURL(url) || (context.customHosts && isCustomHost(url, context.customHosts))) {\n\t\t\t// Add telemetry only if the request url is a Graph URL.\n\t\t\t// Errors are reported as in issue #265 if headers are present when redirecting to a non Graph URL\n\t\t\tlet clientRequestId: string = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER);\n\t\t\tif (!clientRequestId) {\n\t\t\t\tclientRequestId = generateUUID();\n\t\t\t\tsetRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId);\n\t\t\t}\n\t\t\tlet sdkVersionValue = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`;\n\t\t\tlet options: TelemetryHandlerOptions;\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\n\t\t\t}\n\t\t\tif (options) {\n\t\t\t\tconst featureUsage: string = options.getFeatureUsage();\n\t\t\t\tsdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`;\n\t\t\t}\n\t\t\tappendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue);\n\t\t} else {\n\t\t\t// Remove telemetry headers if present during redirection.\n\t\t\tdelete context.options.headers[TelemetryHandler.CLIENT_REQUEST_ID_HEADER];\n\t\t\tdelete context.options.headers[TelemetryHandler.SDK_VERSION_HEADER];\n\t\t}\n\t\treturn await this.nextMiddleware.execute(context);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module ChaosStrategy\n */\n\n/**\n * Strategy used for Testing Handler\n * @enum\n */\nexport enum ChaosStrategy {\n\tMANUAL,\n\tRANDOM,\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @enum\n * Enum for ResponseType values\n * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer}\n * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob}\n * @property {string} DOCUMENT - This downloads content as a document or stream\n * @property {string} JSON - To download response content as a json\n * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html}\n * @property {string} TEXT - For downloading response as a text\n */\n\nexport enum ResponseType {\n\tARRAYBUFFER = \"arraybuffer\",\n\tBLOB = \"blob\",\n\tDOCUMENT = \"document\",\n\tJSON = \"json\",\n\tRAW = \"raw\",\n\tSTREAM = \"stream\",\n\tTEXT = \"text\",\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphResponseHandler\n * References - https://fetch.spec.whatwg.org/#responses\n */\n\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\nimport { ResponseType } from \"./ResponseType\";\n\n/**\n * @enum\n * Enum for document types\n * @property {string} TEXT_HTML - The text/html content type\n * @property {string} TEXT_XML - The text/xml content type\n * @property {string} APPLICATION_XML - The application/xml content type\n * @property {string} APPLICATION_XHTML - The application/xhml+xml content type\n */\nexport enum DocumentType {\n\tTEXT_HTML = \"text/html\",\n\tTEXT_XML = \"text/xml\",\n\tAPPLICATION_XML = \"application/xml\",\n\tAPPLICATION_XHTML = \"application/xhtml+xml\",\n}\n\n/**\n * @enum\n * Enum for Content types\n * @property {string} TEXT_PLAIN - The text/plain content type\n * @property {string} APPLICATION_JSON - The application/json content type\n */\n\nenum ContentType {\n\tTEXT_PLAIN = \"text/plain\",\n\tAPPLICATION_JSON = \"application/json\",\n}\n\n/**\n * @enum\n * Enum for Content type regex\n * @property {string} DOCUMENT - The regex to match document content types\n * @property {string} IMAGE - The regex to match image content types\n */\nenum ContentTypeRegexStr {\n\tDOCUMENT = \"^(text\\\\/(html|xml))|(application\\\\/(xml|xhtml\\\\+xml))$\",\n\tIMAGE = \"^image\\\\/.+\",\n}\n\n/**\n * @class\n * Class for GraphResponseHandler\n */\n\nexport class GraphResponseHandler {\n\t/**\n\t * @private\n\t * @static\n\t * To parse Document response\n\t * @param {Response} rawResponse - The response object\n\t * @param {DocumentType} type - The type to which the document needs to be parsed\n\t * @returns A promise that resolves to a document content\n\t */\n\tprivate static parseDocumentResponse(rawResponse: Response, type: DocumentType): Promise<any> {\n\t\tif (typeof DOMParser !== \"undefined\") {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\trawResponse.text().then((xmlString) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\tconst xmlDoc = parser.parseFromString(xmlString, type);\n\t\t\t\t\t\tresolve(xmlDoc);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\treturn Promise.resolve(rawResponse.body);\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * To convert the native Response to response content\n\t * @param {Response} rawResponse - The response object\n\t * @param {ResponseType} [responseType] - The response type value\n\t * @returns A promise that resolves to the converted response content\n\t */\n\tprivate static async convertResponse(rawResponse: Response, responseType?: ResponseType): Promise<any> {\n\t\tif (rawResponse.status === 204) {\n\t\t\t// NO CONTENT\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tlet responseValue: any;\n\t\tconst contentType = rawResponse.headers.get(\"Content-type\");\n\t\tswitch (responseType) {\n\t\t\tcase ResponseType.ARRAYBUFFER:\n\t\t\t\tresponseValue = await rawResponse.arrayBuffer();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.BLOB:\n\t\t\t\tresponseValue = await rawResponse.blob();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.DOCUMENT:\n\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML);\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.JSON:\n\t\t\t\tresponseValue = await rawResponse.json();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.STREAM:\n\t\t\t\tresponseValue = await Promise.resolve(rawResponse.body);\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.TEXT:\n\t\t\t\tresponseValue = await rawResponse.text();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (contentType !== null) {\n\t\t\t\t\tconst mimeType = contentType.split(\";\")[0];\n\t\t\t\t\tif (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) {\n\t\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType as DocumentType);\n\t\t\t\t\t} else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) {\n\t\t\t\t\t\tresponseValue = rawResponse.blob();\n\t\t\t\t\t} else if (mimeType === ContentType.TEXT_PLAIN) {\n\t\t\t\t\t\tresponseValue = await rawResponse.text();\n\t\t\t\t\t} else if (mimeType === ContentType.APPLICATION_JSON) {\n\t\t\t\t\t\tresponseValue = await rawResponse.json();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t/**\n\t\t\t\t\t * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says:\n\t\t\t\t\t * A sender that generates a message containing a payload body SHOULD\n\t\t\t\t\t * generate a Content-Type header field in that message unless the\n\t\t\t\t\t * intended media type of the enclosed representation is unknown to the\n\t\t\t\t\t * sender. If a Content-Type header field is not present, the recipient\n\t\t\t\t\t * MAY either assume a media type of \"application/octet-stream\"\n\t\t\t\t\t * ([RFC2046], Section 4.5.1) or examine the data to determine its type.\n\t\t\t\t\t *\n\t\t\t\t\t * So assuming it as a stream type so returning the body.\n\t\t\t\t\t */\n\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn responseValue;\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To get the parsed response\n\t * @param {Response} rawResponse - The response object\n\t * @param {ResponseType} [responseType] - The response type value\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\n\t * @returns The parsed response\n\t */\n\tpublic static async getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise<any> {\n\t\tif (responseType === ResponseType.RAW) {\n\t\t\treturn Promise.resolve(rawResponse);\n\t\t} else {\n\t\t\tconst response = await GraphResponseHandler.convertResponse(rawResponse, responseType);\n\t\t\tif (rawResponse.ok) {\n\t\t\t\t// Status Code 2XX\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback(null, response);\n\t\t\t\t} else {\n\t\t\t\t\treturn response;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// NOT OK Response\n\t\t\t\tthrow response;\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Range\n */\n\n/**\n * @class\n * Class representing Range\n */\nexport class Range {\n\t/**\n\t * @public\n\t * The minimum value of the range\n\t */\n\tpublic minValue: number;\n\n\t/**\n\t * @public\n\t * The maximum value of the range\n\t */\n\tpublic maxValue: number;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates a range for given min and max values\n\t * @param {number} [minVal = -1] - The minimum value.\n\t * @param {number} [maxVal = -1] - The maximum value.\n\t * @returns An instance of a Range\n\t */\n\tpublic constructor(minVal = -1, maxVal = -1) {\n\t\tthis.minValue = minVal;\n\t\tthis.maxValue = maxVal;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * Class representing a successful file upload result\n */\nexport class UploadResult {\n\t/**\n\t * @private\n\t * Location value looked up in the response header\n\t */\n\tprivate _location: string;\n\n\t/**\n\t * @private\n\t * Response body of the final raw response\n\t */\n\tprivate _responseBody: unknown;\n\n\t/**\n\t * @public\n\t * Get of the location value.\n\t * Location value is looked up in the response header\n\t */\n\tpublic get location(): string {\n\t\treturn this._location;\n\t}\n\n\t/**\n\t * @public\n\t * Set the location value\n\t * Location value is looked up in the response header\n\t */\n\tpublic set location(location: string) {\n\t\tthis._location = location;\n\t}\n\n\t/**\n\t * @public\n\t * Get The response body from the completed upload response\n\t */\n\tpublic get responseBody() {\n\t\treturn this._responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * Set the response body from the completed upload response\n\t */\n\tpublic set responseBody(responseBody: unknown) {\n\t\tthis._responseBody = responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * @param {responseBody} responsebody - The response body from the completed upload response\n\t * @param {location} location - The location value from the headers from the completed upload response\n\t */\n\tpublic constructor(responseBody: unknown, location: string) {\n\t\t// Response body or the location parameter can be undefined.\n\t\tthis._location = location;\n\t\tthis._responseBody = responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * @param {responseBody} responseBody - The response body from the completed upload response\n\t * @param {responseHeaders} responseHeaders - The headers from the completed upload response\n\t */\n\tpublic static CreateUploadResult(responseBody?: unknown, responseHeaders?: Headers) {\n\t\treturn new UploadResult(responseBody, responseHeaders.get(\"location\"));\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module LargeFileUploadTask\n */\n\nimport { GraphClientError } from \"../GraphClientError\";\nimport { GraphResponseHandler } from \"../GraphResponseHandler\";\nimport { Client } from \"../index\";\nimport { ResponseType } from \"../ResponseType\";\nimport { UploadEventHandlers } from \"./FileUploadTask/Interfaces/IUploadEventHandlers\";\nimport { Range } from \"./FileUploadTask/Range\";\nimport { UploadResult } from \"./FileUploadTask/UploadResult\";\n\n/**\n * @interface\n * Signature to representing key value pairs\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface KeyValuePairObjectStringNumber {\n\t[key: string]: string | number;\n}\n\n/**\n * @interface\n * Signature to represent the resulting response in the status enquiry request\n * @property {string} expirationDateTime - The expiration time of the upload session\n * @property {string[]} nextExpectedRanges - The ranges expected in next consecutive request in the upload\n */\ninterface UploadStatusResponse {\n\texpirationDateTime: string;\n\tnextExpectedRanges: string[];\n}\n\n/**\n * @interface\n * Signature to define options for upload task\n * @property {number} [rangeSize = LargeFileUploadTask.DEFAULT_FILE_SIZE] - Specifies the range chunk size\n * @property {UploadEventHandlers} uploadEventHandlers - UploadEventHandlers attached to an upload task\n */\nexport interface LargeFileUploadTaskOptions {\n\trangeSize?: number;\n\tuploadEventHandlers?: UploadEventHandlers;\n}\n\n/**\n * @interface\n * Signature to represent upload session resulting from the session creation in the server\n * @property {string} url - The URL to which the file upload is made\n * @property {Date} expiry - The expiration of the time of the upload session\n */\nexport interface LargeFileUploadSession {\n\turl: string;\n\texpiry: Date;\n\tisCancelled?: boolean;\n}\n\n/**\n * @type\n * Representing the return type of the sliceFile function that is type of the slice of a given range.\n */\nexport type SliceType = ArrayBuffer | Blob | Uint8Array;\n\n/**\n * @interface\n * Signature to define the properties and content of the file in upload task\n * @property {ArrayBuffer | File} content - The actual file content\n * @property {string} name - Specifies the file name with extension\n * @property {number} size - Specifies size of the file\n */\nexport interface FileObject<T> {\n\tcontent: T;\n\tname: string;\n\tsize: number;\n\tsliceFile(range: Range): SliceType | Promise<SliceType>;\n}\n\n/**\n * @class\n * Class representing LargeFileUploadTask\n */\nexport class LargeFileUploadTask<T> {\n\t/**\n\t * @private\n\t * Default value for the rangeSize\n\t */\n\tprivate DEFAULT_FILE_SIZE: number = 5 * 1024 * 1024;\n\n\t/**\n\t * @protected\n\t * The GraphClient instance\n\t */\n\tprotected client: Client;\n\n\t/**\n\t * @protected\n\t * The object holding file details\n\t */\n\tprotected file: FileObject<T>;\n\n\t/**\n\t * @protected\n\t * The object holding options for the task\n\t */\n\tprotected options: LargeFileUploadTaskOptions;\n\n\t/**\n\t * @protected\n\t * The object for upload session\n\t */\n\tprotected uploadSession: LargeFileUploadSession;\n\n\t/**\n\t * @protected\n\t * The next range needs to be uploaded\n\t */\n\tprotected nextRange: Range;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Makes request to the server to create an upload session\n\t * @param {Client} client - The GraphClient instance\n\t * @param {string} requestUrl - The URL to create the upload session\n\t * @param {any} payload - The payload that needs to be sent\n\t * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent\n\t * @returns The promise that resolves to LargeFileUploadSession\n\t */\n\tpublic static async createUploadSession(client: Client, requestUrl: string, payload: any, headers: KeyValuePairObjectStringNumber = {}): Promise<LargeFileUploadSession> {\n\t\tconst session = await client\n\t\t\t.api(requestUrl)\n\t\t\t.headers(headers)\n\t\t\t.post(payload);\n\t\tconst largeFileUploadSession: LargeFileUploadSession = {\n\t\t\turl: session.uploadUrl,\n\t\t\texpiry: new Date(session.expirationDateTime),\n\t\t\tisCancelled: false,\n\t\t};\n\t\treturn largeFileUploadSession;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a LargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded\n\t * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done\n\t * @param {LargeFileUploadTaskOptions} options - The upload task options\n\t * @returns An instance of LargeFileUploadTask\n\t */\n\tpublic constructor(client: Client, file: FileObject<T>, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions = {}) {\n\t\tthis.client = client;\n\n\t\tif (!file.sliceFile) {\n\t\t\tthrow new GraphClientError(\"Please pass the FileUpload object, StreamUpload object or any custom implementation of the FileObject interface\");\n\t\t} else {\n\t\t\tthis.file = file;\n\t\t}\n\t\tthis.file = file;\n\t\tif (!options.rangeSize) {\n\t\t\toptions.rangeSize = this.DEFAULT_FILE_SIZE;\n\t\t}\n\n\t\tthis.options = options;\n\t\tthis.uploadSession = uploadSession;\n\t\tthis.nextRange = new Range(0, this.options.rangeSize - 1);\n\t}\n\n\t/**\n\t * @private\n\t * Parses given range string to the Range instance\n\t * @param {string[]} ranges - The ranges value\n\t * @returns The range instance\n\t */\n\tprivate parseRange(ranges: string[]): Range {\n\t\tconst rangeStr = ranges[0];\n\t\tif (typeof rangeStr === \"undefined\" || rangeStr === \"\") {\n\t\t\treturn new Range();\n\t\t}\n\t\tconst firstRange = rangeStr.split(\"-\");\n\t\tconst minVal = parseInt(firstRange[0], 10);\n\t\tlet maxVal = parseInt(firstRange[1], 10);\n\t\tif (Number.isNaN(maxVal)) {\n\t\t\tmaxVal = this.file.size - 1;\n\t\t}\n\t\treturn new Range(minVal, maxVal);\n\t}\n\n\t/**\n\t * @private\n\t * Updates the expiration date and the next range\n\t * @param {UploadStatusResponse} response - The response of the upload status\n\t * @returns Nothing\n\t */\n\tprivate updateTaskStatus(response: UploadStatusResponse): void {\n\t\tthis.uploadSession.expiry = new Date(response.expirationDateTime);\n\t\tthis.nextRange = this.parseRange(response.nextExpectedRanges);\n\t}\n\n\t/**\n\t * @public\n\t * Gets next range that needs to be uploaded\n\t * @returns The range instance\n\t */\n\tpublic getNextRange(): Range {\n\t\tif (this.nextRange.minValue === -1) {\n\t\t\treturn this.nextRange;\n\t\t}\n\t\tconst minVal = this.nextRange.minValue;\n\t\tlet maxValue = minVal + this.options.rangeSize - 1;\n\t\tif (maxValue >= this.file.size) {\n\t\t\tmaxValue = this.file.size - 1;\n\t\t}\n\t\treturn new Range(minVal, maxValue);\n\t}\n\n\t/**\n\t * @deprecated This function has been moved into FileObject interface.\n\t * @public\n\t * Slices the file content to the given range\n\t * @param {Range} range - The range value\n\t * @returns The sliced ArrayBuffer or Blob\n\t */\n\tpublic sliceFile(range: Range): ArrayBuffer | Blob {\n\t\tconsole.warn(\"The LargeFileUploadTask.sliceFile() function has been deprecated and moved into the FileObject interface.\");\n\t\tif (this.file.content instanceof ArrayBuffer || this.file.content instanceof Blob || this.file.content instanceof Uint8Array) {\n\t\t\treturn this.file.content.slice(range.minValue, range.maxValue + 1);\n\t\t}\n\t\tthrow new GraphClientError(\"The LargeFileUploadTask.sliceFile() function expects only Blob, ArrayBuffer or Uint8Array file content. Please note that the sliceFile() function is deprecated.\");\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads file to the server in a sequential order by slicing the file\n\t * @returns The promise resolves to uploaded response\n\t */\n\tpublic async upload(): Promise<UploadResult> {\n\t\tconst uploadEventHandlers = this.options && this.options.uploadEventHandlers;\n\t\twhile (!this.uploadSession.isCancelled) {\n\t\t\tconst nextRange = this.getNextRange();\n\t\t\tif (nextRange.maxValue === -1) {\n\t\t\t\tconst err = new Error(\"Task with which you are trying to upload is already completed, Please check for your uploaded file\");\n\t\t\t\terr.name = \"Invalid Session\";\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tconst fileSlice = await this.file.sliceFile(nextRange);\n\t\t\tconst rawResponse = await this.uploadSliceGetRawResponse(fileSlice, nextRange, this.file.size);\n\t\t\tif (!rawResponse) {\n\t\t\t\tthrow new GraphClientError(\"Something went wrong! Large file upload slice response is null.\");\n\t\t\t}\n\n\t\t\tconst responseBody = await GraphResponseHandler.getResponse(rawResponse);\n\t\t\t/**\n\t\t\t * (rawResponse.status === 201) -> This condition is applicable for OneDrive, PrintDocument and Outlook APIs.\n\t\t\t * (rawResponse.status === 200 && responseBody.id) -> This additional condition is applicable only for OneDrive API.\n\t\t\t */\n\t\t\tif (rawResponse.status === 201 || (rawResponse.status === 200 && responseBody.id)) {\n\t\t\t\tthis.reportProgress(uploadEventHandlers, nextRange);\n\t\t\t\treturn UploadResult.CreateUploadResult(responseBody, rawResponse.headers);\n\t\t\t}\n\n\t\t\t/* Handling the API issue where the case of Outlook upload response property -'nextExpectedRanges' is not uniform.\n\t\t\t * https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/39\n\t\t\t */\n\t\t\tconst res: UploadStatusResponse = {\n\t\t\t\texpirationDateTime: responseBody.expirationDateTime || responseBody.ExpirationDateTime,\n\t\t\t\tnextExpectedRanges: responseBody.NextExpectedRanges || responseBody.nextExpectedRanges,\n\t\t\t};\n\t\t\tthis.updateTaskStatus(res);\n\t\t\tthis.reportProgress(uploadEventHandlers, nextRange);\n\t\t}\n\t}\n\n\tprivate reportProgress(uploadEventHandlers: UploadEventHandlers, nextRange: Range) {\n\t\tif (uploadEventHandlers && uploadEventHandlers.progress) {\n\t\t\tuploadEventHandlers.progress(nextRange, uploadEventHandlers.extraCallbackParam);\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads given slice to the server\n\t * @param {ArrayBuffer | Blob | File} fileSlice - The file slice\n\t * @param {Range} range - The range value\n\t * @param {number} totalSize - The total size of a complete file\n\t * @returns The response body of the upload slice result\n\t */\n\tpublic async uploadSlice(fileSlice: ArrayBuffer | Blob | File, range: Range, totalSize: number): Promise<unknown> {\n\t\treturn await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.headers({\n\t\t\t\t\"Content-Length\": `${range.maxValue - range.minValue + 1}`,\n\t\t\t\t\"Content-Range\": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t})\n\t\t\t.put(fileSlice);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads given slice to the server\n\t * @param {unknown} fileSlice - The file slice\n\t * @param {Range} range - The range value\n\t * @param {number} totalSize - The total size of a complete file\n\t * @returns The raw response of the upload slice result\n\t */\n\tpublic async uploadSliceGetRawResponse(fileSlice: unknown, range: Range, totalSize: number): Promise<Response> {\n\t\treturn await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.headers({\n\t\t\t\t\"Content-Length\": `${range.maxValue - range.minValue + 1}`,\n\t\t\t\t\"Content-Range\": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t})\n\t\t\t.responseType(ResponseType.RAW)\n\t\t\t.put(fileSlice);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Deletes upload session in the server\n\t * @returns The promise resolves to cancelled response\n\t */\n\tpublic async cancel(): Promise<unknown> {\n\t\tconst cancelResponse = await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.responseType(ResponseType.RAW)\n\t\t\t.delete();\n\t\tif (cancelResponse.status === 204) {\n\t\t\tthis.uploadSession.isCancelled = true;\n\t\t}\n\t\treturn cancelResponse;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Gets status for the upload session\n\t * @returns The promise resolves to the status enquiry response\n\t */\n\tpublic async getStatus(): Promise<unknown> {\n\t\tconst response = await this.client.api(this.uploadSession.url).get();\n\t\tthis.updateTaskStatus(response);\n\t\treturn response;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Resumes upload session and continue uploading the file from the last sent range\n\t * @returns The promise resolves to the uploaded response\n\t */\n\tpublic async resume(): Promise<unknown> {\n\t\tawait this.getStatus();\n\t\treturn await this.upload();\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Get the upload session information\n\t * @returns The large file upload session\n\t */\n\tpublic getUploadSession(): LargeFileUploadSession {\n\t\treturn this.uploadSession;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\nimport { GraphClientError } from \"../../../GraphClientError\";\nimport { FileObject, SliceType } from \"../../LargeFileUploadTask\";\nimport { Range } from \"../Range\";\n\n/**\n * @class\n * Class used for creating LargeFileUploadTask fileobject.\n * This class accepts files of type ArrayBuffer, Blob, Uint8Array.\n */\nexport class FileUpload implements FileObject<SliceType> {\n\t/**\n\t * @public\n\t * @constructor\n\t * @param {ArrayBuffer | Blob | Uint8Array} content - The file to be uploaded\n\t * @param {string} name - The name of the file to be uploaded\n\t * @param {number} size - The total size of the file to be uploaded\n\t * @returns An instance of the FileUpload class\n\t */\n\tpublic constructor(public content: ArrayBuffer | Blob | Uint8Array, public name: string, public size: number) {\n\t\tif (!content || !name || !size) {\n\t\t\tthrow new GraphClientError(\"Please provide the upload content, name of the file and size of the file\");\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Slices the file content to the given range\n\t * @param {Range} range - The range value\n\t * @returns The sliced file part\n\t */\n\tpublic sliceFile(range: Range): ArrayBuffer | Blob | Uint8Array {\n\t\treturn this.content.slice(range.minValue, range.maxValue + 1);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module OneDriveLargeFileUploadTaskUtil\n */\n\n/**\n * @constant\n * Default value for the rangeSize\n * 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}\n */\nconst DEFAULT_FILE_SIZE: number = 5 * 1024 * 1024;\n\n/**\n * @constant\n * Rounds off the given value to a multiple of 320 KB\n * @param {number} value - The value\n * @returns The rounded off value\n */\nconst roundTo320KB = (value: number): number => {\n\tif (value > 320 * 1024) {\n\t\tvalue = Math.floor(value / (320 * 1024)) * 320 * 1024;\n\t}\n\treturn value;\n};\n\n/**\n * @constant\n * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here\n * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session})\n *\n * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value.\n * @returns The valid rangeSize\n */\nexport const getValidRangeSize = (rangeSize: number = DEFAULT_FILE_SIZE): number => {\n\tconst sixtyMB = 60 * 1024 * 1024;\n\tif (rangeSize > sixtyMB) {\n\t\trangeSize = sixtyMB;\n\t}\n\treturn roundTo320KB(rangeSize);\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module OneDriveLargeFileUploadTask\n */\n\nimport { GraphClientError } from \"../GraphClientError\";\nimport { Client } from \"../index\";\nimport { FileUpload } from \"./FileUploadTask/FileObjectClasses/FileUpload\";\nimport { UploadEventHandlers } from \"./FileUploadTask/Interfaces/IUploadEventHandlers\";\nimport { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from \"./LargeFileUploadTask\";\nimport { getValidRangeSize } from \"./OneDriveLargeFileUploadTaskUtil\";\n\n/**\n * @interface\n * Signature to define options when creating an upload task\n * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)\n * @property {string} [fileDescription] - Specifies the description of the file to be uploaded\n * @property {string} [path] - The path to which the file needs to be uploaded\n * @property {number} [rangeSize] - Specifies the range chunk size\n * @property {string} [conflictBehavior] - Conflict behaviour option\n * @property {UploadEventHandlers} [uploadEventHandlers] - UploadEventHandlers attached to an upload task\n */\nexport interface OneDriveLargeFileUploadOptions {\n\tfileName: string;\n\tfileDescription?: string;\n\tpath?: string;\n\trangeSize?: number;\n\tconflictBehavior?: string;\n\tuploadEventHandlers?: UploadEventHandlers;\n /// <summary>\n /// Default upload session url is : \"/me/drive/root:/{file-path}:/createUploadSession\"\n /// Set this property to override the default upload session url. Example: \"/me/drive/special/{name}\"\n /// </summary>\n uploadSessionURL?: string;\n}\n\n/**\n * @interface\n * Signature to define options when creating an upload task\n * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)\n * @property {string} [fileDescription] - Specifies the description of the file to be uploaded\n * @property {string} [conflictBehavior] - Conflict behaviour option\n */\ninterface OneDriveFileUploadSessionPayLoad {\n\tfileName: string;\n\tfileDescription?: string;\n\tconflictBehavior?: string;\n}\n\n/**\n * @interface\n * Signature to define the file information when processing an upload task\n * @property {File | Uint8Array} content - The file content\n * @property {number} size - The size of file\n */\ninterface FileInfo {\n\tcontent: File | Uint8Array;\n\tsize: number;\n}\n\n/**\n * @class\n * Class representing OneDriveLargeFileUploadTask\n */\nexport class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {\n\t/**\n\t * @private\n\t * @static\n\t * Default path for the file being uploaded\n\t */\n\tprivate static DEFAULT_UPLOAD_PATH = \"/\";\n\n\t/**\n\t * @private\n\t * @static\n\t * Constructs the create session url for Onedrive\n\t * @param {string} fileName - The name of the file\n\t * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload\n\t * @returns The constructed create session url\n\t */\n\tprivate static constructCreateSessionUrl(fileName: string, path: string = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH): string {\n\t\tfileName = fileName.trim();\n\t\tpath = path.trim();\n\t\tif (path === \"\") {\n\t\t\tpath = \"/\";\n\t\t}\n\t\tif (path[0] !== \"/\") {\n\t\t\tpath = `/${path}`;\n\t\t}\n\t\tif (path[path.length - 1] !== \"/\") {\n\t\t\tpath = `${path}/`;\n\t\t}\n\t\t// we choose to encode each component of the file path separately because when encoding full URI\n\t\t// with encodeURI, special characters like # or % in the file name doesn't get encoded as desired\n\t\treturn `/me/drive/root:${path\n\t\t\t.split(\"/\")\n\t\t\t.map((p) => encodeURIComponent(p))\n\t\t\t.join(\"/\")}${encodeURIComponent(fileName)}:/createUploadSession`;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * Get file information\n\t * @param {Blob | Uint8Array | File} file - The file entity\n\t * @param {string} fileName - The file name\n\t * @returns {FileInfo} The file information\n\t */\n\tprivate static getFileInfo(file: Blob | Uint8Array | File, fileName: string): FileInfo {\n\t\tlet content;\n\t\tlet size;\n\t\tif (typeof Blob !== \"undefined\" && file instanceof Blob) {\n\t\t\tcontent = new File([file as Blob], fileName);\n\t\t\tsize = content.size;\n\t\t} else if (typeof File !== \"undefined\" && file instanceof File) {\n\t\t\tcontent = file as File;\n\t\t\tsize = content.size;\n\t\t} else if (typeof Uint8Array !== \"undefined\" && file instanceof Uint8Array) {\n\t\t\tconst b = file as Uint8Array;\n\t\t\tsize = b.byteLength;\n\t\t\tcontent = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n\t\t}\n\t\treturn {\n\t\t\tcontent,\n\t\t\tsize,\n\t\t};\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Creates a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {Blob | Uint8Array | File} file - File represented as Blob, Uint8Array or File\n\t * @param {OneDriveLargeFileUploadOptions} options - The options for upload task\n\t * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance\n\t */\n\tpublic static async create(client: Client, file: Blob | Uint8Array | File, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<Blob | ArrayBuffer | Uint8Array>> {\n\t\tif (!client || !file || !options) {\n\t\t\tthrow new GraphClientError(\"Please provide the Graph client instance, file object and OneDriveLargeFileUploadOptions value\");\n\t\t}\n\t\tconst fileName = options.fileName;\n\t\tconst fileInfo = OneDriveLargeFileUploadTask.getFileInfo(file, fileName);\n\t\tconst fileObj = new FileUpload(fileInfo.content, fileName, fileInfo.size);\n\t\treturn this.createTaskWithFileObject<Blob | ArrayBuffer | Uint8Array>(client, fileObj, options);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Creates a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} fileObject - FileObject instance\n\t * @param {OneDriveLargeFileUploadOptions} options - The options for upload task\n\t * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance\n\t */\n\tpublic static async createTaskWithFileObject<T>(client: Client, fileObject: FileObject<T>, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<T>> {\n\t\tif (!client || !fileObject || !options) {\n\t\t\tthrow new GraphClientError(\"Please provide the Graph client instance, FileObject interface implementation and OneDriveLargeFileUploadOptions value\");\n\t\t}\n\t\tconst requestUrl = options.uploadSessionURL ? options.uploadSessionURL: OneDriveLargeFileUploadTask.constructCreateSessionUrl(options.fileName, options.path);\n\t\tconst uploadSessionPayload: OneDriveFileUploadSessionPayLoad = {\n\t\t\tfileName: options.fileName,\n\t\t\tfileDescription: options.fileDescription,\n\t\t\tconflictBehavior: options.conflictBehavior,\n\t\t};\n\t\tconst session = await OneDriveLargeFileUploadTask.createUploadSession(client, requestUrl, uploadSessionPayload);\n\t\tconst rangeSize = getValidRangeSize(options.rangeSize);\n\t\treturn new OneDriveLargeFileUploadTask(client, fileObject, session, {\n\t\t\trangeSize,\n\t\t\tuploadEventHandlers: options.uploadEventHandlers,\n\t\t});\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Makes request to the server to create an upload session\n\t * @param {Client} client - The GraphClient instance\n\t * @param {string} requestUrl - The URL to create the upload session\n\t * @param {string} payloadOptions - The payload option. Default conflictBehavior is 'rename'\n\t * @returns The promise that resolves to LargeFileUploadSession\n\t */\n\tpublic static async createUploadSession(client: Client, requestUrl: string, payloadOptions: OneDriveFileUploadSessionPayLoad): Promise<LargeFileUploadSession> {\n\t\tconst payload = {\n\t\t\titem: {\n\t\t\t\t\"@microsoft.graph.conflictBehavior\": payloadOptions?.conflictBehavior || \"rename\",\n\t\t\t\tname: payloadOptions?.fileName,\n\t\t\t\tdescription: payloadOptions?.fileDescription,\n\t\t\t},\n\t\t};\n\t\treturn super.createUploadSession(client, requestUrl, payload);\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded\n\t * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done\n\t * @param {LargeFileUploadTaskOptions} options - The upload task options\n\t * @returns An instance of OneDriveLargeFileUploadTask\n\t */\n\tpublic constructor(client: Client, file: FileObject<T>, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions) {\n\t\tsuper(client, file, uploadSession, options);\n\t}\n\n\t/**\n\t * @public\n\t * Commits upload session to end uploading\n\t * @param {string} requestUrl - The URL to commit the upload session\n\t * @param {string} conflictBehavior - Conflict behaviour option. Default is 'rename'\n\t * @returns The promise resolves to committed response\n\t */\n\tpublic async commit(requestUrl: string, conflictBehavior = \"rename\"): Promise<unknown> {\n\t\tconst payload = {\n\t\t\tname: this.file.name,\n\t\t\t\"@microsoft.graph.conflictBehavior\": conflictBehavior,\n\t\t\t\"@microsoft.graph.sourceUrl\": this.uploadSession.url,\n\t\t};\n\t\treturn await this.client.api(requestUrl).put(payload);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module CustomAuthenticationProvider\n */\n\nimport { GraphClientError } from \"./GraphClientError\";\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\nimport { AuthProvider } from \"./IAuthProvider\";\n\n/**\n * @class\n * Class representing CustomAuthenticationProvider\n * @extends AuthenticationProvider\n */\nexport class CustomAuthenticationProvider implements AuthenticationProvider {\n\t/**\n\t * @private\n\t * A member to hold authProvider callback\n\t */\n\tprivate provider: AuthProvider;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of CustomAuthenticationProvider\n\t * @param {AuthProviderCallback} provider - An authProvider function\n\t * @returns An instance of CustomAuthenticationProvider\n\t */\n\tpublic constructor(provider: AuthProvider) {\n\t\tthis.provider = provider;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To get the access token\n\t * @returns The promise that resolves to an access token\n\t */\n\tpublic async getAccessToken(): Promise<any> {\n\t\treturn new Promise((resolve: (accessToken: string) => void, reject: (error: any) => void) => {\n\t\t\tthis.provider(async (error: any, accessToken: string | null) => {\n\t\t\t\tif (accessToken) {\n\t\t\t\t\tresolve(accessToken);\n\t\t\t\t} else {\n\t\t\t\t\tif (!error) {\n\t\t\t\t\t\tconst invalidTokenMessage = \"Access token is undefined or empty.\\\n\t\t\t\t\t\tPlease provide a valid token.\\\n\t\t\t\t\t\tFor more help - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md\";\n\t\t\t\t\t\terror = new GraphClientError(invalidTokenMessage);\n\t\t\t\t\t}\n\t\t\t\t\tconst err = await GraphClientError.setGraphClientError(error);\n\t\t\t\t\treject(err);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphError\n */\n\n/**\n * @class\n * Class for GraphError\n * @NOTE: This is NOT what is returned from the Graph\n * GraphError is created from parsing JSON errors returned from the graph\n * Some fields are renamed ie, \"request-id\" => requestId so you can use dot notation\n */\n\nexport class GraphError extends Error {\n\t/**\n\t * @public\n\t * A member holding status code of the error\n\t */\n\tpublic statusCode: number;\n\n\t/**\n\t * @public\n\t * A member holding code i.e name of the error\n\t */\n\tpublic code: string | null;\n\n\t/**\n\t * @public\n\t * A member holding request-id i.e identifier of the request\n\t */\n\tpublic requestId: string | null;\n\n\t/**\n\t * @public\n\t * A member holding processed date and time of the request\n\t */\n\tpublic date: Date;\n\n public headers?: Headers;\n\n\t/**\n\t * @public\n\t * A member holding original error response by the graph service\n\t */\n\tpublic body: any;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphError\n\t * @param {number} [statusCode = -1] - The status code of the error\n\t * @param {string} [message] - The message of the error\n\t * @param {Error} [baseError] - The base error\n\t * @returns An instance of GraphError\n\t */\n\tpublic constructor(statusCode = -1, message?: string, baseError?: Error) {\n\t\tsuper(message || (baseError && baseError.message));\n\t\t// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\t\tObject.setPrototypeOf(this, GraphError.prototype);\n\t\tthis.statusCode = statusCode;\n\t\tthis.code = null;\n\t\tthis.requestId = null;\n\t\tthis.date = new Date();\n\t\tthis.body = null;\n\t\tthis.stack = baseError ? baseError.stack : this.stack;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphErrorHandler\n */\n\nimport { GraphError } from \"./GraphError\";\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\n\n/**\n * @interface\n * Signature for the json represent of the error response from the Graph API\n * https://docs.microsoft.com/en-us/graph/errors\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface GraphAPIErrorResponse {\n\terror: {\n\t\tcode: string;\n\t\tmessage: string;\n\t\tinnerError: any;\n\t};\n}\n\n/**\n * @class\n * Class for GraphErrorHandler\n */\n\nexport class GraphErrorHandler {\n\t/**\n\t * @private\n\t * @static\n\t * Populates the GraphError instance with Error instance values\n\t * @param {Error} error - The error returned by graph service or some native error\n\t * @param {number} [statusCode] - The status code of the response\n\t * @returns The GraphError instance\n\t */\n\tprivate static constructError(error: Error, statusCode?: number, rawResponse?: Response): GraphError {\n\t\tconst gError = new GraphError(statusCode, \"\", error);\n\t\tif (error.name !== undefined) {\n\t\t\tgError.code = error.name;\n\t\t}\n\t\tgError.body = error.toString();\n\t\tgError.date = new Date();\n\t\tgError.headers = rawResponse?.headers;\n\t\treturn gError;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Populates the GraphError instance from the Error returned by graph service\n\t * @param {GraphAPIErrorResponse} graphError - The error possibly returned by graph service or some native error\n\t * @param {number} statusCode - The status code of the response\n\t * @returns A promise that resolves to GraphError instance\n\t *\n\t * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo\n\t * {\n\t * \"error\": {\n\t * \"code\": \"SearchEvents\",\n\t * \"message\": \"The parameter $search is not currently supported on the Events resource.\",\n\t * \"innerError\": {\n\t * \"request-id\": \"b31c83fd-944c-4663-aa50-5d9ceb367e19\",\n\t * \"date\": \"2016-11-17T18:37:45\"\n\t * }\n\t * }\n\t * }\n\t */\n\tprivate static constructErrorFromResponse(graphError: GraphAPIErrorResponse, statusCode: number, rawResponse?: Response): GraphError {\n\t\tconst error = graphError.error;\n\t\tconst gError = new GraphError(statusCode, error.message);\n\t\tgError.code = error.code;\n\t\tif (error.innerError !== undefined) {\n\t\t\tgError.requestId = error.innerError[\"request-id\"];\n\t\t\tgError.date = new Date(error.innerError.date);\n\t\t}\n\n\t\tgError.body = JSON.stringify(error);\n\t\tgError.headers = rawResponse?.headers;\n\n\t\treturn gError;\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To get the GraphError object\n\t * Reference - https://docs.microsoft.com/en-us/graph/errors\n\t * @param {any} [error = null] - The error returned by graph service or some native error\n\t * @param {number} [statusCode = -1] - The status code of the response\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\n\t * @returns A promise that resolves to GraphError instance\n\t */\n\tpublic static async getError(error: any = null, statusCode = -1, callback?: GraphRequestCallback, rawResponse?: Response): Promise<GraphError> {\n\t\tlet gError: GraphError;\n\t\tif (error && error.error) {\n\t\t\tgError = GraphErrorHandler.constructErrorFromResponse(error, statusCode, rawResponse);\n\t\t} else if (error instanceof Error) {\n\t\t\tgError = GraphErrorHandler.constructError(error, statusCode, rawResponse);\n\t\t} else {\n\t\t\tgError = new GraphError(statusCode);\n\t\t\tgError.body = error; // if a custom error is passed which is not instance of Error object or a graph API response\n\t\t}\n\t\tif (typeof callback === \"function\") {\n\t\t\tcallback(gError, null);\n\t\t} else {\n\t\t\treturn gError;\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphRequest\n */\nimport { GraphClientError } from \"./GraphClientError\";\nimport { GraphError } from \"./GraphError\";\nimport { GraphErrorHandler } from \"./GraphErrorHandler\";\nimport { oDataQueryNames, serializeContent, urlJoin } from \"./GraphRequestUtil\";\nimport { GraphResponseHandler } from \"./GraphResponseHandler\";\nimport { HTTPClient } from \"./HTTPClient\";\nimport { ClientOptions } from \"./IClientOptions\";\nimport { Context } from \"./IContext\";\nimport { FetchOptions } from \"./IFetchOptions\";\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\nimport { MiddlewareControl } from \"./middleware/MiddlewareControl\";\nimport { MiddlewareOptions } from \"./middleware/options/IMiddlewareOptions\";\nimport { RequestMethod } from \"./RequestMethod\";\nimport { ResponseType } from \"./ResponseType\";\n/**\n * @interface\n * Signature to representing key value pairs\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface KeyValuePairObjectStringNumber {\n\t[key: string]: string | number;\n}\n\n/**\n * @interface\n * Signature to define URL components\n * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS\n *\n * @property {string} host - The host to which the request needs to be made\n * @property {string} version - Version of the graph endpoint\n * @property {string} [path] - The path of the resource request\n * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params\n * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request\n * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'\n */\nexport interface URLComponents {\n\thost: string;\n\tversion: string;\n\tpath?: string;\n\toDataQueryParams: KeyValuePairObjectStringNumber;\n\totherURLQueryParams: KeyValuePairObjectStringNumber;\n\totherURLQueryOptions?: string[];\n}\n\n/**\n * @class\n * A Class representing GraphRequest\n */\nexport class GraphRequest {\n\t/**\n\t * @private\n\t * A member variable to hold HTTPClient instance\n\t */\n\tprivate httpClient: HTTPClient;\n\n\t/**\n\t * @private\n\t * A member variable to hold client options\n\t */\n\tprivate config: ClientOptions;\n\n\t/**\n\t * @private\n\t * A member to hold URL Components data\n\t */\n\tprivate urlComponents: URLComponents;\n\n\t/**\n\t * @private\n\t * A member to hold custom header options for a request\n\t */\n\tprivate _headers: HeadersInit;\n\n\t/**\n\t * @private\n\t * A member to hold custom options for a request\n\t */\n\tprivate _options: FetchOptions;\n\n\t/**\n\t * @private\n\t * A member to hold the array of middleware options for a request\n\t */\n\tprivate _middlewareOptions: MiddlewareOptions[];\n\n\t/**\n\t * @private\n\t * A member to hold custom response type for a request\n\t */\n\tprivate _responseType: ResponseType;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphRequest\n\t * @param {HTTPClient} httpClient - The HTTPClient instance\n\t * @param {ClientOptions} config - The options for making request\n\t * @param {string} path - A path string\n\t */\n\tpublic constructor(httpClient: HTTPClient, config: ClientOptions, path: string) {\n\t\tthis.httpClient = httpClient;\n\t\tthis.config = config;\n\t\tthis.urlComponents = {\n\t\t\thost: this.config.baseUrl,\n\t\t\tversion: this.config.defaultVersion,\n\t\t\toDataQueryParams: {},\n\t\t\totherURLQueryParams: {},\n\t\t\totherURLQueryOptions: [],\n\t\t};\n\t\tthis._headers = {};\n\t\tthis._options = {};\n\t\tthis._middlewareOptions = [];\n\t\tthis.parsePath(path);\n\t}\n\n\t/**\n\t * @private\n\t * Parses the path string and creates URLComponents out of it\n\t * @param {string} path - The request path string\n\t * @returns Nothing\n\t */\n\tprivate parsePath = (path: string): void => {\n\t\t// Strips out the base of the url if they passed in\n\t\tif (path.indexOf(\"https://\") !== -1) {\n\t\t\tpath = path.replace(\"https://\", \"\");\n\n\t\t\t// Find where the host ends\n\t\t\tconst endOfHostStrPos = path.indexOf(\"/\");\n\t\t\tif (endOfHostStrPos !== -1) {\n\t\t\t\t// Parse out the host\n\t\t\t\tthis.urlComponents.host = \"https://\" + path.substring(0, endOfHostStrPos);\n\t\t\t\t// Strip the host from path\n\t\t\t\tpath = path.substring(endOfHostStrPos + 1, path.length);\n\t\t\t}\n\n\t\t\t// Remove the following version\n\t\t\tconst endOfVersionStrPos = path.indexOf(\"/\");\n\t\t\tif (endOfVersionStrPos !== -1) {\n\t\t\t\t// Parse out the version\n\t\t\t\tthis.urlComponents.version = path.substring(0, endOfVersionStrPos);\n\t\t\t\t// Strip version from path\n\t\t\t\tpath = path.substring(endOfVersionStrPos + 1, path.length);\n\t\t\t}\n\t\t}\n\n\t\t// Strip out any leading \"/\"\n\t\tif (path.charAt(0) === \"/\") {\n\t\t\tpath = path.substr(1);\n\t\t}\n\n\t\tconst queryStrPos = path.indexOf(\"?\");\n\t\tif (queryStrPos === -1) {\n\t\t\t// No query string\n\t\t\tthis.urlComponents.path = path;\n\t\t} else {\n\t\t\tthis.urlComponents.path = path.substr(0, queryStrPos);\n\n\t\t\t// Capture query string into oDataQueryParams and otherURLQueryParams\n\t\t\tconst queryParams = path.substring(queryStrPos + 1, path.length).split(\"&\");\n\t\t\tfor (const queryParam of queryParams) {\n\t\t\t\tthis.parseQueryParameter(queryParam);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @private\n\t * Adds the query parameter as comma separated values\n\t * @param {string} propertyName - The name of a property\n\t * @param {string|string[]} propertyValue - The vale of a property\n\t * @param {IArguments} additionalProperties - The additional properties\n\t * @returns Nothing\n\t */\n\tprivate addCsvQueryParameter(propertyName: string, propertyValue: string | string[], additionalProperties: IArguments): void {\n\t\t// If there are already $propertyName value there, append a \",\"\n\t\tthis.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + \",\" : \"\";\n\n\t\tlet allValues: string[] = [];\n\n\t\tif (additionalProperties.length > 1 && typeof propertyValue === \"string\") {\n\t\t\tallValues = Array.prototype.slice.call(additionalProperties);\n\t\t} else if (typeof propertyValue === \"string\") {\n\t\t\tallValues.push(propertyValue);\n\t\t} else {\n\t\t\tallValues = allValues.concat(propertyValue);\n\t\t}\n\n\t\tthis.urlComponents.oDataQueryParams[propertyName] += allValues.join(\",\");\n\t}\n\n\t/**\n\t * @private\n\t * Builds the full url from the URLComponents to make a request\n\t * @returns The URL string that is qualified to make a request to graph endpoint\n\t */\n\tprivate buildFullUrl(): string {\n\t\tconst url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString();\n\n\t\tif (this.config.debugLogging) {\n\t\t\tconsole.log(url);\n\t\t}\n\t\treturn url;\n\t}\n\n\t/**\n\t * @private\n\t * Builds the query string from the URLComponents\n\t * @returns The Constructed query string\n\t */\n\tprivate createQueryString(): string {\n\t\t// Combining query params from oDataQueryParams and otherURLQueryParams\n\t\tconst urlComponents = this.urlComponents;\n\t\tconst query: string[] = [];\n\t\tif (Object.keys(urlComponents.oDataQueryParams).length !== 0) {\n\t\t\tfor (const property in urlComponents.oDataQueryParams) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(urlComponents.oDataQueryParams, property)) {\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.oDataQueryParams[property]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Object.keys(urlComponents.otherURLQueryParams).length !== 0) {\n\t\t\tfor (const property in urlComponents.otherURLQueryParams) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(urlComponents.otherURLQueryParams, property)) {\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.otherURLQueryParams[property]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (urlComponents.otherURLQueryOptions.length !== 0) {\n\t\t\tfor (const str of urlComponents.otherURLQueryOptions) {\n\t\t\t\tquery.push(str);\n\t\t\t}\n\t\t}\n\t\treturn query.length > 0 ? \"?\" + query.join(\"&\") : \"\";\n\t}\n\n\t/**\n\t * @private\n\t * Parses the query parameters to set the urlComponents property of the GraphRequest object\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tprivate parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\n\t\tif (typeof queryDictionaryOrString === \"string\") {\n\t\t\tif (queryDictionaryOrString.charAt(0) === \"?\") {\n\t\t\t\tqueryDictionaryOrString = queryDictionaryOrString.substring(1);\n\t\t\t}\n\n\t\t\tif (queryDictionaryOrString.indexOf(\"&\") !== -1) {\n\t\t\t\tconst queryParams = queryDictionaryOrString.split(\"&\");\n\t\t\t\tfor (const str of queryParams) {\n\t\t\t\t\tthis.parseQueryParamenterString(str);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.parseQueryParamenterString(queryDictionaryOrString);\n\t\t\t}\n\t\t} else if (queryDictionaryOrString.constructor === Object) {\n\t\t\tfor (const key in queryDictionaryOrString) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(queryDictionaryOrString, key)) {\n\t\t\t\t\tthis.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * @private\n\t * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object\n\t * @param {string} queryParameter - the query parameters\n\t * returns nothing\n\t */\n\tprivate parseQueryParamenterString(queryParameter: string): void {\n\t\t/* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters.\n Example-> \"/me?$expand=home($select=city)\" */\n\t\tif (this.isValidQueryKeyValuePair(queryParameter)) {\n\t\t\tconst indexOfFirstEquals = queryParameter.indexOf(\"=\");\n\t\t\tconst paramKey = queryParameter.substring(0, indexOfFirstEquals);\n\t\t\tconst paramValue = queryParameter.substring(indexOfFirstEquals + 1);\n\t\t\tthis.setURLComponentsQueryParamater(paramKey, paramValue);\n\t\t} else {\n\t\t\t/* Push values which are not of key-value structure.\n Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/\n\t\t\tthis.urlComponents.otherURLQueryOptions.push(queryParameter);\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Sets values into the urlComponents property of GraphRequest object.\n\t * @param {string} paramKey - the query parameter key\n\t * @param {string} paramValue - the query paramter value\n\t * @returns nothing\n\t */\n\tprivate setURLComponentsQueryParamater(paramKey: string, paramValue: string | number): void {\n\t\tif (oDataQueryNames.indexOf(paramKey) !== -1) {\n\t\t\tconst currentValue = this.urlComponents.oDataQueryParams[paramKey];\n\t\t\tconst isValueAppendable = currentValue && (paramKey === \"$expand\" || paramKey === \"$select\" || paramKey === \"$orderby\");\n\t\t\tthis.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + \",\" + paramValue : paramValue;\n\t\t} else {\n\t\t\tthis.urlComponents.otherURLQueryParams[paramKey] = paramValue;\n\t\t}\n\t}\n\t/**\n\t * @private\n\t * Check if the query parameter string has a valid key-value structure\n\t * @param {string} queryString - the query parameter string. Example -> \"name=value\"\n\t * #returns true if the query string has a valid key-value structure else false\n\t */\n\tprivate isValidQueryKeyValuePair(queryString: string): boolean {\n\t\tconst indexofFirstEquals = queryString.indexOf(\"=\");\n\t\tif (indexofFirstEquals === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tconst indexofOpeningParanthesis = queryString.indexOf(\"(\");\n\t\tif (indexofOpeningParanthesis !== -1 && queryString.indexOf(\"(\") < indexofFirstEquals) {\n\t\t\t// Example -> .query($select($expand=true));\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * @private\n\t * Updates the custom headers and options for a request\n\t * @param {FetchOptions} options - The request options object\n\t * @returns Nothing\n\t */\n\tprivate updateRequestOptions(options: FetchOptions): void {\n\t\tconst optionsHeaders: HeadersInit = { ...options.headers };\n\t\tif (this.config.fetchOptions !== undefined) {\n\t\t\tconst fetchOptions: FetchOptions = { ...this.config.fetchOptions };\n\t\t\tObject.assign(options, fetchOptions);\n\t\t\tif (typeof this.config.fetchOptions.headers !== undefined) {\n\t\t\t\toptions.headers = { ...this.config.fetchOptions.headers };\n\t\t\t}\n\t\t}\n\t\tObject.assign(options, this._options);\n\t\tif (options.headers !== undefined) {\n\t\t\tObject.assign(optionsHeaders, options.headers);\n\t\t}\n\t\tObject.assign(optionsHeaders, this._headers);\n\t\toptions.headers = optionsHeaders;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * Adds the custom headers and options to the request and makes the HTTPClient send request call\n\t * @param {RequestInfo} request - The request url string or the Request object value\n\t * @param {FetchOptions} options - The options to make a request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the response content\n\t */\n\tprivate async send(request: RequestInfo, options: FetchOptions, callback?: GraphRequestCallback): Promise<any> {\n\t\tlet rawResponse: Response;\n\t\tconst middlewareControl = new MiddlewareControl(this._middlewareOptions);\n\t\tthis.updateRequestOptions(options);\n\t\tconst customHosts = this.config?.customHosts;\n\t\ttry {\n\t\t\tconst context: Context = await this.httpClient.sendRequest({\n\t\t\t\trequest,\n\t\t\t\toptions,\n\t\t\t\tmiddlewareControl,\n\t\t\t\tcustomHosts,\n\t\t\t});\n\n\t\t\trawResponse = context.response;\n\t\t\tconst response: any = await GraphResponseHandler.getResponse(rawResponse, this._responseType, callback);\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\tif (error instanceof GraphClientError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tlet statusCode: number;\n\n\t\t\tif (rawResponse) {\n\t\t\t\tstatusCode = rawResponse.status;\n\t\t\t}\n\t\t\tconst gError: GraphError = await GraphErrorHandler.getError(error, statusCode, callback, rawResponse);\n\t\t\tthrow gError;\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json\n\t * @param none\n\t * @returns nothing\n\t */\n\tprivate setHeaderContentType(): void {\n\t\tif (!this._headers) {\n\t\t\tthis.header(\"Content-Type\", \"application/json\");\n\t\t\treturn;\n\t\t}\n\t\tconst headerKeys = Object.keys(this._headers);\n\t\tfor (const headerKey of headerKeys) {\n\t\t\tif (headerKey.toLowerCase() === \"content-type\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Default the content-type to application/json in case the content-type is not present in the header\n\t\tthis.header(\"Content-Type\", \"application/json\");\n\t}\n\n\t/**\n\t * @public\n\t * Sets the custom header for a request\n\t * @param {string} headerKey - A header key\n\t * @param {string} headerValue - A header value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic header(headerKey: string, headerValue: string): GraphRequest {\n\t\tthis._headers[headerKey] = headerValue;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the custom headers for a request\n\t * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest {\n\t\tfor (const key in headers) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(headers, key)) {\n\t\t\t\tthis._headers[key] = headers[key] as string;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the option for making a request\n\t * @param {string} key - The key value\n\t * @param {any} value - The value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic option(key: string, value: any): GraphRequest {\n\t\tthis._options[key] = value;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the options for making a request\n\t * @param {{ [key: string]: any }} options - The options key value pair\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic options(options: { [key: string]: any }): GraphRequest {\n\t\tfor (const key in options) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(options, key)) {\n\t\t\t\tthis._options[key] = options[key];\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the middleware options for a request\n\t * @param {MiddlewareOptions[]} options - The array of middleware options\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic middlewareOptions(options: MiddlewareOptions[]): GraphRequest {\n\t\tthis._middlewareOptions = options;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the api endpoint version for a request\n\t * @param {string} version - The version value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic version(version: string): GraphRequest {\n\t\tthis.urlComponents.version = version;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the api endpoint version for a request\n\t * @param {ResponseType} responseType - The response type value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic responseType(responseType: ResponseType): GraphRequest {\n\t\tthis._responseType = responseType;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for select OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query\n\t */\n\t/*\n\t * Accepts .select(\"displayName,birthday\")\n\t * and .select([\"displayName\", \"birthday\"])\n\t * and .select(\"displayName\", \"birthday\")\n\t *\n\t */\n\tpublic select(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$select\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for expand OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query\n\t */\n\tpublic expand(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$expand\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for orderby OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query\n\t */\n\tpublic orderby(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$orderby\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} filterStr - The filter query string\n\t * @returns The same GraphRequest instance that is being called with, after adding the $filter query\n\t */\n\tpublic filter(filterStr: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$filter = filterStr;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} searchStr - The search criterion string\n\t * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria\n\t */\n\tpublic search(searchStr: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$search = searchStr;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {number} n - The number value\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for $top query\n\t */\n\tpublic top(n: number): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$top = n;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {number} n - The number value\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query\n\t */\n\tpublic skip(n: number): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$skip = n;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} token - The token value\n\t * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option\n\t */\n\tpublic skipToken(token: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$skipToken = token;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {boolean} isCount - The count boolean\n\t * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option\n\t */\n\tpublic count(isCount = true): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$count = isCount.toString();\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Appends query string to the urlComponent\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value\n\t * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component\n\t */\n\t/*\n\t * Accepts .query(\"displayName=xyz\")\n\t * and .select({ name: \"value\" })\n\t */\n\tpublic query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\n\t\treturn this.parseQueryParameter(queryDictionaryOrString);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the get response\n\t */\n\tpublic async get(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.GET,\n\t\t};\n\t\tconst response = await this.send(url, options, callback);\n\t\treturn response;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with POST method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the post response\n\t */\n\tpublic async post(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.POST,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\tconst className: string = content && content.constructor && content.constructor.name;\n\t\tif (className === \"FormData\") {\n\t\t\t// Content-Type headers should not be specified in case the of FormData type content\n\t\t\toptions.headers = {};\n\t\t} else {\n\t\t\tthis.setHeaderContentType();\n\t\t\toptions.headers = this._headers;\n\t\t}\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for Post request call\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the post response\n\t */\n\tpublic async create(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.post(content, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with PUT method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the put response\n\t */\n\tpublic async put(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tthis.setHeaderContentType();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.PUT,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with PATCH method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the patch response\n\t */\n\tpublic async patch(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tthis.setHeaderContentType();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.PATCH,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for PATCH request\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the patch response\n\t */\n\tpublic async update(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.patch(content, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with DELETE method\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the delete response\n\t */\n\tpublic async delete(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.DELETE,\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for delete request call\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the delete response\n\t */\n\tpublic async del(callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.delete(callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method to read response as a stream.\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the getStream response\n\t */\n\tpublic async getStream(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options = {\n\t\t\tmethod: RequestMethod.GET,\n\t\t};\n\t\tthis.responseType(ResponseType.STREAM);\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method to read response as a stream.\n\t * @param {any} stream - The stream instance\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the putStream response\n\t */\n\tpublic async putStream(stream: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options = {\n\t\t\tmethod: RequestMethod.PUT,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t},\n\t\t\tbody: stream,\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPClient\n */\n\nimport { Context } from \"./IContext\";\nimport { Middleware } from \"./middleware/IMiddleware\";\n\n/**\n * @class\n * Class representing HTTPClient\n */\nexport class HTTPClient {\n\t/**\n\t * @private\n\t * A member holding first middleware of the middleware chain\n\t */\n\tprivate middleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of a HTTPClient\n\t * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\n\t */\n\tpublic constructor(...middleware: Middleware[]) {\n\t\tif (!middleware || !middleware.length) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidMiddlewareChain\";\n\t\t\terror.message = \"Please provide a default middleware chain or custom middleware chain\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.setMiddleware(...middleware);\n\t}\n\n\t/**\n\t * @private\n\t * Processes the middleware parameter passed to set this.middleware property\n\t * The calling function should validate if middleware is not undefined or not empty.\n\t * @param {...Middleware} middleware - The middleware passed\n\t * @returns Nothing\n\t */\n\tprivate setMiddleware(...middleware: Middleware[]): void {\n\t\tif (middleware.length > 1) {\n\t\t\tthis.parseMiddleWareArray(middleware);\n\t\t} else {\n\t\t\tthis.middleware = middleware[0];\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Processes the middleware array to construct the chain\n\t * and sets this.middleware property to the first middleware handler of the array\n\t * The calling function should validate if middleware is not undefined or not empty\n\t * @param {Middleware[]} middlewareArray - The array of middleware handlers\n\t * @returns Nothing\n\t */\n\tprivate parseMiddleWareArray(middlewareArray: Middleware[]) {\n\t\tmiddlewareArray.forEach((element, index) => {\n\t\t\tif (index < middlewareArray.length - 1) {\n\t\t\t\telement.setNext(middlewareArray[index + 1]);\n\t\t\t}\n\t\t});\n\t\tthis.middleware = middlewareArray[0];\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To send the request through the middleware chain\n\t * @param {Context} context - The context of a request\n\t * @returns A promise that resolves to the Context\n\t */\n\tpublic async sendRequest(context: Context): Promise<Context> {\n\t\tif (typeof context.request === \"string\" && context.options === undefined) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidRequestOptions\";\n\t\t\terror.message = \"Unable to execute the middleware, Please provide valid options for a request\";\n\t\t\tthrow error;\n\t\t}\n\t\tawait this.middleware.execute(context);\n\t\treturn context;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPClientFactory\n */\n\nimport { HTTPClient } from \"./HTTPClient\";\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\nimport { AuthenticationHandler } from \"./middleware/AuthenticationHandler\";\nimport { HTTPMessageHandler } from \"./middleware/HTTPMessageHandler\";\nimport { Middleware } from \"./middleware/IMiddleware\";\nimport { RedirectHandlerOptions } from \"./middleware/options/RedirectHandlerOptions\";\nimport { RetryHandlerOptions } from \"./middleware/options/RetryHandlerOptions\";\nimport { RedirectHandler } from \"./middleware/RedirectHandler\";\nimport { RetryHandler } from \"./middleware/RetryHandler\";\nimport { TelemetryHandler } from \"./middleware/TelemetryHandler\";\n\n/**\n * @private\n * To check whether the environment is node or not\n * @returns A boolean representing the environment is node or not\n */\nconst isNodeEnvironment = (): boolean => {\n\treturn typeof process === \"object\" && typeof require === \"function\";\n};\n\n/**\n * @class\n * Class representing HTTPClientFactory\n */\nexport class HTTPClientFactory {\n\t/**\n\t * @public\n\t * @static\n\t * Creates HTTPClient with default middleware chain\n\t * @param {AuthenticationProvider} authProvider - The authentication provider instance\n\t * @returns A HTTPClient instance\n\t *\n\t * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline.\n\t * \t\t* HTTPMessageHandler should be the last one in the middleware pipeline, because this makes the actual network call of the request\n\t * \t\t* 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 \t*\t\t before making the actual network call ensures that the usage of all features are recorded in the flag.\n\t * \t\t* 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\n\t * \t\t 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.\n\t */\n\tpublic static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient {\n\t\tconst authenticationHandler = new AuthenticationHandler(authProvider);\n\t\tconst retryHandler = new RetryHandler(new RetryHandlerOptions());\n\t\tconst telemetryHandler = new TelemetryHandler();\n\t\tconst httpMessageHandler = new HTTPMessageHandler();\n\n\t\tauthenticationHandler.setNext(retryHandler);\n\t\tif (isNodeEnvironment()) {\n\t\t\tconst redirectHandler = new RedirectHandler(new RedirectHandlerOptions());\n\t\t\tretryHandler.setNext(redirectHandler);\n\t\t\tredirectHandler.setNext(telemetryHandler);\n\t\t} else {\n\t\t\tretryHandler.setNext(telemetryHandler);\n\t\t}\n\t\ttelemetryHandler.setNext(httpMessageHandler);\n\t\treturn HTTPClientFactory.createWithMiddleware(authenticationHandler);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * Creates a middleware chain with the given one\n\t * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\n\t * @returns A HTTPClient instance\n\t */\n\tpublic static createWithMiddleware(...middleware: Middleware[]): HTTPClient {\n\t\t// Middleware should not empty or undefined. This is check is present in the HTTPClient constructor.\n\t\treturn new HTTPClient(...middleware);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @constant\n * @function\n * Validates availability of Promise and fetch in global context\n * @returns The true in case the Promise and fetch available, otherwise throws error\n */\n\nexport const validatePolyFilling = (): boolean => {\n\tif (typeof Promise === \"undefined\" && typeof fetch === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without Promise and fetch. So, please provide polyfill for them.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t} else if (typeof Promise === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without Promise. So, please provide polyfill for it.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t} else if (typeof fetch === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without fetch. So, please provide polyfill for it.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t}\n\treturn true;\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Client\n */\n\nimport { GRAPH_API_VERSION, GRAPH_BASE_URL } from \"./Constants\";\nimport { CustomAuthenticationProvider } from \"./CustomAuthenticationProvider\";\nimport { GraphRequest } from \"./GraphRequest\";\nimport { HTTPClient } from \"./HTTPClient\";\nimport { HTTPClientFactory } from \"./HTTPClientFactory\";\nimport { ClientOptions } from \"./IClientOptions\";\nimport { Options } from \"./IOptions\";\nimport { validatePolyFilling } from \"./ValidatePolyFilling\";\n\nexport class Client {\n\t/**\n\t * @private\n\t * A member which stores the Client instance options\n\t */\n\tprivate config: ClientOptions = {\n\t\tbaseUrl: GRAPH_BASE_URL,\n\t\tdebugLogging: false,\n\t\tdefaultVersion: GRAPH_API_VERSION,\n\t};\n\n\t/**\n\t * @private\n\t * A member which holds the HTTPClient instance\n\t */\n\tprivate httpClient: HTTPClient;\n\n\t/**\n\t * @public\n\t * @static\n\t * To create a client instance with options and initializes the default middleware chain\n\t * @param {Options} options - The options for client instance\n\t * @returns The Client instance\n\t */\n\tpublic static init(options: Options): Client {\n\t\tconst clientOptions: ClientOptions = {};\n\t\tfor (const i in options) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(options, i)) {\n\t\t\t\tclientOptions[i] = i === \"authProvider\" ? new CustomAuthenticationProvider(options[i]) : options[i];\n\t\t\t}\n\t\t}\n\t\treturn Client.initWithMiddleware(clientOptions);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * To create a client instance with the Client Options\n\t * @param {ClientOptions} clientOptions - The options object for initializing the client\n\t * @returns The Client instance\n\t */\n\tpublic static initWithMiddleware(clientOptions: ClientOptions): Client {\n\t\treturn new Client(clientOptions);\n\t}\n\n\t/**\n\t * @private\n\t * @constructor\n\t * Creates an instance of Client\n\t * @param {ClientOptions} clientOptions - The options to instantiate the client object\n\t */\n\tprivate constructor(clientOptions: ClientOptions) {\n\t\tvalidatePolyFilling();\n\t\tfor (const key in clientOptions) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(clientOptions, key)) {\n\t\t\t\tthis.config[key] = clientOptions[key];\n\t\t\t}\n\t\t}\n\t\tlet httpClient: HTTPClient;\n\t\tif (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"AmbiguityInInitialization\";\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both\";\n\t\t\tthrow error;\n\t\t} else if (clientOptions.authProvider !== undefined) {\n\t\t\thttpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider);\n\t\t} else if (clientOptions.middleware !== undefined) {\n\t\t\thttpClient = new HTTPClient(...[].concat(clientOptions.middleware));\n\t\t} else {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidMiddlewareChain\";\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.httpClient = httpClient;\n\t}\n\n\t/**\n\t * @public\n\t * Entry point to make requests\n\t * @param {string} path - The path string value\n\t * @returns The graph request instance\n\t */\n\tpublic api(path: string): GraphRequest {\n\t\treturn new GraphRequest(this.httpClient, this.config, path);\n\t}\n}\n","/**\n * Teams Adaptive Card converter for cross-platform cards.\n *\n * Converts CardElement to Microsoft Adaptive Cards format.\n * @see https://adaptivecards.io/\n */\n\nimport {\n createEmojiConverter,\n mapButtonStyle,\n cardToFallbackText as sharedCardToFallbackText,\n} from \"@chat-adapter/shared\";\nimport type {\n ActionsElement,\n ButtonElement,\n CardChild,\n CardElement,\n DividerElement,\n FieldsElement,\n ImageElement,\n LinkButtonElement,\n SectionElement,\n TextElement,\n} from \"chat\";\n\n/**\n * Convert emoji placeholders in text to Teams format.\n */\nconst convertEmoji = createEmojiConverter(\"teams\");\n\n// Adaptive Card types (simplified)\nexport interface AdaptiveCard {\n $schema: string;\n actions?: AdaptiveCardAction[];\n body: AdaptiveCardElement[];\n type: \"AdaptiveCard\";\n version: string;\n}\n\nexport interface AdaptiveCardElement {\n type: string;\n [key: string]: unknown;\n}\n\nexport interface AdaptiveCardAction {\n data?: Record<string, unknown>;\n style?: string;\n title: string;\n type: string;\n url?: string;\n}\n\nconst ADAPTIVE_CARD_SCHEMA =\n \"http://adaptivecards.io/schemas/adaptive-card.json\";\nconst ADAPTIVE_CARD_VERSION = \"1.4\";\n\n/**\n * Convert a CardElement to a Teams Adaptive Card.\n */\nexport function cardToAdaptiveCard(card: CardElement): AdaptiveCard {\n const body: AdaptiveCardElement[] = [];\n const actions: AdaptiveCardAction[] = [];\n\n // Add title as TextBlock\n if (card.title) {\n body.push({\n type: \"TextBlock\",\n text: convertEmoji(card.title),\n weight: \"bolder\",\n size: \"large\",\n wrap: true,\n });\n }\n\n // Add subtitle as TextBlock\n if (card.subtitle) {\n body.push({\n type: \"TextBlock\",\n text: convertEmoji(card.subtitle),\n isSubtle: true,\n wrap: true,\n });\n }\n\n // Add header image if present\n if (card.imageUrl) {\n body.push({\n type: \"Image\",\n url: card.imageUrl,\n size: \"stretch\",\n });\n }\n\n // Convert children\n for (const child of card.children) {\n const result = convertChildToAdaptive(child);\n body.push(...result.elements);\n actions.push(...result.actions);\n }\n\n const adaptiveCard: AdaptiveCard = {\n type: \"AdaptiveCard\",\n $schema: ADAPTIVE_CARD_SCHEMA,\n version: ADAPTIVE_CARD_VERSION,\n body,\n };\n\n if (actions.length > 0) {\n adaptiveCard.actions = actions;\n }\n\n return adaptiveCard;\n}\n\ninterface ConvertResult {\n actions: AdaptiveCardAction[];\n elements: AdaptiveCardElement[];\n}\n\n/**\n * Convert a card child element to Adaptive Card elements.\n */\nfunction convertChildToAdaptive(child: CardChild): ConvertResult {\n switch (child.type) {\n case \"text\":\n return { elements: [convertTextToElement(child)], actions: [] };\n case \"image\":\n return { elements: [convertImageToElement(child)], actions: [] };\n case \"divider\":\n return { elements: [convertDividerToElement(child)], actions: [] };\n case \"actions\":\n return convertActionsToElements(child);\n case \"section\":\n return convertSectionToElements(child);\n case \"fields\":\n return { elements: [convertFieldsToElement(child)], actions: [] };\n case \"link\":\n return {\n elements: [\n {\n type: \"TextBlock\",\n text: `[${convertEmoji(child.label)}](${child.url})`,\n wrap: true,\n },\n ],\n actions: [],\n };\n default:\n return { elements: [], actions: [] };\n }\n}\n\nfunction convertTextToElement(element: TextElement): AdaptiveCardElement {\n const textBlock: AdaptiveCardElement = {\n type: \"TextBlock\",\n text: convertEmoji(element.content),\n wrap: true,\n };\n\n if (element.style === \"bold\") {\n textBlock.weight = \"bolder\";\n } else if (element.style === \"muted\") {\n textBlock.isSubtle = true;\n }\n\n return textBlock;\n}\n\nfunction convertImageToElement(element: ImageElement): AdaptiveCardElement {\n return {\n type: \"Image\",\n url: element.url,\n altText: element.alt || \"Image\",\n size: \"auto\",\n };\n}\n\nfunction convertDividerToElement(\n _element: DividerElement\n): AdaptiveCardElement {\n // Adaptive Cards don't have a native divider, use a separator container\n return {\n type: \"Container\",\n separator: true,\n items: [],\n };\n}\n\nfunction convertActionsToElements(element: ActionsElement): ConvertResult {\n // In Adaptive Cards, actions go at the card level, not inline\n const actions: AdaptiveCardAction[] = element.children\n .filter((child) => child.type === \"button\" || child.type === \"link-button\")\n .map((button) => {\n if (button.type === \"link-button\") {\n return convertLinkButtonToAction(button);\n }\n return convertButtonToAction(button);\n });\n\n return { elements: [], actions };\n}\n\nfunction convertButtonToAction(button: ButtonElement): AdaptiveCardAction {\n const action: AdaptiveCardAction = {\n type: \"Action.Submit\",\n title: convertEmoji(button.label),\n data: {\n actionId: button.id,\n value: button.value,\n },\n };\n\n const style = mapButtonStyle(button.style, \"teams\");\n if (style) {\n action.style = style;\n }\n\n return action;\n}\n\nfunction convertLinkButtonToAction(\n button: LinkButtonElement\n): AdaptiveCardAction {\n const action: AdaptiveCardAction = {\n type: \"Action.OpenUrl\",\n title: convertEmoji(button.label),\n url: button.url,\n };\n\n const style = mapButtonStyle(button.style, \"teams\");\n if (style) {\n action.style = style;\n }\n\n return action;\n}\n\nfunction convertSectionToElements(element: SectionElement): ConvertResult {\n const elements: AdaptiveCardElement[] = [];\n const actions: AdaptiveCardAction[] = [];\n\n // Wrap section in a container\n const containerItems: AdaptiveCardElement[] = [];\n\n for (const child of element.children) {\n const result = convertChildToAdaptive(child);\n containerItems.push(...result.elements);\n actions.push(...result.actions);\n }\n\n if (containerItems.length > 0) {\n elements.push({\n type: \"Container\",\n items: containerItems,\n });\n }\n\n return { elements, actions };\n}\n\nfunction convertFieldsToElement(element: FieldsElement): AdaptiveCardElement {\n // Use FactSet for key-value pairs\n const facts = element.children.map((field) => ({\n title: convertEmoji(field.label),\n value: convertEmoji(field.value),\n }));\n\n return {\n type: \"FactSet\",\n facts,\n };\n}\n\n/**\n * Generate fallback text from a card element.\n * Used when adaptive cards aren't supported.\n */\nexport function cardToFallbackText(card: CardElement): string {\n return sharedCardToFallbackText(card, {\n boldFormat: \"**\",\n lineBreak: \"\\n\\n\",\n platform: \"teams\",\n });\n}\n","/**\n * Teams-specific format conversion using AST-based parsing.\n *\n * Teams supports a subset of HTML for formatting:\n * - Bold: <b> or <strong>\n * - Italic: <i> or <em>\n * - Strikethrough: <s> or <strike>\n * - Links: <a href=\"url\">text</a>\n * - Code: <pre> and <code>\n *\n * Teams also accepts standard markdown in most cases.\n */\n\nimport {\n type AdapterPostableMessage,\n BaseFormatConverter,\n type Content,\n getNodeChildren,\n getNodeValue,\n isBlockquoteNode,\n isCodeNode,\n isDeleteNode,\n isEmphasisNode,\n isInlineCodeNode,\n isLinkNode,\n isListItemNode,\n isListNode,\n isParagraphNode,\n isStrongNode,\n isTextNode,\n parseMarkdown,\n type Root,\n} from \"chat\";\n\nexport class TeamsFormatConverter extends BaseFormatConverter {\n /**\n * Convert @mentions to Teams format in plain text.\n * @name → <at>name</at>\n */\n private convertMentionsToTeams(text: string): string {\n return text.replace(/@(\\w+)/g, \"<at>$1</at>\");\n }\n\n /**\n * Override renderPostable to convert @mentions in plain strings.\n */\n override renderPostable(message: AdapterPostableMessage): string {\n if (typeof message === \"string\") {\n return this.convertMentionsToTeams(message);\n }\n if (\"raw\" in message) {\n return this.convertMentionsToTeams(message.raw);\n }\n if (\"markdown\" in message) {\n return this.fromAst(parseMarkdown(message.markdown));\n }\n if (\"ast\" in message) {\n return this.fromAst(message.ast);\n }\n return \"\";\n }\n\n /**\n * Render an AST to Teams format.\n * Teams accepts standard markdown, so we just stringify cleanly.\n */\n fromAst(ast: Root): string {\n return this.fromAstWithNodeConverter(ast, (node) => this.nodeToTeams(node));\n }\n\n /**\n * Parse Teams message into an AST.\n * Converts Teams HTML/mentions to standard markdown format.\n */\n toAst(teamsText: string): Root {\n // Convert Teams HTML to markdown, then parse\n let markdown = teamsText;\n\n // Convert @mentions from Teams format: <at>Name</at> -> @Name\n markdown = markdown.replace(/<at>([^<]+)<\\/at>/gi, \"@$1\");\n\n // Convert HTML tags to markdown\n // Bold: <b>, <strong> -> **text**\n markdown = markdown.replace(\n /<(b|strong)>([^<]+)<\\/(b|strong)>/gi,\n \"**$2**\"\n );\n\n // Italic: <i>, <em> -> _text_\n markdown = markdown.replace(/<(i|em)>([^<]+)<\\/(i|em)>/gi, \"_$2_\");\n\n // Strikethrough: <s>, <strike> -> ~~text~~\n markdown = markdown.replace(\n /<(s|strike)>([^<]+)<\\/(s|strike)>/gi,\n \"~~$2~~\"\n );\n\n // Links: <a href=\"url\">text</a> -> [text](url)\n markdown = markdown.replace(\n /<a[^>]+href=\"([^\"]+)\"[^>]*>([^<]+)<\\/a>/gi,\n \"[$2]($1)\"\n );\n\n // Code: <code>text</code> -> `text`\n markdown = markdown.replace(/<code>([^<]+)<\\/code>/gi, \"`$1`\");\n\n // Pre: <pre>text</pre> -> ```text```\n markdown = markdown.replace(/<pre>([^<]+)<\\/pre>/gi, \"```\\n$1\\n```\");\n\n // Strip remaining HTML tags\n markdown = markdown.replace(/<[^>]+>/g, \"\");\n\n // Decode HTML entities\n markdown = markdown\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&amp;/g, \"&\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\");\n\n return parseMarkdown(markdown);\n }\n\n private nodeToTeams(node: Content): string {\n // Use type guards for type-safe node handling\n if (isParagraphNode(node)) {\n return getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n }\n\n if (isTextNode(node)) {\n // Convert @mentions to Teams format <at>mention</at>\n return node.value.replace(/@(\\w+)/g, \"<at>$1</at>\");\n }\n\n if (isStrongNode(node)) {\n // Teams supports **text** markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `**${content}**`;\n }\n\n if (isEmphasisNode(node)) {\n // Teams supports _text_ markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `_${content}_`;\n }\n\n if (isDeleteNode(node)) {\n // Teams supports ~~text~~ markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `~~${content}~~`;\n }\n\n if (isInlineCodeNode(node)) {\n return `\\`${node.value}\\``;\n }\n\n if (isCodeNode(node)) {\n return `\\`\\`\\`${node.lang || \"\"}\\n${node.value}\\n\\`\\`\\``;\n }\n\n if (isLinkNode(node)) {\n const linkText = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n // Standard markdown link format\n return `[${linkText}](${node.url})`;\n }\n\n if (isBlockquoteNode(node)) {\n return getNodeChildren(node)\n .map((child) => `> ${this.nodeToTeams(child)}`)\n .join(\"\\n\");\n }\n\n if (isListNode(node)) {\n return getNodeChildren(node)\n .map((item, i) => {\n const prefix = node.ordered ? `${i + 1}.` : \"-\";\n const content = getNodeChildren(item)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `${prefix} ${content}`;\n })\n .join(\"\\n\");\n }\n\n if (isListItemNode(node)) {\n return getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n }\n\n if (node.type === \"break\") {\n return \"\\n\";\n }\n\n if (node.type === \"thematicBreak\") {\n return \"---\";\n }\n\n // For unsupported nodes, try to extract text\n const children = getNodeChildren(node);\n if (children.length > 0) {\n return children.map((child) => this.nodeToTeams(child)).join(\"\");\n }\n return getNodeValue(node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,SAAS,UAAU,GAAG,GAAG;AAC9B,MAAI,OAAO,MAAM,cAAc,MAAM;AACjC,UAAM,IAAI,UAAU,yBAAyB,OAAO,CAAC,IAAI,+BAA+B;AAC5F,gBAAc,GAAG,CAAC;AAClB,WAAS,KAAK;AAAE,SAAK,cAAc;AAAA,EAAG;AACtC,IAAE,YAAY,MAAM,OAAO,OAAO,OAAO,CAAC,KAAK,GAAG,YAAY,EAAE,WAAW,IAAI,GAAG;AACpF;AAaO,SAAS,OAAO,GAAG,GAAG;AAC3B,MAAI,IAAI,CAAC;AACT,WAAS,KAAK,EAAG,KAAI,OAAO,UAAU,eAAe,KAAK,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI;AAC9E,MAAE,CAAC,IAAI,EAAE,CAAC;AACd,MAAI,KAAK,QAAQ,OAAO,OAAO,0BAA0B;AACrD,aAAS,IAAI,GAAG,IAAI,OAAO,sBAAsB,CAAC,GAAG,IAAI,EAAE,QAAQ,KAAK;AACpE,UAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,UAAU,qBAAqB,KAAK,GAAG,EA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B;AACA,SAAO,IAAI,aAAa,QAAQ;AAClC;","names":["v","d","b","__assign","o","GraphClientError","TokenCredentialAuthenticationProvider","RequestMethod","FeatureUsageFlag","ChaosStrategy","ResponseType","DocumentType","ContentType","ContentTypeRegexStr","path","context"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphClientError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions.js","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/authProviderOptions/azureTokenCredentials/index.ts","../src/index.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/RequestMethod.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/content/BatchRequestContent.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Constants.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphClientError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphRequestUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareControl.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/MiddlewareUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/AuthenticationHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/TelemetryHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/AuthenticationHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/HTTPMessageHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RetryHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/RetryHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/RedirectHandlerOptions.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/RedirectHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Version.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/TelemetryHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/middleware/options/ChaosStrategy.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/ResponseType.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphResponseHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/Range.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/UploadResult.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/LargeFileUploadTask.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/FileUploadTask/FileObjectClasses/FileUpload.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/OneDriveLargeFileUploadTaskUtil.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/tasks/OneDriveLargeFileUploadTask.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/CustomAuthenticationProvider.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphError.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphErrorHandler.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/GraphRequest.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/HTTPClient.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/HTTPClientFactory.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/ValidatePolyFilling.ts","../../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/src/Client.ts","../src/cards.ts","../src/markdown.ts"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphClientError\n */\n\n/**\n * @class\n * Create GraphClientError object to handle client-side errors\n * encountered within the JavaScript Client SDK.\n * Whereas GraphError Class should be used to handle errors in the response from the Graph API.\n */\n\nexport class GraphClientError extends Error {\n\t/**\n\t * @public\n\t * A custom error. This property should set be when the error is not of instanceOf Error/GraphClientError.\n\t * Example =\n\t * const client = MicrosoftGraph.Client.init({\n\t * \t\tdefaultVersion: \"v1.0\",\n\t * \tauthProvider: (done) => { done({TokenError:\"AccessToken cannot be null\"}, \"<ACCESS_TOKEN>\");\n\t * });\n\t */\n\tpublic customError?: any;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To set the GraphClientError object\n\t * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request\n\t * @returns GraphClientError object set to the error passed\n\t */\n\tpublic static setGraphClientError(error: any): GraphClientError {\n\t\tlet graphClientError: GraphClientError;\n\t\tif (error instanceof Error) {\n\t\t\tgraphClientError = error;\n\t\t} else {\n\t\t\tgraphClientError = new GraphClientError();\n\t\t\tgraphClientError.customError = error;\n\t\t}\n\t\treturn graphClientError;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphClientError\n\t * @param {string} message? - Error message\n\t * @returns An instance of GraphClientError\n\t */\n\tpublic constructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, GraphClientError.prototype);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\nimport { TokenCredential } from \"@azure/identity\";\n\nimport { GraphClientError } from \"../../GraphClientError\";\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\nimport { TokenCredentialAuthenticationProviderOptions } from \"./ITokenCredentialAuthenticationProviderOptions\";\n\n/**\n * @module TokenCredentialAuthenticationProvider\n */\n\n/**\n * @class\n * Class representing TokenCredentialAuthenticationProvider\n * This feature is introduced in Version 3.0.0\n * @extends AuthenticationProvider\n * Reference - https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md\n */\nexport class TokenCredentialAuthenticationProvider implements AuthenticationProvider {\n\t/**\n\t * @private\n\t * A member holding an instance of @azure/identity TokenCredential\n\t */\n\tprivate tokenCredential: TokenCredential;\n\n\t/**\n\t * @private\n\t * A member holding an instance of TokenCredentialAuthenticationProviderOptions\n\t */\n\tprivate authenticationProviderOptions: TokenCredentialAuthenticationProviderOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of TokenCredentialAuthenticationProvider\n\t * @param {TokenCredential} tokenCredential - An instance of @azure/identity TokenCredential\n\t * @param {TokenCredentialAuthenticationProviderOptions} authenticationProviderOptions - An instance of TokenCredentialAuthenticationProviderOptions\n\t * @returns An instance of TokenCredentialAuthenticationProvider\n\t */\n\tpublic constructor(tokenCredential: TokenCredential, authenticationProviderOptions: TokenCredentialAuthenticationProviderOptions) {\n\t\tif (!tokenCredential) {\n\t\t\tthrow new GraphClientError(\"Please pass a token credential object to the TokenCredentialAuthenticationProvider class constructor\");\n\t\t}\n\t\tif (!authenticationProviderOptions) {\n\t\t\tthrow new GraphClientError(\"Please pass the TokenCredentialAuthenticationProviderOptions with scopes to the TokenCredentialAuthenticationProvider class constructor\");\n\t\t}\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\n\t\tthis.tokenCredential = tokenCredential;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To get the access token\n\t * @param {TokenCredentialAuthenticationProviderOptions} authenticationProviderOptions - The authentication provider options object\n\t * @returns The promise that resolves to an access token\n\t */\n\tpublic async getAccessToken(): Promise<string> {\n\t\tconst scopes = this.authenticationProviderOptions.scopes;\n\t\tconst error = new GraphClientError();\n\n\t\tif (!scopes || scopes.length === 0) {\n\t\t\terror.name = \"Empty Scopes\";\n\t\t\terror.message = \"Scopes cannot be empty, Please provide scopes\";\n\t\t\tthrow error;\n\t\t}\n\t\tconst response = await this.tokenCredential.getToken(scopes, this.authenticationProviderOptions.getTokenOptions);\n\t\tif (response) {\n\t\t\treturn response.token;\n\t\t}\n\t\terror.message = \"Cannot retrieve accessToken from the Token Credential object\";\n\t\terror.name = \"Access token is undefined\";\n\t\tthrow error;\n\t}\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=ITokenCredentialAuthenticationProviderOptions.js.map","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\nexport * from \"../../lib/src/authentication/azureTokenCredentials/TokenCredentialAuthenticationProvider\";\nexport * from \"../../lib/src/authentication/azureTokenCredentials/ITokenCredentialAuthenticationProviderOptions\";\n","import { ClientSecretCredential } from \"@azure/identity\";\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport {\n TokenCredentialAuthenticationProvider,\n type TokenCredentialAuthenticationProviderOptions,\n} from \"@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials/index.js\";\nimport type { Activity, ConversationReference } from \"botbuilder\";\nimport {\n ActivityTypes,\n CloudAdapter,\n ConfigurationBotFrameworkAuthentication,\n TeamsInfo,\n type TurnContext,\n} from \"botbuilder\";\n\n/** Extended CloudAdapter that exposes processActivity for serverless environments */\nclass ServerlessCloudAdapter extends CloudAdapter {\n handleActivity(\n authHeader: string,\n activity: Activity,\n logic: (context: TurnContext) => Promise<void>\n ) {\n return this.processActivity(authHeader, activity, logic);\n }\n}\n\nimport {\n AdapterRateLimitError,\n AuthenticationError,\n bufferToDataUri,\n extractCard,\n extractFiles,\n NetworkError,\n PermissionError,\n toBuffer,\n ValidationError,\n} from \"@chat-adapter/shared\";\nimport type {\n ActionEvent,\n Adapter,\n AdapterPostableMessage,\n Attachment,\n ChannelInfo,\n ChatInstance,\n EmojiValue,\n FetchOptions,\n FetchResult,\n FileUpload,\n FormattedContent,\n ListThreadsOptions,\n ListThreadsResult,\n Logger,\n RawMessage,\n ReactionEvent,\n ThreadInfo,\n ThreadSummary,\n WebhookOptions,\n} from \"chat\";\nimport {\n ConsoleLogger,\n convertEmojiPlaceholders,\n defaultEmojiResolver,\n Message,\n NotImplementedError,\n} from \"chat\";\nimport { cardToAdaptiveCard } from \"./cards\";\nimport { TeamsFormatConverter } from \"./markdown\";\n\nconst MESSAGEID_CAPTURE_PATTERN = /messageid=(\\d+)/;\nconst MESSAGEID_STRIP_PATTERN = /;messageid=\\d+/;\nconst SEMICOLON_MESSAGEID_CAPTURE_PATTERN = /;messageid=(\\d+)/;\n\n/** Microsoft Graph API chat message type */\ninterface GraphChatMessage {\n attachments?: Array<{\n id?: string;\n contentType?: string;\n contentUrl?: string;\n content?: string; // JSON string for adaptive cards\n name?: string;\n }>;\n body?: {\n content?: string;\n contentType?: \"text\" | \"html\";\n };\n createdDateTime?: string;\n from?: {\n user?: {\n id?: string;\n displayName?: string;\n };\n application?: {\n id?: string;\n displayName?: string;\n };\n };\n id: string;\n lastModifiedDateTime?: string;\n replyToId?: string; // ID of parent message for channel threads\n}\n\nexport interface TeamsAdapterConfig {\n /** Microsoft App ID */\n appId: string;\n /** Microsoft App Password */\n appPassword: string;\n /** Microsoft App Tenant ID */\n appTenantId?: string;\n /** Microsoft App Type */\n appType?: \"MultiTenant\" | \"SingleTenant\";\n /** Logger instance for error reporting */\n logger: Logger;\n /** Override bot username (optional) */\n userName?: string;\n}\n\n/** Teams-specific thread ID data */\nexport interface TeamsThreadId {\n conversationId: string;\n replyToId?: string;\n serviceUrl: string;\n}\n\n/** Teams channel context extracted from activity.channelData */\ninterface TeamsChannelContext {\n channelId: string;\n teamId: string;\n tenantId: string;\n}\n\nexport class TeamsAdapter implements Adapter<TeamsThreadId, unknown> {\n readonly name = \"teams\";\n readonly userName: string;\n readonly botUserId?: string;\n\n private readonly botAdapter: ServerlessCloudAdapter;\n private readonly graphClient: Client | null = null;\n private chat: ChatInstance | null = null;\n private readonly logger: Logger;\n private readonly formatConverter = new TeamsFormatConverter();\n private readonly config: TeamsAdapterConfig;\n\n constructor(config: TeamsAdapterConfig) {\n this.config = config;\n this.logger = config.logger;\n this.userName = config.userName || \"bot\";\n\n if (config.appType === \"SingleTenant\" && !config.appTenantId) {\n throw new ValidationError(\n \"teams\",\n \"appTenantId is required for SingleTenant app type\"\n );\n }\n\n // Pass empty config object, credentials go via factory\n const auth = new ConfigurationBotFrameworkAuthentication({\n MicrosoftAppId: config.appId,\n MicrosoftAppPassword: config.appPassword,\n MicrosoftAppType: config.appType || \"MultiTenant\",\n MicrosoftAppTenantId:\n config.appType === \"SingleTenant\" ? config.appTenantId : undefined,\n });\n\n this.botAdapter = new ServerlessCloudAdapter(auth);\n\n // Initialize Microsoft Graph client for message history (requires tenant ID)\n if (config.appTenantId) {\n const credential = new ClientSecretCredential(\n config.appTenantId,\n config.appId,\n config.appPassword\n );\n\n const authProvider = new TokenCredentialAuthenticationProvider(\n credential,\n {\n scopes: [\"https://graph.microsoft.com/.default\"],\n } as TokenCredentialAuthenticationProviderOptions\n );\n\n this.graphClient = Client.initWithMiddleware({ authProvider });\n }\n }\n\n async initialize(chat: ChatInstance): Promise<void> {\n this.chat = chat;\n }\n\n async handleWebhook(\n request: Request,\n options?: WebhookOptions\n ): Promise<Response> {\n const body = await request.text();\n this.logger.debug(\"Teams webhook raw body\", { body });\n\n let activity: Activity;\n try {\n activity = JSON.parse(body);\n } catch (e) {\n this.logger.error(\"Failed to parse request body\", { error: e });\n return new Response(\"Invalid JSON\", { status: 400 });\n }\n\n // Get the auth header for token validation\n const authHeader = request.headers.get(\"authorization\") || \"\";\n\n try {\n // Use handleActivity which takes the activity directly\n // instead of mocking Node.js req/res objects\n await this.botAdapter.handleActivity(\n authHeader,\n activity,\n async (context) => {\n await this.handleTurn(context, options);\n }\n );\n\n return new Response(JSON.stringify({}), {\n status: 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n } catch (error) {\n this.logger.error(\"Bot adapter process error\", { error });\n return new Response(JSON.stringify({ error: \"Internal error\" }), {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n });\n }\n }\n\n private async handleTurn(\n context: TurnContext,\n options?: WebhookOptions\n ): Promise<void> {\n if (!this.chat) {\n this.logger.warn(\"Chat instance not initialized, ignoring event\");\n return;\n }\n\n const activity = context.activity;\n\n // Cache serviceUrl and tenantId for the user - needed for opening DMs later\n if (activity.from?.id && activity.serviceUrl) {\n const userId = activity.from.id;\n const channelData = activity.channelData as {\n tenant?: { id?: string };\n team?: { id?: string };\n channel?: { id?: string };\n };\n const tenantId = channelData?.tenant?.id;\n const ttl = 30 * 24 * 60 * 60 * 1000; // 30 days\n\n // Store serviceUrl and tenantId for DM creation\n this.chat\n .getState()\n .set(`teams:serviceUrl:${userId}`, activity.serviceUrl, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache serviceUrl\", {\n userId,\n error: err,\n });\n });\n if (tenantId) {\n this.chat\n .getState()\n .set(`teams:tenantId:${userId}`, tenantId, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache tenantId\", {\n userId,\n error: err,\n });\n });\n }\n\n // Cache team/channel context for proper message fetching in channel threads\n // This allows fetchMessages to use the channel-specific endpoint for thread filtering\n // The Graph API requires aadGroupId (GUID format), not the Teams thread-style ID\n // Note: The botbuilder types don't include aadGroupId, but it's present at runtime\n // aadGroupId is only available in installationUpdate/conversationUpdate events\n const team = channelData?.team as\n | { id?: string; aadGroupId?: string }\n | undefined;\n const teamAadGroupId = team?.aadGroupId;\n const teamThreadId = team?.id; // Thread-style ID like \"19:xxx@thread.tacv2\"\n const conversationId = activity.conversation?.id || \"\";\n const baseChannelId = conversationId.replace(MESSAGEID_STRIP_PATTERN, \"\");\n\n if (teamAadGroupId && channelData?.channel?.id && tenantId) {\n // We have aadGroupId (from installationUpdate/conversationUpdate) - cache it\n const context: TeamsChannelContext = {\n teamId: teamAadGroupId, // Use aadGroupId (GUID) for Graph API\n channelId: channelData.channel.id,\n tenantId,\n };\n const contextJson = JSON.stringify(context);\n\n // Cache by conversation ID (channel)\n this.chat\n .getState()\n .set(`teams:channelContext:${baseChannelId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache channel context\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n\n // Also cache by team thread-style ID for lookup from regular messages\n // (which don't have aadGroupId but do have team.id)\n if (teamThreadId) {\n this.chat\n .getState()\n .set(`teams:teamContext:${teamThreadId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache team context\", {\n teamThreadId,\n error: err,\n });\n });\n }\n\n this.logger.info(\n \"Cached Teams team GUID from installation/update event\",\n {\n activityType: activity.type,\n conversationId: baseChannelId,\n teamThreadId,\n teamGuid: context.teamId,\n channelId: context.channelId,\n }\n );\n } else if (teamThreadId && channelData?.channel?.id && tenantId) {\n // Regular message event - no aadGroupId, but try to look up from previous cache\n const cachedTeamContext = await this.chat\n .getState()\n .get<string>(`teams:teamContext:${teamThreadId}`);\n\n if (cachedTeamContext) {\n // Found cached context from installation event - also cache by channel ID\n this.chat\n .getState()\n .set(\n `teams:channelContext:${baseChannelId}`,\n cachedTeamContext,\n ttl\n )\n .catch((err) => {\n this.logger.error(\"Failed to cache channel context from team\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n this.logger.info(\"Using cached Teams team GUID for channel\", {\n conversationId: baseChannelId,\n teamThreadId,\n });\n } else {\n // No cached context - try to fetch team details via Bot Framework API\n // TeamsInfo.getTeamDetails() calls /v3/teams/{teamId} and returns aadGroupId\n try {\n const teamDetails = await TeamsInfo.getTeamDetails(context);\n if (teamDetails?.aadGroupId) {\n const fetchedContext: TeamsChannelContext = {\n teamId: teamDetails.aadGroupId,\n channelId: channelData.channel.id,\n tenantId,\n };\n const contextJson = JSON.stringify(fetchedContext);\n\n // Cache by conversation ID\n this.chat\n .getState()\n .set(`teams:channelContext:${baseChannelId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache fetched channel context\", {\n conversationId: baseChannelId,\n error: err,\n });\n });\n\n // Also cache by team thread-style ID\n this.chat\n .getState()\n .set(`teams:teamContext:${teamThreadId}`, contextJson, ttl)\n .catch((err) => {\n this.logger.error(\"Failed to cache fetched team context\", {\n teamThreadId,\n error: err,\n });\n });\n\n this.logger.info(\n \"Fetched and cached Teams team GUID via TeamsInfo API\",\n {\n conversationId: baseChannelId,\n teamThreadId,\n teamGuid: teamDetails.aadGroupId,\n teamName: teamDetails.name,\n }\n );\n }\n } catch (error) {\n // TeamsInfo.getTeamDetails() only works in team scope\n this.logger.debug(\n \"Could not fetch team details (may not be a team scope)\",\n { teamThreadId, error }\n );\n }\n }\n }\n }\n\n // Handle message reactions\n if (activity.type === ActivityTypes.MessageReaction) {\n this.handleReactionActivity(activity, options);\n return;\n }\n\n // Handle adaptive card actions (button clicks)\n if (activity.type === ActivityTypes.Invoke) {\n await this.handleInvokeActivity(context, options);\n return;\n }\n\n // Only handle message activities\n if (activity.type !== ActivityTypes.Message) {\n this.logger.debug(\"Ignoring non-message activity\", {\n type: activity.type,\n });\n return;\n }\n\n // Check if this message activity is actually a button click (Action.Submit)\n // Teams sends Action.Submit as a message with value.actionId\n const actionValue = activity.value as\n | { actionId?: string; value?: string }\n | undefined;\n if (actionValue?.actionId) {\n this.handleMessageAction(activity, actionValue, options);\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n replyToId: activity.replyToId,\n });\n\n // Let Chat class handle async processing and waitUntil\n this.chat.processMessage(\n this,\n threadId,\n this.parseTeamsMessage(activity, threadId),\n options\n );\n }\n\n /**\n * Handle Action.Submit button clicks sent as message activities.\n * Teams sends these with type \"message\" and value.actionId.\n */\n private handleMessageAction(\n activity: Activity,\n actionValue: { actionId?: string; value?: string },\n options?: WebhookOptions\n ): void {\n if (!(this.chat && actionValue.actionId)) {\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const actionEvent: Omit<ActionEvent, \"thread\" | \"openModal\"> & {\n adapter: TeamsAdapter;\n } = {\n actionId: actionValue.actionId,\n value: actionValue.value,\n user: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: false,\n isMe: false,\n },\n messageId: activity.replyToId || activity.id || \"\",\n threadId,\n adapter: this,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams message action (Action.Submit)\", {\n actionId: actionValue.actionId,\n value: actionValue.value,\n messageId: actionEvent.messageId,\n threadId,\n });\n\n this.chat.processAction(actionEvent, options);\n }\n\n /**\n * Handle invoke activities (adaptive card actions, etc.).\n */\n private async handleInvokeActivity(\n context: TurnContext,\n options?: WebhookOptions\n ): Promise<void> {\n const activity = context.activity;\n\n // Handle adaptive card action invokes\n if (activity.name === \"adaptiveCard/action\") {\n await this.handleAdaptiveCardAction(context, activity, options);\n return;\n }\n\n this.logger.debug(\"Ignoring unsupported invoke\", {\n name: activity.name,\n });\n }\n\n /**\n * Handle adaptive card button clicks.\n * The action data is in activity.value with our { actionId, value } structure.\n */\n private async handleAdaptiveCardAction(\n context: TurnContext,\n activity: Activity,\n options?: WebhookOptions\n ): Promise<void> {\n if (!this.chat) {\n return;\n }\n\n // Activity.value contains our action data\n const actionData = activity.value?.action?.data as\n | { actionId?: string; value?: string }\n | undefined;\n\n if (!actionData?.actionId) {\n this.logger.debug(\"Adaptive card action missing actionId\", {\n value: activity.value,\n });\n // Send acknowledgment response\n await context.sendActivity({\n type: ActivityTypes.InvokeResponse,\n value: { status: 200 },\n });\n return;\n }\n\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const actionEvent: Omit<ActionEvent, \"thread\" | \"openModal\"> & {\n adapter: TeamsAdapter;\n } = {\n actionId: actionData.actionId,\n value: actionData.value,\n user: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: false,\n isMe: false,\n },\n messageId: activity.replyToId || activity.id || \"\",\n threadId,\n adapter: this,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams adaptive card action\", {\n actionId: actionData.actionId,\n value: actionData.value,\n messageId: actionEvent.messageId,\n threadId,\n });\n\n this.chat.processAction(actionEvent, options);\n\n // Send acknowledgment response to prevent timeout\n await context.sendActivity({\n type: ActivityTypes.InvokeResponse,\n value: { status: 200 },\n });\n }\n\n /**\n * Handle Teams reaction events (reactionsAdded/reactionsRemoved).\n */\n private handleReactionActivity(\n activity: Activity,\n options?: WebhookOptions\n ): void {\n if (!this.chat) {\n return;\n }\n\n // Extract the message ID from conversation ID\n // Format: \"19:xxx@thread.tacv2;messageid=1767297849909\"\n const conversationId = activity.conversation?.id || \"\";\n const messageIdMatch = conversationId.match(MESSAGEID_CAPTURE_PATTERN);\n const messageId = messageIdMatch?.[1] || activity.replyToId || \"\";\n\n // Build thread ID - KEEP the full conversation ID including ;messageid=XXX\n // This is required for Teams to reply in the correct thread\n const threadId = this.encodeThreadId({\n conversationId,\n serviceUrl: activity.serviceUrl || \"\",\n });\n\n const user = {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name,\n isBot: false,\n isMe: this.isMessageFromSelf(activity),\n };\n\n // Process added reactions\n const reactionsAdded = activity.reactionsAdded || [];\n for (const reaction of reactionsAdded) {\n const rawEmoji = reaction.type || \"\";\n const emojiValue = defaultEmojiResolver.fromTeams(rawEmoji);\n\n const event: Omit<ReactionEvent, \"adapter\" | \"thread\"> = {\n emoji: emojiValue,\n rawEmoji,\n added: true,\n user,\n messageId,\n threadId,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams reaction added\", {\n emoji: emojiValue.name,\n rawEmoji,\n messageId,\n });\n\n this.chat.processReaction({ ...event, adapter: this }, options);\n }\n\n // Process removed reactions\n const reactionsRemoved = activity.reactionsRemoved || [];\n for (const reaction of reactionsRemoved) {\n const rawEmoji = reaction.type || \"\";\n const emojiValue = defaultEmojiResolver.fromTeams(rawEmoji);\n\n const event: Omit<ReactionEvent, \"adapter\" | \"thread\"> = {\n emoji: emojiValue,\n rawEmoji,\n added: false,\n user,\n messageId,\n threadId,\n raw: activity,\n };\n\n this.logger.debug(\"Processing Teams reaction removed\", {\n emoji: emojiValue.name,\n rawEmoji,\n messageId,\n });\n\n this.chat.processReaction({ ...event, adapter: this }, options);\n }\n }\n\n private parseTeamsMessage(\n activity: Activity,\n threadId: string\n ): Message<unknown> {\n const text = activity.text || \"\";\n // Normalize mentions - format converter will convert <at>name</at> to @name\n const normalizedText = this.normalizeMentions(text, activity);\n\n const isMe = this.isMessageFromSelf(activity);\n\n return new Message({\n id: activity.id || \"\",\n threadId,\n text: this.formatConverter.extractPlainText(normalizedText),\n formatted: this.formatConverter.toAst(normalizedText),\n raw: activity,\n author: {\n userId: activity.from?.id || \"unknown\",\n userName: activity.from?.name || \"unknown\",\n fullName: activity.from?.name || \"unknown\",\n isBot: activity.from?.role === \"bot\",\n isMe,\n },\n metadata: {\n dateSent: activity.timestamp\n ? new Date(activity.timestamp)\n : new Date(),\n edited: false,\n },\n attachments: (activity.attachments || [])\n .filter(\n (att) =>\n // Filter out adaptive cards (handled separately as cards, not attachments)\n att.contentType !== \"application/vnd.microsoft.card.adaptive\" &&\n // Filter out text/html without contentUrl - this is just the formatted\n // version of the message text, not an actual file attachment.\n // Real HTML file attachments would have a contentUrl.\n !(att.contentType === \"text/html\" && !att.contentUrl)\n )\n .map((att) => this.createAttachment(att)),\n });\n }\n\n /**\n * Create an Attachment object from a Teams attachment.\n */\n private createAttachment(att: {\n contentType?: string;\n contentUrl?: string;\n name?: string;\n }): Attachment {\n const url = att.contentUrl;\n\n // Determine type based on contentType\n let type: Attachment[\"type\"] = \"file\";\n if (att.contentType?.startsWith(\"image/\")) {\n type = \"image\";\n } else if (att.contentType?.startsWith(\"video/\")) {\n type = \"video\";\n } else if (att.contentType?.startsWith(\"audio/\")) {\n type = \"audio\";\n }\n\n return {\n type,\n url,\n name: att.name,\n mimeType: att.contentType,\n fetchData: url\n ? async () => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new NetworkError(\n \"teams\",\n `Failed to fetch file: ${response.status} ${response.statusText}`\n );\n }\n const arrayBuffer = await response.arrayBuffer();\n return Buffer.from(arrayBuffer);\n }\n : undefined,\n };\n }\n\n private normalizeMentions(text: string, _activity: Activity): string {\n // Don't strip mentions - the format converter will convert <at>name</at> to @name\n // Just trim any leading/trailing whitespace that might result from mention placement\n return text.trim();\n }\n\n async postMessage(\n threadId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n // Check for files to upload\n const files = extractFiles(message);\n const fileAttachments =\n files.length > 0 ? await this.filesToAttachments(files) : [];\n\n // Check if message contains a card\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n // Render card as Adaptive Card\n const adaptiveCard = cardToAdaptiveCard(card);\n\n activity = {\n type: ActivityTypes.Message,\n // Don't include text - Teams shows both text and card if text is present\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ...fileAttachments,\n ],\n };\n\n this.logger.debug(\"Teams API: sendActivity (adaptive card)\", {\n conversationId,\n serviceUrl,\n fileCount: fileAttachments.length,\n });\n } else {\n // Regular text message\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n\n activity = {\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n attachments: fileAttachments.length > 0 ? fileAttachments : undefined,\n };\n\n this.logger.debug(\"Teams API: sendActivity (message)\", {\n conversationId,\n serviceUrl,\n textLength: text.length,\n fileCount: fileAttachments.length,\n });\n }\n\n // Use the adapter to send the message\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n let messageId = \"\";\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n const response = await context.sendActivity(activity);\n messageId = response?.id || \"\";\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: sendActivity failed\", {\n conversationId,\n error,\n });\n this.handleTeamsError(error, \"postMessage\");\n }\n\n this.logger.debug(\"Teams API: sendActivity response\", { messageId });\n\n return {\n id: messageId,\n threadId,\n raw: activity,\n };\n }\n\n /**\n * Convert files to Teams attachments.\n * Uses inline data URIs for small files.\n */\n private async filesToAttachments(\n files: FileUpload[]\n ): Promise<Array<{ contentType: string; contentUrl: string; name: string }>> {\n const attachments: Array<{\n contentType: string;\n contentUrl: string;\n name: string;\n }> = [];\n\n for (const file of files) {\n // Convert data to Buffer using shared utility\n const buffer = await toBuffer(file.data, {\n platform: \"teams\",\n throwOnUnsupported: false,\n });\n if (!buffer) {\n continue;\n }\n\n // Create data URI using shared utility\n const mimeType = file.mimeType || \"application/octet-stream\";\n const dataUri = bufferToDataUri(buffer, mimeType);\n\n attachments.push({\n contentType: mimeType,\n contentUrl: dataUri,\n name: file.filename,\n });\n }\n\n return attachments;\n }\n\n async editMessage(\n threadId: string,\n messageId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n // Check if message contains a card\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n // Render card as Adaptive Card\n const adaptiveCard = cardToAdaptiveCard(card);\n\n activity = {\n id: messageId,\n type: ActivityTypes.Message,\n // Don't include text - Teams shows both text and card if text is present\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ],\n };\n\n this.logger.debug(\"Teams API: updateActivity (adaptive card)\", {\n conversationId,\n messageId,\n });\n } else {\n // Regular text message\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n\n activity = {\n id: messageId,\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n };\n\n this.logger.debug(\"Teams API: updateActivity\", {\n conversationId,\n messageId,\n textLength: text.length,\n });\n }\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.updateActivity(activity);\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: updateActivity failed\", {\n conversationId,\n messageId,\n error,\n });\n this.handleTeamsError(error, \"editMessage\");\n }\n\n this.logger.debug(\"Teams API: updateActivity response\", { ok: true });\n\n return {\n id: messageId,\n threadId,\n raw: activity,\n };\n }\n\n async deleteMessage(threadId: string, messageId: string): Promise<void> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n this.logger.debug(\"Teams API: deleteActivity\", {\n conversationId,\n messageId,\n });\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.deleteActivity(messageId);\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: deleteActivity failed\", {\n conversationId,\n messageId,\n error,\n });\n this.handleTeamsError(error, \"deleteMessage\");\n }\n\n this.logger.debug(\"Teams API: deleteActivity response\", { ok: true });\n }\n\n async addReaction(\n _threadId: string,\n _messageId: string,\n _emoji: EmojiValue | string\n ): Promise<void> {\n throw new NotImplementedError(\n \"Teams Bot Framework does not expose reaction APIs\",\n \"addReaction\"\n );\n }\n\n async removeReaction(\n _threadId: string,\n _messageId: string,\n _emoji: EmojiValue | string\n ): Promise<void> {\n throw new NotImplementedError(\n \"Teams Bot Framework does not expose reaction APIs\",\n \"removeReaction\"\n );\n }\n\n async startTyping(threadId: string, _status?: string): Promise<void> {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: conversationId },\n };\n\n this.logger.debug(\"Teams API: sendActivity (typing)\", { conversationId });\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n await context.sendActivity({ type: ActivityTypes.Typing });\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: sendActivity (typing) failed\", {\n conversationId,\n error,\n });\n this.handleTeamsError(error, \"startTyping\");\n }\n\n this.logger.debug(\"Teams API: sendActivity (typing) response\", {\n ok: true,\n });\n }\n\n /**\n * Open a direct message conversation with a user.\n * Returns a thread ID that can be used to post messages.\n *\n * The serviceUrl and tenantId are automatically resolved from cached user interactions.\n * If no cached values are found, defaults are used (which may not work for all tenants).\n */\n async openDM(userId: string): Promise<string> {\n // Look up cached serviceUrl and tenantId for this user from state\n const cachedServiceUrl = await this.chat\n ?.getState()\n .get<string>(`teams:serviceUrl:${userId}`);\n const cachedTenantId = await this.chat\n ?.getState()\n .get<string>(`teams:tenantId:${userId}`);\n\n const serviceUrl =\n cachedServiceUrl || \"https://smba.trafficmanager.net/teams/\";\n // Use cached tenant ID, config tenant ID, or undefined (will fail for multi-tenant)\n const tenantId = cachedTenantId || this.config.appTenantId;\n\n this.logger.debug(\"Teams: creating 1:1 conversation\", {\n userId,\n serviceUrl,\n tenantId,\n cachedServiceUrl: !!cachedServiceUrl,\n cachedTenantId: !!cachedTenantId,\n });\n\n if (!tenantId) {\n throw new ValidationError(\n \"teams\",\n \"Cannot open DM: tenant ID not found. User must interact with the bot first (via @mention) to cache their tenant ID.\"\n );\n }\n\n let conversationId = \"\";\n\n // Create the 1:1 conversation using createConversationAsync\n // The conversation ID is captured from within the callback, not from the return value\n // biome-ignore lint/suspicious/noExplicitAny: BotBuilder types are incomplete\n await (this.botAdapter as any).createConversationAsync(\n this.config.appId,\n \"msteams\",\n serviceUrl,\n \"\", // empty audience\n {\n isGroup: false,\n bot: { id: this.config.appId, name: this.userName },\n members: [{ id: userId }],\n tenantId,\n channelData: {\n tenant: { id: tenantId },\n },\n },\n async (turnContext: TurnContext) => {\n // Capture the conversation ID from the new context\n conversationId = turnContext?.activity?.conversation?.id || \"\";\n this.logger.debug(\"Teams: conversation created in callback\", {\n conversationId,\n activityId: turnContext?.activity?.id,\n });\n }\n );\n\n if (!conversationId) {\n throw new NetworkError(\n \"teams\",\n \"Failed to create 1:1 conversation - no ID returned\"\n );\n }\n\n this.logger.debug(\"Teams: 1:1 conversation created\", { conversationId });\n\n return this.encodeThreadId({\n conversationId,\n serviceUrl,\n });\n }\n\n async fetchMessages(\n threadId: string,\n options: FetchOptions = {}\n ): Promise<FetchResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams fetchMessages requires appTenantId to be configured for Microsoft Graph API access.\",\n \"fetchMessages\"\n );\n }\n\n const { conversationId } = this.decodeThreadId(threadId);\n const limit = options.limit || 50;\n const cursor = options.cursor;\n const direction = options.direction ?? \"backward\";\n\n // Extract message ID for thread filtering (format: \"19:xxx@thread.tacv2;messageid=123456\")\n const messageIdMatch = conversationId.match(\n SEMICOLON_MESSAGEID_CAPTURE_PATTERN\n );\n const threadMessageId = messageIdMatch?.[1];\n\n // Strip ;messageid= from conversation ID\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n // Try to get cached channel context for proper thread-level message fetching\n let channelContext: TeamsChannelContext | null = null;\n if (threadMessageId && this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Invalid cached data, ignore\n }\n }\n\n // Note: Team GUID is cached during webhook handling via TeamsInfo.getTeamDetails()\n // If no cached context, we'll fall back to the chat endpoint (less accurate for channels)\n }\n\n try {\n this.logger.debug(\"Teams Graph API: fetching messages\", {\n conversationId: baseConversationId,\n threadMessageId,\n hasChannelContext: !!channelContext,\n limit,\n cursor,\n direction,\n });\n\n // If we have channel context and a thread message ID, use the channel replies endpoint\n // This gives us proper thread-level filtering instead of all messages in the channel\n if (channelContext && threadMessageId) {\n return this.fetchChannelThreadMessages(\n channelContext,\n threadMessageId,\n threadId,\n options\n );\n }\n\n // Teams conversation IDs:\n // - Channels: \"19:xxx@thread.tacv2\"\n // - Group chats: \"19:xxx@thread.v2\"\n // - 1:1 chats: other formats (e.g., \"a]xxx\", \"8:orgid:xxx\")\n // For Graph API, we use /chats/{chat-id}/messages for all chat types\n\n // Note: Teams Graph API only supports orderby(\"createdDateTime desc\")\n // Ascending order is not supported, so we work around this limitation.\n // Also, max page size is 50 messages per request.\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (direction === \"forward\") {\n // Forward direction: need to fetch ALL messages to find the oldest ones\n // since API only supports descending order. Paginate with max 50 per request.\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient\n .api(apiUrl)\n .top(50) // Max allowed by Teams API\n .orderby(\"createdDateTime desc\");\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allMessages.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse to get chronological order (oldest first)\n allMessages.reverse();\n\n // Find starting position based on cursor (cursor is a timestamp)\n let startIndex = 0;\n if (cursor) {\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n\n // Check if there are more messages beyond our slice\n hasMoreMessages = startIndex + limit < allMessages.length;\n // Take only the requested limit\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n // Backward direction: simple pagination\n let request = this.graphClient\n .api(`/chats/${encodeURIComponent(baseConversationId)}/messages`)\n .top(limit)\n .orderby(\"createdDateTime desc\");\n\n if (cursor) {\n // Get messages older than cursor\n request = request.filter(`createdDateTime lt ${cursor}`);\n }\n\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n\n // API returns newest first, reverse to get chronological order\n graphMessages.reverse();\n\n // We have more if we got a full page\n hasMoreMessages = graphMessages.length >= limit;\n }\n\n // For group chats (non-channel), filter to only messages from the \"thread\" onwards.\n // Teams group chats don't have real threading - the messageid in the conversation ID\n // is just UI context. We filter by message ID (which is a timestamp) to simulate threading.\n if (threadMessageId && !channelContext) {\n graphMessages = graphMessages.filter((msg) => {\n // Include messages with ID >= thread message ID (IDs are timestamps)\n return msg.id && msg.id >= threadMessageId;\n });\n this.logger.debug(\"Filtered group chat messages to thread\", {\n threadMessageId,\n filteredCount: graphMessages.length,\n });\n }\n\n this.logger.debug(\"Teams Graph API: fetched messages\", {\n count: graphMessages.length,\n direction,\n hasMoreMessages,\n });\n\n const messages = graphMessages.map((msg: GraphChatMessage) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n return new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n // Determine nextCursor based on direction\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n // Forward: use the newest message's timestamp (last in returned slice)\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n // Backward: use the oldest message's timestamp (first in returned array)\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n } catch (error) {\n this.logger.error(\"Teams Graph API: fetchMessages error\", { error });\n\n // Check if it's a permission error\n if (error instanceof Error && error.message?.includes(\"403\")) {\n throw new NotImplementedError(\n \"Teams fetchMessages requires one of these Azure AD app permissions: ChatMessage.Read.Chat, Chat.Read.All, or Chat.Read.WhereInstalled\",\n \"fetchMessages\"\n );\n }\n\n throw error;\n }\n }\n\n /**\n * Fetch messages from a Teams channel thread using the channel-specific Graph API endpoint.\n * This provides proper thread-level filtering by fetching only replies to a specific message.\n *\n * Endpoint: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies\n */\n private async fetchChannelThreadMessages(\n context: TeamsChannelContext,\n threadMessageId: string,\n threadId: string,\n options: FetchOptions\n ): Promise<FetchResult<unknown>> {\n const limit = options.limit || 50;\n const cursor = options.cursor;\n const direction = options.direction ?? \"backward\";\n\n this.logger.debug(\"Teams Graph API: fetching channel thread messages\", {\n teamId: context.teamId,\n channelId: context.channelId,\n threadMessageId,\n limit,\n cursor,\n direction,\n });\n\n // Build the endpoint URLs:\n // Parent message: /teams/{team-id}/channels/{channel-id}/messages/{message-id}\n // Replies: /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies\n const parentUrl = `/teams/${encodeURIComponent(context.teamId)}/channels/${encodeURIComponent(context.channelId)}/messages/${encodeURIComponent(threadMessageId)}`;\n const repliesUrl = `${parentUrl}/replies`;\n\n const graphClient = this.graphClient;\n if (!graphClient) {\n throw new AuthenticationError(\"teams\", \"Graph client not initialized\");\n }\n\n // Fetch the parent message (the original message that started the thread)\n let parentMessage: GraphChatMessage | null = null;\n try {\n parentMessage = (await graphClient\n .api(parentUrl)\n .get()) as GraphChatMessage;\n } catch (err) {\n this.logger.warn(\"Failed to fetch parent message\", {\n threadMessageId,\n err,\n });\n }\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (direction === \"forward\") {\n // Forward direction: fetch all replies and paginate in chronological order (oldest first)\n // Graph API returns messages in descending order (newest first), so we must reverse\n const allReplies: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n\n do {\n const request = nextLink\n ? graphClient.api(nextLink)\n : graphClient.api(repliesUrl).top(50);\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allReplies.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse replies to get chronological order (oldest first)\n allReplies.reverse();\n\n // Prepend parent message (it's the oldest - started the thread)\n const allMessages = parentMessage\n ? [parentMessage, ...allReplies]\n : allReplies;\n\n // Find starting position based on cursor\n let startIndex = 0;\n if (cursor) {\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n // Backward direction: return most recent messages in chronological order\n // Graph API returns messages in descending order (newest first)\n const allReplies: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n\n do {\n const request = nextLink\n ? graphClient.api(nextLink)\n : graphClient.api(repliesUrl).top(50);\n\n const response = await request.get();\n const pageMessages = (response.value || []) as GraphChatMessage[];\n allReplies.push(...pageMessages);\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n // Reverse replies to get chronological order (oldest first)\n allReplies.reverse();\n\n // Prepend parent message (it's the oldest - started the thread)\n const allMessages = parentMessage\n ? [parentMessage, ...allReplies]\n : allReplies;\n\n if (cursor) {\n // Find position of cursor (cursor is timestamp of the oldest message in previous batch)\n // We want messages OLDER than cursor (earlier in chronological order)\n const cursorIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime >= cursor\n );\n if (cursorIndex > 0) {\n // Take messages before the cursor position\n const sliceStart = Math.max(0, cursorIndex - limit);\n graphMessages = allMessages.slice(sliceStart, cursorIndex);\n hasMoreMessages = sliceStart > 0;\n } else {\n // Cursor not found or at start - take the most recent (end of array)\n graphMessages = allMessages.slice(-limit);\n hasMoreMessages = allMessages.length > limit;\n }\n } else {\n // No cursor - get the most recent messages (end of chronological array)\n graphMessages = allMessages.slice(-limit);\n hasMoreMessages = allMessages.length > limit;\n }\n }\n\n this.logger.debug(\"Teams Graph API: fetched channel thread messages\", {\n count: graphMessages.length,\n direction,\n hasMoreMessages,\n });\n\n const messages = graphMessages.map((msg: GraphChatMessage) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n return new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId: msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n // Determine nextCursor\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n }\n\n /**\n * Extract plain text from a Graph API message.\n */\n private extractTextFromGraphMessage(msg: GraphChatMessage): string {\n // body.content contains the message text (HTML or text depending on contentType)\n if (msg.body?.contentType === \"text\") {\n return msg.body.content || \"\";\n }\n\n // For HTML content, strip tags (basic implementation)\n let text = \"\";\n if (msg.body?.content) {\n text = msg.body.content.replace(/<[^>]*>/g, \"\").trim();\n }\n\n // If text is empty but message has adaptive card attachments, try to extract card title\n if (!text && msg.attachments?.length) {\n for (const att of msg.attachments) {\n if (att.contentType === \"application/vnd.microsoft.card.adaptive\") {\n try {\n const card = JSON.parse(att.content || \"{}\");\n // Look for title in common locations\n const title = this.extractCardTitle(card);\n if (title) {\n return title;\n }\n return \"[Card]\";\n } catch {\n return \"[Card]\";\n }\n }\n }\n }\n\n return text;\n }\n\n /**\n * Extract a title/summary from an Adaptive Card structure.\n */\n private extractCardTitle(card: unknown): string | null {\n if (!card || typeof card !== \"object\") {\n return null;\n }\n\n const cardObj = card as Record<string, unknown>;\n\n // Check for body array and find first TextBlock with large/bolder style (likely title)\n if (Array.isArray(cardObj.body)) {\n for (const element of cardObj.body) {\n if (\n element &&\n typeof element === \"object\" &&\n (element as Record<string, unknown>).type === \"TextBlock\"\n ) {\n const textBlock = element as Record<string, unknown>;\n // Title blocks often have weight: \"bolder\" or size: \"large\"\n if (\n textBlock.weight === \"bolder\" ||\n textBlock.size === \"large\" ||\n textBlock.size === \"extraLarge\"\n ) {\n const text = textBlock.text;\n if (typeof text === \"string\") {\n return text;\n }\n }\n }\n }\n // Fallback: just get first TextBlock's text\n for (const element of cardObj.body) {\n if (\n element &&\n typeof element === \"object\" &&\n (element as Record<string, unknown>).type === \"TextBlock\"\n ) {\n const text = (element as Record<string, unknown>).text;\n if (typeof text === \"string\") {\n return text;\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Extract attachments from a Graph API message.\n */\n private extractAttachmentsFromGraphMessage(\n msg: GraphChatMessage\n ): Attachment[] {\n if (!msg.attachments?.length) {\n return [];\n }\n\n return msg.attachments.map((att) => ({\n type: att.contentType?.includes(\"image\") ? \"image\" : \"file\",\n name: att.name || undefined,\n url: att.contentUrl || undefined,\n mimeType: att.contentType || undefined,\n }));\n }\n\n async fetchThread(threadId: string): Promise<ThreadInfo> {\n const { conversationId } = this.decodeThreadId(threadId);\n\n return {\n id: threadId,\n channelId: conversationId,\n metadata: {},\n };\n }\n\n /**\n * Derive channel ID from a Teams thread ID.\n * Teams conversation IDs may include \";messageid=XXX\" for threading.\n * Strip the messageid part to get the base channel/conversation.\n */\n channelIdFromThreadId(threadId: string): string {\n const { conversationId, serviceUrl } = this.decodeThreadId(threadId);\n // Strip ;messageid=XXX from conversation ID\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n return this.encodeThreadId({\n conversationId: baseConversationId,\n serviceUrl,\n });\n }\n\n /**\n * Fetch channel-level messages (all messages in the conversation, not filtered by thread).\n * Uses the Graph API for chat messages.\n */\n async fetchChannelMessages(\n channelId: string,\n options: FetchOptions = {}\n ): Promise<FetchResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams fetchChannelMessages requires appTenantId for Microsoft Graph API access.\",\n \"fetchChannelMessages\"\n );\n }\n\n const { conversationId } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n const limit = options.limit || 50;\n const direction = options.direction ?? \"backward\";\n\n try {\n // Check if we have channel context (team channel vs group chat)\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore invalid cache\n }\n }\n }\n\n this.logger.debug(\"Teams Graph API: fetchChannelMessages\", {\n conversationId: baseConversationId,\n hasChannelContext: !!channelContext,\n limit,\n direction,\n });\n\n let graphMessages: GraphChatMessage[];\n let hasMoreMessages = false;\n\n if (channelContext) {\n // Team channel: use /teams/{teamId}/channels/{channelId}/messages\n const apiUrl = `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}/messages`;\n\n if (direction === \"forward\") {\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient.api(apiUrl).top(50);\n const response = await request.get();\n allMessages.push(...((response.value || []) as GraphChatMessage[]));\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n allMessages.reverse();\n let startIndex = 0;\n if (options.cursor) {\n const cursor = options.cursor;\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n const request = this.graphClient.api(apiUrl).top(limit);\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n graphMessages.reverse();\n hasMoreMessages = graphMessages.length >= limit;\n }\n } else {\n // Group chat / 1:1: use /chats/{chatId}/messages\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n\n if (direction === \"forward\") {\n const allMessages: GraphChatMessage[] = [];\n let nextLink: string | undefined;\n do {\n const request = nextLink\n ? this.graphClient.api(nextLink)\n : this.graphClient\n .api(apiUrl)\n .top(50)\n .orderby(\"createdDateTime desc\");\n const response = await request.get();\n allMessages.push(...((response.value || []) as GraphChatMessage[]));\n nextLink = response[\"@odata.nextLink\"];\n } while (nextLink);\n\n allMessages.reverse();\n let startIndex = 0;\n if (options.cursor) {\n const cursor = options.cursor;\n startIndex = allMessages.findIndex(\n (msg) => msg.createdDateTime && msg.createdDateTime > cursor\n );\n if (startIndex === -1) {\n startIndex = allMessages.length;\n }\n }\n hasMoreMessages = startIndex + limit < allMessages.length;\n graphMessages = allMessages.slice(startIndex, startIndex + limit);\n } else {\n let request = this.graphClient\n .api(apiUrl)\n .top(limit)\n .orderby(\"createdDateTime desc\");\n if (options.cursor) {\n request = request.filter(`createdDateTime lt ${options.cursor}`);\n }\n const response = await request.get();\n graphMessages = (response.value || []) as GraphChatMessage[];\n graphMessages.reverse();\n hasMoreMessages = graphMessages.length >= limit;\n }\n }\n\n const messages = graphMessages.map((msg) => {\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n return new Message({\n id: msg.id,\n threadId: channelId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n });\n });\n\n let nextCursor: string | undefined;\n if (hasMoreMessages && graphMessages.length > 0) {\n if (direction === \"forward\") {\n const lastMsg = graphMessages.at(-1);\n if (lastMsg?.createdDateTime) {\n nextCursor = lastMsg.createdDateTime;\n }\n } else {\n const oldestMsg = graphMessages[0];\n if (oldestMsg?.createdDateTime) {\n nextCursor = oldestMsg.createdDateTime;\n }\n }\n }\n\n return { messages, nextCursor };\n } catch (error) {\n this.logger.error(\"Teams Graph API: fetchChannelMessages error\", {\n error,\n });\n throw error;\n }\n }\n\n /**\n * List threads in a Teams channel.\n * For team channels, fetches messages and filters for those with replies.\n * For group chats, threads are based on message IDs in conversation references.\n */\n async listThreads(\n channelId: string,\n options: ListThreadsOptions = {}\n ): Promise<ListThreadsResult<unknown>> {\n if (!this.graphClient) {\n throw new NotImplementedError(\n \"Teams listThreads requires appTenantId for Microsoft Graph API access.\",\n \"listThreads\"\n );\n }\n\n const { conversationId, serviceUrl } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n const limit = options.limit || 50;\n\n try {\n // Check for channel context\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore\n }\n }\n }\n\n this.logger.debug(\"Teams Graph API: listThreads\", {\n conversationId: baseConversationId,\n hasChannelContext: !!channelContext,\n limit,\n });\n\n const threads: ThreadSummary[] = [];\n\n if (channelContext) {\n // Team channel: fetch messages and find those with replies\n const apiUrl = `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}/messages`;\n const response = await this.graphClient.api(apiUrl).top(limit).get();\n const messages = (response.value || []) as (GraphChatMessage & {\n replies?: GraphChatMessage[];\n })[];\n\n for (const msg of messages) {\n if (!msg.id) {\n continue;\n }\n const threadId = this.encodeThreadId({\n conversationId: `${baseConversationId};messageid=${msg.id}`,\n serviceUrl,\n });\n\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n threads.push({\n id: threadId,\n rootMessage: new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n }),\n lastReplyAt: msg.lastModifiedDateTime\n ? new Date(msg.lastModifiedDateTime)\n : undefined,\n });\n }\n } else {\n // Group chat: list recent messages as \"threads\"\n const apiUrl = `/chats/${encodeURIComponent(baseConversationId)}/messages`;\n const response = await this.graphClient\n .api(apiUrl)\n .top(limit)\n .orderby(\"createdDateTime desc\")\n .get();\n\n const messages = (response.value || []) as GraphChatMessage[];\n\n for (const msg of messages) {\n if (!msg.id) {\n continue;\n }\n const threadId = this.encodeThreadId({\n conversationId: `${baseConversationId};messageid=${msg.id}`,\n serviceUrl,\n });\n\n const isFromBot =\n msg.from?.application?.id === this.config.appId ||\n msg.from?.user?.id === this.config.appId;\n\n threads.push({\n id: threadId,\n rootMessage: new Message({\n id: msg.id,\n threadId,\n text: this.extractTextFromGraphMessage(msg),\n formatted: this.formatConverter.toAst(\n this.extractTextFromGraphMessage(msg)\n ),\n raw: msg,\n author: {\n userId:\n msg.from?.user?.id || msg.from?.application?.id || \"unknown\",\n userName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n fullName:\n msg.from?.user?.displayName ||\n msg.from?.application?.displayName ||\n \"unknown\",\n isBot: !!msg.from?.application,\n isMe: isFromBot,\n },\n metadata: {\n dateSent: msg.createdDateTime\n ? new Date(msg.createdDateTime)\n : new Date(),\n edited: !!msg.lastModifiedDateTime,\n },\n attachments: this.extractAttachmentsFromGraphMessage(msg),\n }),\n });\n }\n }\n\n this.logger.debug(\"Teams Graph API: listThreads result\", {\n threadCount: threads.length,\n });\n\n return { threads };\n } catch (error) {\n this.logger.error(\"Teams Graph API: listThreads error\", { error });\n throw error;\n }\n }\n\n /**\n * Fetch Teams channel/conversation info.\n */\n async fetchChannelInfo(channelId: string): Promise<ChannelInfo> {\n const { conversationId } = this.decodeThreadId(channelId);\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n // Check for channel context\n let channelContext: TeamsChannelContext | null = null;\n if (this.chat) {\n const cachedContext = await this.chat\n .getState()\n .get<string>(`teams:channelContext:${baseConversationId}`);\n if (cachedContext) {\n try {\n channelContext = JSON.parse(cachedContext) as TeamsChannelContext;\n } catch {\n // Ignore\n }\n }\n }\n\n if (channelContext && this.graphClient) {\n try {\n this.logger.debug(\"Teams Graph API: GET channel info\", {\n teamId: channelContext.teamId,\n channelId: channelContext.channelId,\n });\n\n const response = await this.graphClient\n .api(\n `/teams/${encodeURIComponent(channelContext.teamId)}/channels/${encodeURIComponent(channelContext.channelId)}`\n )\n .get();\n\n return {\n id: channelId,\n name: response.displayName,\n isDM: false,\n memberCount: response.memberCount,\n metadata: {\n membershipType: response.membershipType,\n description: response.description,\n raw: response,\n },\n };\n } catch (error) {\n this.logger.warn(\"Teams Graph API: channel info failed\", { error });\n }\n }\n\n // Fallback for group chats or when Graph API is not available\n return {\n id: channelId,\n isDM: this.isDM(channelId),\n metadata: {\n conversationId: baseConversationId,\n },\n };\n }\n\n /**\n * Post a message to the channel top-level (not in a thread).\n * Uses a conversation reference without ;messageid= to post at the top level.\n */\n async postChannelMessage(\n channelId: string,\n message: AdapterPostableMessage\n ): Promise<RawMessage<unknown>> {\n const { conversationId, serviceUrl } = this.decodeThreadId(channelId);\n // Ensure we use the base conversation ID (no messageid)\n const baseConversationId = conversationId.replace(\n MESSAGEID_STRIP_PATTERN,\n \"\"\n );\n\n const files = extractFiles(message);\n const fileAttachments =\n files.length > 0 ? await this.filesToAttachments(files) : [];\n\n const card = extractCard(message);\n let activity: Partial<Activity>;\n\n if (card) {\n const adaptiveCard = cardToAdaptiveCard(card);\n activity = {\n type: ActivityTypes.Message,\n attachments: [\n {\n contentType: \"application/vnd.microsoft.card.adaptive\",\n content: adaptiveCard,\n },\n ...fileAttachments,\n ],\n };\n } else {\n const text = convertEmojiPlaceholders(\n this.formatConverter.renderPostable(message),\n \"teams\"\n );\n activity = {\n type: ActivityTypes.Message,\n text,\n textFormat: \"markdown\",\n attachments: fileAttachments.length > 0 ? fileAttachments : undefined,\n };\n }\n\n const conversationReference = {\n channelId: \"msteams\",\n serviceUrl,\n conversation: { id: baseConversationId },\n };\n\n let messageId = \"\";\n\n try {\n await this.botAdapter.continueConversationAsync(\n this.config.appId,\n conversationReference as Partial<ConversationReference>,\n async (context) => {\n const response = await context.sendActivity(activity);\n messageId = response?.id || \"\";\n }\n );\n } catch (error) {\n this.logger.error(\"Teams API: postChannelMessage failed\", {\n conversationId: baseConversationId,\n error,\n });\n this.handleTeamsError(error, \"postChannelMessage\");\n }\n\n this.logger.debug(\"Teams API: postChannelMessage response\", { messageId });\n\n return {\n id: messageId,\n threadId: channelId,\n raw: activity,\n };\n }\n\n encodeThreadId(platformData: TeamsThreadId): string {\n // Base64 encode both since conversationId and serviceUrl can contain special characters\n const encodedConversationId = Buffer.from(\n platformData.conversationId\n ).toString(\"base64url\");\n const encodedServiceUrl = Buffer.from(platformData.serviceUrl).toString(\n \"base64url\"\n );\n return `teams:${encodedConversationId}:${encodedServiceUrl}`;\n }\n\n /**\n * Check if a thread is a direct message conversation.\n * Teams DMs have conversation IDs that don't start with \"19:\" (which is for groups/channels).\n */\n isDM(threadId: string): boolean {\n const { conversationId } = this.decodeThreadId(threadId);\n // Group chats and channels start with \"19:\", DMs don't\n return !conversationId.startsWith(\"19:\");\n }\n\n decodeThreadId(threadId: string): TeamsThreadId {\n const parts = threadId.split(\":\");\n if (parts.length !== 3 || parts[0] !== \"teams\") {\n throw new ValidationError(\n \"teams\",\n `Invalid Teams thread ID: ${threadId}`\n );\n }\n const conversationId = Buffer.from(\n parts[1] as string,\n \"base64url\"\n ).toString(\"utf-8\");\n const serviceUrl = Buffer.from(parts[2] as string, \"base64url\").toString(\n \"utf-8\"\n );\n return { conversationId, serviceUrl };\n }\n\n parseMessage(raw: unknown): Message<unknown> {\n const activity = raw as Activity;\n const threadId = this.encodeThreadId({\n conversationId: activity.conversation?.id || \"\",\n serviceUrl: activity.serviceUrl || \"\",\n });\n return this.parseTeamsMessage(activity, threadId);\n }\n\n /**\n * Check if a Teams activity is from this bot.\n *\n * Teams bot IDs can appear in different formats:\n * - Just the app ID: \"abc123-def456-...\"\n * - With prefix: \"28:abc123-def456-...\"\n *\n * We check both exact match and suffix match (after colon delimiter)\n * to handle all formats safely.\n */\n private isMessageFromSelf(activity: Activity): boolean {\n const fromId = activity.from?.id;\n if (!(fromId && this.config.appId)) {\n return false;\n }\n\n // Exact match (bot ID is just the app ID)\n if (fromId === this.config.appId) {\n return true;\n }\n\n // Teams format: \"28:{appId}\" or similar prefix patterns\n // Check if it ends with our appId after a colon delimiter\n if (fromId.endsWith(`:${this.config.appId}`)) {\n return true;\n }\n\n return false;\n }\n\n renderFormatted(content: FormattedContent): string {\n return this.formatConverter.fromAst(content);\n }\n\n /**\n * Convert Teams/BotBuilder errors to standardized AdapterError types.\n */\n private handleTeamsError(error: unknown, operation: string): never {\n // Handle BotBuilder errors with status codes\n if (error && typeof error === \"object\") {\n const err = error as Record<string, unknown>;\n\n // Check for HTTP status code\n const statusCode =\n (err.statusCode as number) ||\n (err.status as number) ||\n (err.code as number);\n\n if (statusCode === 401 || statusCode === 403) {\n throw new AuthenticationError(\n \"teams\",\n `Authentication failed for ${operation}: ${err.message || \"unauthorized\"}`\n );\n }\n\n if (statusCode === 404) {\n throw new NetworkError(\n \"teams\",\n `Resource not found during ${operation}: conversation or message may no longer exist`,\n error instanceof Error ? error : undefined\n );\n }\n\n if (statusCode === 429) {\n const retryAfter =\n typeof err.retryAfter === \"number\" ? err.retryAfter : undefined;\n throw new AdapterRateLimitError(\"teams\", retryAfter);\n }\n\n // Permission errors\n if (\n statusCode === 403 ||\n (err.message &&\n typeof err.message === \"string\" &&\n err.message.toLowerCase().includes(\"permission\"))\n ) {\n throw new PermissionError(\"teams\", operation);\n }\n\n // Generic error with message\n if (err.message && typeof err.message === \"string\") {\n throw new NetworkError(\n \"teams\",\n `Teams API error during ${operation}: ${err.message}`,\n error instanceof Error ? error : undefined\n );\n }\n }\n\n // Fallback for unknown error types\n throw new NetworkError(\n \"teams\",\n `Teams API error during ${operation}: ${String(error)}`,\n error instanceof Error ? error : undefined\n );\n }\n}\n\nexport function createTeamsAdapter(\n config?: Partial<TeamsAdapterConfig>\n): TeamsAdapter {\n const appId = config?.appId ?? process.env.TEAMS_APP_ID;\n if (!appId) {\n throw new ValidationError(\n \"teams\",\n \"appId is required. Set TEAMS_APP_ID or provide it in config.\"\n );\n }\n const appPassword = config?.appPassword ?? process.env.TEAMS_APP_PASSWORD;\n if (!appPassword) {\n throw new ValidationError(\n \"teams\",\n \"appPassword is required. Set TEAMS_APP_PASSWORD or provide it in config.\"\n );\n }\n const resolved: TeamsAdapterConfig = {\n appId,\n appPassword,\n appTenantId: config?.appTenantId ?? process.env.TEAMS_APP_TENANT_ID,\n appType: config?.appType,\n logger: config?.logger ?? new ConsoleLogger(\"info\").child(\"teams\"),\n userName: config?.userName,\n };\n return new TeamsAdapter(resolved);\n}\n\n// Re-export card converter for advanced use\nexport { cardToAdaptiveCard, cardToFallbackText } from \"./cards\";\nexport { TeamsFormatConverter } from \"./markdown\";\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @enum\n * Enum for RequestMethods\n * @property {string} GET - The get request type\n * @property {string} PATCH - The patch request type\n * @property {string} POST - The post request type\n * @property {string} PUT - The put request type\n * @property {string} DELETE - The delete request type\n */\nexport enum RequestMethod {\n\tGET = \"GET\",\n\tPATCH = \"PATCH\",\n\tPOST = \"POST\",\n\tPUT = \"PUT\",\n\tDELETE = \"DELETE\",\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module BatchRequestContent\n */\nimport { RequestMethod } from \"../RequestMethod\";\n\n/**\n * @interface\n * Signature to represent the buffer request body parsing method\n * @property {Function} buffer - Returns a promise that resolves to a buffer of the request body\n */\ninterface NodeBody {\n\tbuffer(): Promise<Buffer>;\n}\n\n/**\n * @interface\n * Signature to represent the Request for both Node and browser environments\n * @extends Request\n * @extends NodeBody\n */\ninterface IsomorphicRequest extends Request, NodeBody {}\n\n/**\n * @interface\n * Signature representing BatchRequestStep data\n * @property {string} id - Unique identity for the request, Should not be an empty string\n * @property {string[]} [dependsOn] - Array of dependencies\n * @property {Request} request - The Request object\n */\nexport interface BatchRequestStep {\n\tid: string;\n\tdependsOn?: string[];\n\trequest: Request;\n}\n\n/**\n * @interface\n * Signature representing single request in a Batching\n * @extends RequestInit\n * @see {@link https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L1337} and {@link https://fetch.spec.whatwg.org/#requestinit}\n *\n * @property {string} url - The url value of the request\n */\n\nexport interface RequestData extends RequestInit {\n\turl: string;\n}\n\n/**\n * @interface\n * Signature representing batch request data\n * @property {string} id - Unique identity for the request, Should not be an empty string\n * @property {string[]} [dependsOn] - Array of dependencies\n */\nexport interface BatchRequestData extends RequestData {\n\tid: string;\n\tdependsOn?: string[];\n}\n\n/**\n * @interface\n * Signature representing batch request body\n * @property {BatchRequestData[]} requests - Array of request data, a json representation of requests for batch\n */\n\nexport interface BatchRequestBody {\n\trequests: BatchRequestData[];\n}\n\n/**\n * @class\n * Class for handling BatchRequestContent\n */\nexport class BatchRequestContent {\n\t/**\n\t * @private\n\t * @static\n\t * Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}\n\t */\n\tprivate static requestLimit = 20;\n\n\t/**\n\t * @public\n\t * To keep track of requests, key will be id of the request and value will be the request json\n\t */\n\tpublic requests: Map<string, BatchRequestStep>;\n\n\t/**\n\t * @private\n\t * @static\n\t * Validates the dependency chain of the requests\n\t *\n\t * Note:\n\t * 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:\n\t * 1. Parallel - no individual request states a dependency in the dependsOn property.\n\t * 2. Serial - all individual requests depend on the previous individual request.\n\t * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.\n\t * As JSON batching matures, these limitations will be removed.\n\t * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}\n\t *\n\t * @param {Map<string, BatchRequestStep>} requests - The map of requests.\n\t * @returns The boolean indicating the validation status\n\t */\n\n\tprivate static validateDependencies(requests: Map<string, BatchRequestStep>): boolean {\n\t\tconst isParallel = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq = cur.value[1];\n\t\t\t\tif (curReq.dependsOn !== undefined && curReq.dependsOn.length > 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tconst isSerial = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\tconst firstRequest: BatchRequestStep = cur.value[1];\n\t\t\tif (firstRequest.dependsOn !== undefined && firstRequest.dependsOn.length > 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tlet prev = cur;\n\t\t\tcur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq: BatchRequestStep = cur.value[1];\n\t\t\t\tif (curReq.dependsOn === undefined || curReq.dependsOn.length !== 1 || curReq.dependsOn[0] !== prev.value[1].id) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tprev = cur;\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tconst isSame = (reqs: Map<string, BatchRequestStep>): boolean => {\n\t\t\tconst iterator = reqs.entries();\n\t\t\tlet cur = iterator.next();\n\t\t\tconst firstRequest: BatchRequestStep = cur.value[1];\n\t\t\tlet dependencyId: string;\n\t\t\tif (firstRequest.dependsOn === undefined || firstRequest.dependsOn.length === 0) {\n\t\t\t\tdependencyId = firstRequest.id;\n\t\t\t} else {\n\t\t\t\tif (firstRequest.dependsOn.length === 1) {\n\t\t\t\t\tconst fDependencyId = firstRequest.dependsOn[0];\n\t\t\t\t\tif (fDependencyId !== firstRequest.id && reqs.has(fDependencyId)) {\n\t\t\t\t\t\tdependencyId = fDependencyId;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcur = iterator.next();\n\t\t\twhile (!cur.done) {\n\t\t\t\tconst curReq = cur.value[1];\n\t\t\t\tif ((curReq.dependsOn === undefined || curReq.dependsOn.length === 0) && dependencyId !== curReq.id) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (curReq.dependsOn !== undefined && curReq.dependsOn.length !== 0) {\n\t\t\t\t\tif (curReq.dependsOn.length === 1 && (curReq.id === dependencyId || curReq.dependsOn[0] !== dependencyId)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (curReq.dependsOn.length > 1) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tif (requests.size === 0) {\n\t\t\tconst error = new Error(\"Empty requests map, Please provide at least one request.\");\n\t\t\terror.name = \"Empty Requests Error\";\n\t\t\tthrow error;\n\t\t}\n\t\treturn isParallel(requests) || isSerial(requests) || isSame(requests);\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Converts Request Object instance to a JSON\n\t * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance\n\t * @returns A promise that resolves to JSON representation of a request\n\t */\n\tprivate static async getRequestData(request: IsomorphicRequest): Promise<RequestData> {\n\t\tconst requestData: RequestData = {\n\t\t\turl: \"\",\n\t\t};\n\t\tconst hasHttpRegex = new RegExp(\"^https?://\");\n\t\t// Stripping off hostname, port and url scheme\n\t\trequestData.url = hasHttpRegex.test(request.url) ? \"/\" + request.url.split(/.*?\\/\\/.*?\\//)[1] : request.url;\n\t\trequestData.method = request.method;\n\t\tconst headers = {};\n\t\trequest.headers.forEach((value, key) => {\n\t\t\theaders[key] = value;\n\t\t});\n\t\tif (Object.keys(headers).length) {\n\t\t\trequestData.headers = headers;\n\t\t}\n\t\tif (request.method === RequestMethod.PATCH || request.method === RequestMethod.POST || request.method === RequestMethod.PUT) {\n\t\t\trequestData.body = await BatchRequestContent.getRequestBody(request);\n\t\t}\n\t\t/**\n\t\t * TODO: Check any other property needs to be used from the Request object and add them\n\t\t */\n\t\treturn requestData;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Gets the body of a Request object instance\n\t * @param {IsomorphicRequest} request - The IsomorphicRequest object instance\n\t * @returns The Promise that resolves to a body value of a Request\n\t */\n\tprivate static async getRequestBody(request: IsomorphicRequest): Promise<any> {\n\t\tlet bodyParsed = false;\n\t\tlet body;\n\t\ttry {\n\t\t\tconst cloneReq = request.clone();\n\t\t\tbody = await cloneReq.json();\n\t\t\tbodyParsed = true;\n\t\t} catch (e) {\n\t\t\t//TODO- Handle empty catches\n\t\t}\n\t\tif (!bodyParsed) {\n\t\t\ttry {\n\t\t\t\tif (typeof Blob !== \"undefined\") {\n\t\t\t\t\tconst blob = await request.blob();\n\t\t\t\t\tconst reader = new FileReader();\n\t\t\t\t\tbody = await new Promise((resolve) => {\n\t\t\t\t\t\treader.addEventListener(\n\t\t\t\t\t\t\t\"load\",\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tconst dataURL = reader.result as string;\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * Some valid dataURL schemes:\n\t\t\t\t\t\t\t\t * 1. data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh\n\t\t\t\t\t\t\t\t * 2. data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678\n\t\t\t\t\t\t\t\t * 3. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * 4. data:image/png,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * 5. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\n\t\t\t\t\t\t\t\t * @see Syntax {@link https://en.wikipedia.org/wiki/Data_URI_scheme} for more\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst regex = new RegExp(\"^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$\");\n\t\t\t\t\t\t\t\tconst segments = regex.exec(dataURL);\n\t\t\t\t\t\t\t\tresolve(segments[4]);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treader.readAsDataURL(blob);\n\t\t\t\t\t});\n\t\t\t\t} else if (typeof Buffer !== \"undefined\") {\n\t\t\t\t\tconst buffer = await request.buffer();\n\t\t\t\t\tbody = buffer.toString(\"base64\");\n\t\t\t\t}\n\t\t\t\tbodyParsed = true;\n\t\t\t} catch (e) {\n\t\t\t\t// TODO-Handle empty catches\n\t\t\t}\n\t\t}\n\t\treturn body;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a BatchRequestContent instance\n\t * @param {BatchRequestStep[]} [requests] - Array of requests value\n\t * @returns An instance of a BatchRequestContent\n\t */\n\tpublic constructor(requests?: BatchRequestStep[]) {\n\t\tthis.requests = new Map();\n\t\tif (typeof requests !== \"undefined\") {\n\t\t\tconst limit = BatchRequestContent.requestLimit;\n\t\t\tif (requests.length > limit) {\n\t\t\t\tconst error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);\n\t\t\t\terror.name = \"Limit Exceeded Error\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tfor (const req of requests) {\n\t\t\t\tthis.addRequest(req);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Adds a request to the batch request content\n\t * @param {BatchRequestStep} request - The request value\n\t * @returns The id of the added request\n\t */\n\tpublic addRequest(request: BatchRequestStep): string {\n\t\tconst limit = BatchRequestContent.requestLimit;\n\t\tif (request.id === \"\") {\n\t\t\tconst error = new Error(`Id for a request is empty, Please provide an unique id`);\n\t\t\terror.name = \"Empty Id For Request\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (this.requests.size === limit) {\n\t\t\tconst error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);\n\t\t\terror.name = \"Limit Exceeded Error\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (this.requests.has(request.id)) {\n\t\t\tconst error = new Error(`Adding request with duplicate id ${request.id}, Make the id of the requests unique`);\n\t\t\terror.name = \"Duplicate RequestId Error\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.requests.set(request.id, request);\n\t\treturn request.id;\n\t}\n\n\t/**\n\t * @public\n\t * Removes request from the batch payload and its dependencies from all dependents\n\t * @param {string} requestId - The id of a request that needs to be removed\n\t * @returns The boolean indicating removed status\n\t */\n\tpublic removeRequest(requestId: string): boolean {\n\t\tconst deleteStatus = this.requests.delete(requestId);\n\t\tconst iterator = this.requests.entries();\n\t\tlet cur = iterator.next();\n\t\t/**\n\t\t * Removing dependencies where this request is present as a dependency\n\t\t */\n\t\twhile (!cur.done) {\n\t\t\tconst dependencies = cur.value[1].dependsOn;\n\t\t\tif (typeof dependencies !== \"undefined\") {\n\t\t\t\tconst index = dependencies.indexOf(requestId);\n\t\t\t\tif (index !== -1) {\n\t\t\t\t\tdependencies.splice(index, 1);\n\t\t\t\t}\n\t\t\t\tif (dependencies.length === 0) {\n\t\t\t\t\tdelete cur.value[1].dependsOn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcur = iterator.next();\n\t\t}\n\t\treturn deleteStatus;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Serialize content from BatchRequestContent instance\n\t * @returns The body content to make batch request\n\t */\n\tpublic async getContent(): Promise<BatchRequestBody> {\n\t\tconst requests: BatchRequestData[] = [];\n\t\tconst requestBody: BatchRequestBody = {\n\t\t\trequests,\n\t\t};\n\t\tconst iterator = this.requests.entries();\n\t\tlet cur = iterator.next();\n\t\tif (cur.done) {\n\t\t\tconst error = new Error(\"No requests added yet, Please add at least one request.\");\n\t\t\terror.name = \"Empty Payload\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (!BatchRequestContent.validateDependencies(this.requests)) {\n\t\t\tconst error = new Error(`Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.`);\n\t\t\terror.name = \"Invalid Dependency\";\n\t\t\tthrow error;\n\t\t}\n\t\twhile (!cur.done) {\n\t\t\tconst requestStep: BatchRequestStep = cur.value[1];\n\t\t\tconst batchRequestData: BatchRequestData = (await BatchRequestContent.getRequestData(requestStep.request as IsomorphicRequest)) as BatchRequestData;\n\t\t\t/**\n\t\t\t * @see{@https://tools.ietf.org/html/rfc7578#section-4.4}\n\t\t\t * TODO- Setting/Defaulting of content-type header to the correct value\n\t\t\t * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching#request-format}\n\t\t\t */\n\t\t\tif (batchRequestData.body !== undefined && (batchRequestData.headers === undefined || batchRequestData.headers[\"content-type\"] === undefined)) {\n\t\t\t\tconst error = new Error(`Content-type header is not mentioned for request #${requestStep.id}, For request having body, Content-type header should be mentioned`);\n\t\t\t\terror.name = \"Invalid Content-type header\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbatchRequestData.id = requestStep.id;\n\t\t\tif (requestStep.dependsOn !== undefined && requestStep.dependsOn.length > 0) {\n\t\t\t\tbatchRequestData.dependsOn = requestStep.dependsOn;\n\t\t\t}\n\t\t\trequests.push(batchRequestData);\n\t\t\tcur = iterator.next();\n\t\t}\n\t\trequestBody.requests = requests;\n\t\treturn requestBody;\n\t}\n\n\t/**\n\t * @public\n\t * Adds a dependency for a given dependent request\n\t * @param {string} dependentId - The id of the dependent request\n\t * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency\n\t * @returns Nothing\n\t */\n\tpublic addDependency(dependentId: string, dependencyId?: string): void {\n\t\tif (!this.requests.has(dependentId)) {\n\t\t\tconst error = new Error(`Dependent ${dependentId} does not exists, Please check the id`);\n\t\t\terror.name = \"Invalid Dependent\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\" && !this.requests.has(dependencyId)) {\n\t\t\tconst error = new Error(`Dependency ${dependencyId} does not exists, Please check the id`);\n\t\t\terror.name = \"Invalid Dependency\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\") {\n\t\t\tconst dependent = this.requests.get(dependentId);\n\t\t\tif (dependent.dependsOn === undefined) {\n\t\t\t\tdependent.dependsOn = [];\n\t\t\t}\n\t\t\tif (dependent.dependsOn.indexOf(dependencyId) !== -1) {\n\t\t\t\tconst error = new Error(`Dependency ${dependencyId} is already added for the request ${dependentId}`);\n\t\t\t\terror.name = \"Duplicate Dependency\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tdependent.dependsOn.push(dependencyId);\n\t\t} else {\n\t\t\tconst iterator = this.requests.entries();\n\t\t\tlet prev;\n\t\t\tlet cur = iterator.next();\n\t\t\twhile (!cur.done && cur.value[1].id !== dependentId) {\n\t\t\t\tprev = cur;\n\t\t\t\tcur = iterator.next();\n\t\t\t}\n\t\t\tif (typeof prev !== \"undefined\") {\n\t\t\t\tconst dId = prev.value[0];\n\t\t\t\tif (cur.value[1].dependsOn === undefined) {\n\t\t\t\t\tcur.value[1].dependsOn = [];\n\t\t\t\t}\n\t\t\t\tif (cur.value[1].dependsOn.indexOf(dId) !== -1) {\n\t\t\t\t\tconst error = new Error(`Dependency ${dId} is already added for the request ${dependentId}`);\n\t\t\t\t\terror.name = \"Duplicate Dependency\";\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tcur.value[1].dependsOn.push(dId);\n\t\t\t} else {\n\t\t\t\tconst error = new Error(`Can't add dependency ${dependencyId}, There is only a dependent request in the batch`);\n\t\t\t\terror.name = \"Invalid Dependency Addition\";\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Removes a dependency for a given dependent request id\n\t * @param {string} dependentId - The id of the dependent request\n\t * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request\n\t * @returns The boolean indicating removed status\n\t */\n\tpublic removeDependency(dependentId: string, dependencyId?: string): boolean {\n\t\tconst request = this.requests.get(dependentId);\n\t\tif (typeof request === \"undefined\" || request.dependsOn === undefined || request.dependsOn.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof dependencyId !== \"undefined\") {\n\t\t\tconst index = request.dependsOn.indexOf(dependencyId);\n\t\t\tif (index === -1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\trequest.dependsOn.splice(index, 1);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tdelete request.dependsOn;\n\t\t\treturn true;\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Constants\n */\n\n/**\n * @constant\n * A Default API endpoint version for a request\n */\nexport const GRAPH_API_VERSION = \"v1.0\";\n\n/**\n * @constant\n * A Default base url for a request\n */\nexport const GRAPH_BASE_URL = \"https://graph.microsoft.com/\";\n\n/**\n * To hold list of the service root endpoints for Microsoft Graph and Graph Explorer for each national cloud.\n * Set(iterable:Object) is not supported in Internet Explorer. The consumer is recommended to use a suitable polyfill.\n */\nexport const GRAPH_URLS = new Set<string>([\"graph.microsoft.com\", \"graph.microsoft.us\", \"dod-graph.microsoft.us\", \"graph.microsoft.de\", \"microsoftgraph.chinacloudapi.cn\", \"canary.graph.microsoft.com\"]);\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphClientError\n */\n\n/**\n * @class\n * Create GraphClientError object to handle client-side errors\n * encountered within the JavaScript Client SDK.\n * Whereas GraphError Class should be used to handle errors in the response from the Graph API.\n */\n\nexport class GraphClientError extends Error {\n\t/**\n\t * @public\n\t * A custom error. This property should set be when the error is not of instanceOf Error/GraphClientError.\n\t * Example =\n\t * const client = MicrosoftGraph.Client.init({\n\t * \t\tdefaultVersion: \"v1.0\",\n\t * \tauthProvider: (done) => { done({TokenError:\"AccessToken cannot be null\"}, \"<ACCESS_TOKEN>\");\n\t * });\n\t */\n\tpublic customError?: any;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To set the GraphClientError object\n\t * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request\n\t * @returns GraphClientError object set to the error passed\n\t */\n\tpublic static setGraphClientError(error: any): GraphClientError {\n\t\tlet graphClientError: GraphClientError;\n\t\tif (error instanceof Error) {\n\t\t\tgraphClientError = error;\n\t\t} else {\n\t\t\tgraphClientError = new GraphClientError();\n\t\t\tgraphClientError.customError = error;\n\t\t}\n\t\treturn graphClientError;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphClientError\n\t * @param {string} message? - Error message\n\t * @returns An instance of GraphClientError\n\t */\n\tpublic constructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, GraphClientError.prototype);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphRequestUtil\n */\nimport { GRAPH_URLS } from \"./Constants\";\nimport { GraphClientError } from \"./GraphClientError\";\n/**\n * To hold list of OData query params\n */\nexport const oDataQueryNames = [\"$select\", \"$expand\", \"$orderby\", \"$filter\", \"$top\", \"$skip\", \"$skipToken\", \"$count\"];\n\n/**\n * To construct the URL by appending the segments with \"/\"\n * @param {string[]} urlSegments - The array of strings\n * @returns The constructed URL string\n */\nexport const urlJoin = (urlSegments: string[]): string => {\n\tconst removePostSlash = (s) => s.replace(/\\/+$/, \"\");\n\tconst removePreSlash = (s) => s.replace(/^\\/+/, \"\");\n\tconst joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join(\"/\");\n\tconst parts = Array.prototype.slice.call(urlSegments);\n\treturn parts.reduce(joiner);\n};\n\n/**\n * Serializes the content\n * @param {any} content - The content value that needs to be serialized\n * @returns The serialized content\n *\n * Note:\n * This conversion is required due to the following reasons:\n * Body parameter of Request method of isomorphic-fetch only accepts Blob, ArrayBuffer, FormData, TypedArrays string.\n * 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.\n * 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`.\n * If the data received is in JSON format, `serializeContent` converts the JSON to string.\n */\n\nexport const serializeContent = (content: any): any => {\n\tconst className: string = content && content.constructor && content.constructor.name;\n\tif (className === \"Buffer\" || className === \"Blob\" || className === \"File\" || className === \"FormData\" || typeof content === \"string\") {\n\t\treturn content;\n\t}\n\tif (className === \"ArrayBuffer\") {\n\t\tcontent = Buffer.from(content);\n\t} else if (className === \"Int8Array\" || className === \"Int16Array\" || className === \"Int32Array\" || className === \"Uint8Array\" || className === \"Uint16Array\" || className === \"Uint32Array\" || className === \"Uint8ClampedArray\" || className === \"Float32Array\" || className === \"Float64Array\" || className === \"DataView\") {\n\t\tcontent = Buffer.from(content.buffer);\n\t} else {\n\t\ttry {\n\t\t\tcontent = JSON.stringify(content);\n\t\t} catch (error) {\n\t\t\tthrow new Error(\"Unable to stringify the content\");\n\t\t}\n\t}\n\treturn content;\n};\n\n/**\n * Checks if the url is one of the service root endpoints for Microsoft Graph and Graph Explorer.\n * @param {string} url - The url to be verified\n * @returns {boolean} - Returns true if the url is a Graph URL\n */\nexport const isGraphURL = (url: string): boolean => {\n\treturn isValidEndpoint(url);\n};\n\n/**\n * Checks if the url is for one of the custom hosts provided during client initialization\n * @param {string} url - The url to be verified\n * @param {Set} customHosts - The url to be verified\n * @returns {boolean} - Returns true if the url is a for a custom host\n */\nexport const isCustomHost = (url: string, customHosts: Set<string>): boolean => {\n\tcustomHosts.forEach((host) => isCustomHostValid(host));\n\treturn isValidEndpoint(url, customHosts);\n};\n\n/**\n * Checks if the url is for one of the provided hosts.\n * @param {string} url - The url to be verified\n * @param {Set<string>} allowedHosts - A set of hosts.\n * @returns {boolean} - Returns true is for one of the provided endpoints.\n */\nconst isValidEndpoint = (url: string, allowedHosts: Set<string> = GRAPH_URLS): boolean => {\n\t// Valid Graph URL pattern - https://graph.microsoft.com/{version}/{resource}?{query-parameters}\n\t// Valid Graph URL example - https://graph.microsoft.com/v1.0/\n\turl = url.toLowerCase();\n\n\tif (url.indexOf(\"https://\") !== -1) {\n\t\turl = url.replace(\"https://\", \"\");\n\n\t\t// Find where the host ends\n\t\tconst startofPortNoPos = url.indexOf(\":\");\n\t\tconst endOfHostStrPos = url.indexOf(\"/\");\n\t\tlet hostName = \"\";\n\t\tif (endOfHostStrPos !== -1) {\n\t\t\tif (startofPortNoPos !== -1 && startofPortNoPos < endOfHostStrPos) {\n\t\t\t\thostName = url.substring(0, startofPortNoPos);\n\t\t\t\treturn allowedHosts.has(hostName);\n\t\t\t}\n\t\t\t// Parse out the host\n\t\t\thostName = url.substring(0, endOfHostStrPos);\n\t\t\treturn allowedHosts.has(hostName);\n\t\t}\n\t}\n\n\treturn false;\n};\n\n/**\n * Throws error if the string is not a valid host/hostname and contains other url parts.\n * @param {string} host - The host to be verified\n */\nconst isCustomHostValid = (host: string) => {\n\tif (host.indexOf(\"/\") !== -1) {\n\t\tthrow new GraphClientError(\"Please add only hosts or hostnames to the CustomHosts config. If the url is `http://example.com:3000/`, host is `example:3000`\");\n\t}\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module MiddlewareControl\n */\n\nimport { MiddlewareOptions } from \"./options/IMiddlewareOptions\";\n\n/**\n * @class\n * Class representing MiddlewareControl\n */\nexport class MiddlewareControl {\n\t/**\n\t * @private\n\t * A member holding map of MiddlewareOptions\n\t */\n\tprivate middlewareOptions: Map<Function, MiddlewareOptions>;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of MiddlewareControl\n\t * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions\n\t * @returns The instance of MiddlewareControl\n\t */\n\tpublic constructor(middlewareOptions: MiddlewareOptions[] = []) {\n\t\tthis.middlewareOptions = new Map<Function, MiddlewareOptions>();\n\t\tfor (const option of middlewareOptions) {\n\t\t\tconst fn = option.constructor;\n\t\t\tthis.middlewareOptions.set(fn, option);\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * To get the middleware option using the class of the option\n\t * @param {Function} fn - The class of the strongly typed option class\n\t * @returns The middleware option\n\t * @example\n\t * // if you wanted to return the middleware option associated with this class (MiddlewareControl)\n\t * // call this function like this:\n\t * getMiddlewareOptions(MiddlewareControl)\n\t */\n\tpublic getMiddlewareOptions(fn: Function): MiddlewareOptions {\n\t\treturn this.middlewareOptions.get(fn);\n\t}\n\n\t/**\n\t * @public\n\t * To set the middleware options using the class of the option\n\t * @param {Function} fn - The class of the strongly typed option class\n\t * @param {MiddlewareOptions} option - The strongly typed middleware option\n\t * @returns nothing\n\t */\n\tpublic setMiddlewareOptions(fn: Function, option: MiddlewareOptions): void {\n\t\tthis.middlewareOptions.set(fn, option);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module MiddlewareUtil\n */\n\nimport { FetchOptions } from \"../IFetchOptions\";\n\n/**\n * @constant\n * To generate the UUID\n * @returns The UUID string\n */\nexport const generateUUID = (): string => {\n\tlet uuid = \"\";\n\tfor (let j = 0; j < 32; j++) {\n\t\tif (j === 8 || j === 12 || j === 16 || j === 20) {\n\t\t\tuuid += \"-\";\n\t\t}\n\t\tuuid += Math.floor(Math.random() * 16).toString(16);\n\t}\n\treturn uuid;\n};\n\n/**\n * @constant\n * To get the request header from the request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @returns A header value for the given key from the request\n */\nexport const getRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string): string | null => {\n\tlet value: string = null;\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\tvalue = (request as Request).headers.get(key);\n\t} else if (typeof options !== \"undefined\" && options.headers !== undefined) {\n\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\tvalue = (options.headers as Headers).get(key);\n\t\t} else if (options.headers instanceof Array) {\n\t\t\tconst headers = options.headers as string[][];\n\t\t\tfor (let i = 0, l = headers.length; i < l; i++) {\n\t\t\t\tif (headers[i][0] === key) {\n\t\t\t\t\tvalue = headers[i][1];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (options.headers[key] !== undefined) {\n\t\t\tvalue = options.headers[key];\n\t\t}\n\t}\n\treturn value;\n};\n\n/**\n * @constant\n * To set the header value to the given request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @param {string } value - The header value string\n * @returns Nothing\n */\nexport const setRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\t(request as Request).headers.set(key, value);\n\t} else if (typeof options !== \"undefined\") {\n\t\tif (options.headers === undefined) {\n\t\t\toptions.headers = new Headers({\n\t\t\t\t[key]: value,\n\t\t\t});\n\t\t} else {\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\t\t(options.headers as Headers).set(key, value);\n\t\t\t} else if (options.headers instanceof Array) {\n\t\t\t\tlet i = 0;\n\t\t\t\tconst l = options.headers.length;\n\t\t\t\tfor (; i < l; i++) {\n\t\t\t\t\tconst header = options.headers[i];\n\t\t\t\t\tif (header[0] === key) {\n\t\t\t\t\t\theader[1] = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i === l) {\n\t\t\t\t\t(options.headers as string[][]).push([key, value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tObject.assign(options.headers, { [key]: value });\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * @constant\n * To append the header value to the given request\n * @param {RequestInfo} request - The request object or the url string\n * @param {FetchOptions|undefined} options - The request options object\n * @param {string} key - The header key string\n * @param {string } value - The header value string\n * @returns Nothing\n */\nexport const appendRequestHeader = (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string): void => {\n\tif (typeof Request !== \"undefined\" && request instanceof Request) {\n\t\t(request as Request).headers.append(key, value);\n\t} else if (typeof options !== \"undefined\") {\n\t\tif (options.headers === undefined) {\n\t\t\toptions.headers = new Headers({\n\t\t\t\t[key]: value,\n\t\t\t});\n\t\t} else {\n\t\t\tif (typeof Headers !== \"undefined\" && options.headers instanceof Headers) {\n\t\t\t\t(options.headers as Headers).append(key, value);\n\t\t\t} else if (options.headers instanceof Array) {\n\t\t\t\t(options.headers as string[][]).push([key, value]);\n\t\t\t} else if (options.headers === undefined) {\n\t\t\t\toptions.headers = { [key]: value };\n\t\t\t} else if (options.headers[key] === undefined) {\n\t\t\t\toptions.headers[key] = value;\n\t\t\t} else {\n\t\t\t\toptions.headers[key] += `, ${value}`;\n\t\t\t}\n\t\t}\n\t}\n};\n\n/**\n * @constant\n * To clone the request with the new url\n * @param {string} url - The new url string\n * @param {Request} request - The request object\n * @returns A promise that resolves to request object\n */\nexport const cloneRequestWithNewUrl = async (newUrl: string, request: Request): Promise<Request> => {\n\tconst body = request.headers.get(\"Content-Type\") ? await request.blob() : await Promise.resolve(undefined);\n\tconst { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request;\n\treturn new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal });\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module AuthenticationHandlerOptions\n */\n\nimport { AuthenticationProvider } from \"../../IAuthenticationProvider\";\nimport { AuthenticationProviderOptions } from \"../../IAuthenticationProviderOptions\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class representing AuthenticationHandlerOptions\n */\nexport class AuthenticationHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @public\n\t * A member holding an instance of an authentication provider\n\t */\n\tpublic authenticationProvider: AuthenticationProvider;\n\n\t/**\n\t * @public\n\t * A member holding an instance of authentication provider options\n\t */\n\tpublic authenticationProviderOptions: AuthenticationProviderOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of AuthenticationHandlerOptions\n\t * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance\n\t * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance\n\t * @returns An instance of AuthenticationHandlerOptions\n\t */\n\tpublic constructor(authenticationProvider?: AuthenticationProvider, authenticationProviderOptions?: AuthenticationProviderOptions) {\n\t\tthis.authenticationProvider = authenticationProvider;\n\t\tthis.authenticationProviderOptions = authenticationProviderOptions;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module TelemetryHandlerOptions\n */\n\nimport { Context } from \"../../IContext\";\nimport { MiddlewareControl } from \"../MiddlewareControl\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @enum\n * @property {number} NONE - The hexadecimal flag value for nothing enabled\n * @property {number} REDIRECT_HANDLER_ENABLED - The hexadecimal flag value for redirect handler enabled\n * @property {number} RETRY_HANDLER_ENABLED - The hexadecimal flag value for retry handler enabled\n * @property {number} AUTHENTICATION_HANDLER_ENABLED - The hexadecimal flag value for the authentication handler enabled\n */\n\nexport enum FeatureUsageFlag {\n\t/* eslint-disable @typescript-eslint/naming-convention */\n\tNONE = 0x0,\n\tREDIRECT_HANDLER_ENABLED = 0x1,\n\tRETRY_HANDLER_ENABLED = 0x2,\n\tAUTHENTICATION_HANDLER_ENABLED = 0x4,\n\t/* eslint-enable @typescript-eslint/naming-convention */\n}\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class for TelemetryHandlerOptions\n */\n\nexport class TelemetryHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * A member to hold the OR of feature usage flags\n\t */\n\tprivate featureUsage: FeatureUsageFlag = FeatureUsageFlag.NONE;\n\n\t/**\n\t * @public\n\t * @static\n\t * To update the feature usage in the context object\n\t * @param {Context} context - The request context object containing middleware options\n\t * @param {FeatureUsageFlag} flag - The flag value\n\t * @returns nothing\n\t */\n\tpublic static updateFeatureUsageFlag(context: Context, flag: FeatureUsageFlag): void {\n\t\tlet options: TelemetryHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\n\t\t} else {\n\t\t\tcontext.middlewareControl = new MiddlewareControl();\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = new TelemetryHandlerOptions();\n\t\t\tcontext.middlewareControl.setMiddlewareOptions(TelemetryHandlerOptions, options);\n\t\t}\n\t\toptions.setFeatureUsage(flag);\n\t}\n\n\t/**\n\t * @private\n\t * To set the feature usage flag\n\t * @param {FeatureUsageFlag} flag - The flag value\n\t * @returns nothing\n\t */\n\tprivate setFeatureUsage(flag: FeatureUsageFlag): void {\n\t\tthis.featureUsage = this.featureUsage | flag;\n\t}\n\n\t/**\n\t * @public\n\t * To get the feature usage\n\t * @returns A feature usage flag as hexadecimal string\n\t */\n\tpublic getFeatureUsage(): string {\n\t\treturn this.featureUsage.toString(16);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module AuthenticationHandler\n */\n\nimport { isCustomHost, isGraphURL } from \"../GraphRequestUtil\";\nimport { AuthenticationProvider } from \"../IAuthenticationProvider\";\nimport { AuthenticationProviderOptions } from \"../IAuthenticationProviderOptions\";\nimport { Context } from \"../IContext\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { appendRequestHeader } from \"./MiddlewareUtil\";\nimport { AuthenticationHandlerOptions } from \"./options/AuthenticationHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class representing AuthenticationHandler\n */\nexport class AuthenticationHandler implements Middleware {\n\t/**\n\t * @private\n\t * A member representing the authorization header name\n\t */\n\tprivate static AUTHORIZATION_HEADER = \"Authorization\";\n\n\t/**\n\t * @private\n\t * A member to hold an AuthenticationProvider instance\n\t */\n\tprivate authenticationProvider: AuthenticationProvider;\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of AuthenticationHandler\n\t * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler\n\t */\n\tpublic constructor(authenticationProvider: AuthenticationProvider) {\n\t\tthis.authenticationProvider = authenticationProvider;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\n\t\tif (isGraphURL(url) || (context.customHosts && isCustomHost(url, context.customHosts))) {\n\t\t\tlet options: AuthenticationHandlerOptions;\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions) as AuthenticationHandlerOptions;\n\t\t\t}\n\t\t\tlet authenticationProvider: AuthenticationProvider;\n\t\t\tlet authenticationProviderOptions: AuthenticationProviderOptions;\n\t\t\tif (options) {\n\t\t\t\tauthenticationProvider = options.authenticationProvider;\n\t\t\t\tauthenticationProviderOptions = options.authenticationProviderOptions;\n\t\t\t}\n\t\t\tif (!authenticationProvider) {\n\t\t\t\tauthenticationProvider = this.authenticationProvider;\n\t\t\t}\n\t\t\tconst token: string = await authenticationProvider.getAccessToken(authenticationProviderOptions);\n\t\t\tconst bearerKey = `Bearer ${token}`;\n\t\t\tappendRequestHeader(context.request, context.options, AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey);\n\t\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED);\n\t\t} else {\n\t\t\tif (context.options.headers) {\n\t\t\t\tdelete context.options.headers[AuthenticationHandler.AUTHORIZATION_HEADER];\n\t\t\t}\n\t\t}\n\t\treturn await this.nextMiddleware.execute(context);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPMessageHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { Middleware } from \"./IMiddleware\";\n\n/**\n * @class\n * @implements Middleware\n * Class for HTTPMessageHandler\n */\nexport class HTTPMessageHandler implements Middleware {\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The request context object\n\t * @returns A promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tcontext.response = await fetch(context.request, context.options);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RetryHandlerOptions\n */\n\nimport { FetchOptions } from \"../../IFetchOptions\";\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @type\n * A type declaration for shouldRetry callback\n */\nexport type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean;\n\n/**\n * @class\n * @implements MiddlewareOptions\n * Class for RetryHandlerOptions\n */\n\nexport class RetryHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default delay value in seconds\n\t */\n\tprivate static DEFAULT_DELAY = 3;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default maxRetries value\n\t */\n\tprivate static DEFAULT_MAX_RETRIES = 3;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum delay value in seconds\n\t */\n\tprivate static MAX_DELAY = 180;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum maxRetries value\n\t */\n\tprivate static MAX_MAX_RETRIES = 10;\n\n\t/**\n\t * @public\n\t * A member holding delay value in seconds\n\t */\n\tpublic delay: number;\n\n\t/**\n\t * @public\n\t * A member holding maxRetries value\n\t */\n\tpublic maxRetries: number;\n\n\t/**\n\t * @public\n\t * A member holding shouldRetry callback\n\t */\n\tpublic shouldRetry: ShouldRetry;\n\n\t/**\n\t * @private\n\t * A member holding default shouldRetry callback\n\t */\n\tprivate static defaultShouldRetry: ShouldRetry = () => true;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RetryHandlerOptions\n\t * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds\n\t * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value\n\t * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function\n\t * @returns An instance of RetryHandlerOptions\n\t */\n\tpublic constructor(delay: number = RetryHandlerOptions.DEFAULT_DELAY, maxRetries: number = RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry: ShouldRetry = RetryHandlerOptions.defaultShouldRetry) {\n\t\tif (delay > RetryHandlerOptions.MAX_DELAY && maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be more than ${RetryHandlerOptions.MAX_DELAY} and ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (delay > RetryHandlerOptions.MAX_DELAY) {\n\t\t\tconst error = new Error(`Delay should not be more than ${RetryHandlerOptions.MAX_DELAY}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (maxRetries > RetryHandlerOptions.MAX_MAX_RETRIES) {\n\t\t\tconst error = new Error(`MaxRetries should not be more than ${RetryHandlerOptions.MAX_MAX_RETRIES}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t} else if (delay < 0 && maxRetries < 0) {\n\t\t\tconst error = new Error(`Delay and MaxRetries should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t} else if (delay < 0) {\n\t\t\tconst error = new Error(`Delay should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t} else if (maxRetries < 0) {\n\t\t\tconst error = new Error(`MaxRetries should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.delay = Math.min(delay, RetryHandlerOptions.MAX_DELAY);\n\t\tthis.maxRetries = Math.min(maxRetries, RetryHandlerOptions.MAX_MAX_RETRIES);\n\t\tthis.shouldRetry = shouldRetry;\n\t}\n\n\t/**\n\t * @public\n\t * To get the maximum delay\n\t * @returns A maximum delay\n\t */\n\tpublic getMaxDelay(): number {\n\t\treturn RetryHandlerOptions.MAX_DELAY;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RetryHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { FetchOptions } from \"../IFetchOptions\";\nimport { RequestMethod } from \"../RequestMethod\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\nimport { RetryHandlerOptions } from \"./options/RetryHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class for RetryHandler\n */\nexport class RetryHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A list of status codes that needs to be retried\n\t */\n\tprivate static RETRY_STATUS_CODES: number[] = [\n\t\t429, // Too many requests\n\t\t503, // Service unavailable\n\t\t504, // Gateway timeout\n\t];\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of retry attempt header\n\t */\n\tprivate static RETRY_ATTEMPT_HEADER = \"Retry-Attempt\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of retry after header\n\t */\n\tprivate static RETRY_AFTER_HEADER = \"Retry-After\";\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @private\n\t * A member holding the retry handler options\n\t */\n\tprivate options: RetryHandlerOptions;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RetryHandler\n\t * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value\n\t * @returns An instance of RetryHandler\n\t */\n\tpublic constructor(options: RetryHandlerOptions = new RetryHandlerOptions()) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t *\n\t * @private\n\t * To check whether the response has the retry status code\n\t * @param {Response} response - The response object\n\t * @returns Whether the response has retry status code or not\n\t */\n\tprivate isRetry(response: Response): boolean {\n\t\treturn RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the payload is buffered or not\n\t * @param {RequestInfo} request - The url string or the request object value\n\t * @param {FetchOptions} options - The options of a request\n\t * @returns Whether the payload is buffered or not\n\t */\n\tprivate isBuffered(request: RequestInfo, options: FetchOptions | undefined): boolean {\n\t\tconst method = typeof request === \"string\" ? options.method : (request as Request).method;\n\t\tconst isPutPatchOrPost: boolean = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST;\n\t\tif (isPutPatchOrPost) {\n\t\t\tconst isStream = getRequestHeader(request, options, \"Content-Type\") === \"application/octet-stream\";\n\t\t\tif (isStream) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * @private\n\t * To get the delay for a retry\n\t * @param {Response} response - The response object\n\t * @param {number} retryAttempts - The current attempt count\n\t * @param {number} delay - The delay value in seconds\n\t * @returns A delay for a retry\n\t */\n\tprivate getDelay(response: Response, retryAttempts: number, delay: number): number {\n\t\tconst getRandomness = () => Number(Math.random().toFixed(3));\n\t\tconst retryAfter = response.headers !== undefined ? response.headers.get(RetryHandler.RETRY_AFTER_HEADER) : null;\n\t\tlet newDelay: number;\n\t\tif (retryAfter !== null) {\n\t\t\tif (Number.isNaN(Number(retryAfter))) {\n\t\t\t\tnewDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1000);\n\t\t\t} else {\n\t\t\t\tnewDelay = Number(retryAfter);\n\t\t\t}\n\t\t} else {\n\t\t\t// Adding randomness to avoid retrying at a same\n\t\t\tnewDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness();\n\t\t}\n\t\treturn Math.min(newDelay, this.options.getMaxDelay() + getRandomness());\n\t}\n\n\t/**\n\t * @private\n\t * To get an exponential back off value\n\t * @param {number} attempts - The current attempt count\n\t * @returns An exponential back off value\n\t */\n\tprivate getExponentialBackOffTime(attempts: number): number {\n\t\treturn Math.round((1 / 2) * (2 ** attempts - 1));\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To add delay for the execution\n\t * @param {number} delaySeconds - The delay value in seconds\n\t * @returns Nothing\n\t */\n\tprivate async sleep(delaySeconds: number): Promise<void> {\n\t\tconst delayMilliseconds = delaySeconds * 1000;\n\t\treturn new Promise((resolve) => setTimeout(resolve, delayMilliseconds));\n\t}\n\n\tprivate getOptions(context: Context): RetryHandlerOptions {\n\t\tlet options: RetryHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(this.options.constructor) as RetryHandlerOptions;\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = Object.assign(new RetryHandlerOptions(), this.options);\n\t\t}\n\t\treturn options;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To execute the middleware with retries\n\t * @param {Context} context - The context object\n\t * @param {number} retryAttempts - The current attempt count\n\t * @param {RetryHandlerOptions} options - The retry middleware options instance\n\t * @returns A Promise that resolves to nothing\n\t */\n\tprivate async executeWithRetry(context: Context, retryAttempts: number, options: RetryHandlerOptions): Promise<void> {\n\t\tawait this.nextMiddleware.execute(context);\n\t\tif (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) {\n\t\t\t++retryAttempts;\n\t\t\tsetRequestHeader(context.request, context.options, RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());\n\t\t\tconst delay = this.getDelay(context.response, retryAttempts, options.delay);\n\t\t\tawait this.sleep(delay);\n\t\t\treturn await this.executeWithRetry(context, retryAttempts, options);\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst retryAttempts = 0;\n\t\tconst options: RetryHandlerOptions = this.getOptions(context);\n\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED);\n\t\treturn await this.executeWithRetry(context, retryAttempts, options);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RedirectHandlerOptions\n */\n\nimport { MiddlewareOptions } from \"./IMiddlewareOptions\";\n\n/**\n * @type\n * A type declaration for shouldRetry callback\n */\nexport type ShouldRedirect = (response: Response) => boolean;\n\n/**\n * @class\n * @implements MiddlewareOptions\n * A class representing RedirectHandlerOptions\n */\nexport class RedirectHandlerOptions implements MiddlewareOptions {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding default max redirects value\n\t */\n\tprivate static DEFAULT_MAX_REDIRECTS = 5;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding maximum max redirects value\n\t */\n\tprivate static MAX_MAX_REDIRECTS = 20;\n\n\t/**\n\t * @public\n\t * A member holding max redirects value\n\t */\n\tpublic maxRedirects: number;\n\n\t/**\n\t * @public\n\t * A member holding shouldRedirect callback\n\t */\n\tpublic shouldRedirect: ShouldRedirect;\n\n\t/**\n\t * @private\n\t * A member holding default shouldRedirect callback\n\t */\n\tprivate static defaultShouldRedirect: ShouldRedirect = () => true;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RedirectHandlerOptions\n\t * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value\n\t * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback\n\t * @returns An instance of RedirectHandlerOptions\n\t */\n\tpublic constructor(maxRedirects: number = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect: ShouldRedirect = RedirectHandlerOptions.defaultShouldRedirect) {\n\t\tif (maxRedirects > RedirectHandlerOptions.MAX_MAX_REDIRECTS) {\n\t\t\tconst error = new Error(`MaxRedirects should not be more than ${RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);\n\t\t\terror.name = \"MaxLimitExceeded\";\n\t\t\tthrow error;\n\t\t}\n\t\tif (maxRedirects < 0) {\n\t\t\tconst error = new Error(`MaxRedirects should not be negative`);\n\t\t\terror.name = \"MinExpectationNotMet\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.maxRedirects = maxRedirects;\n\t\tthis.shouldRedirect = shouldRedirect;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module RedirectHandler\n */\n\nimport { Context } from \"../IContext\";\nimport { RequestMethod } from \"../RequestMethod\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { cloneRequestWithNewUrl } from \"./MiddlewareUtil\";\nimport { RedirectHandlerOptions } from \"./options/RedirectHandlerOptions\";\nimport { FeatureUsageFlag, TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * Class\n * @implements Middleware\n * Class representing RedirectHandler\n */\nexport class RedirectHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the array of redirect status codes\n\t */\n\tprivate static REDIRECT_STATUS_CODES: number[] = [\n\t\t301, // Moved Permanently\n\t\t302, // Found\n\t\t303, // See Other\n\t\t307, // Temporary Permanently\n\t\t308, // Moved Permanently\n\t];\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding SeeOther status code\n\t */\n\tprivate static STATUS_CODE_SEE_OTHER = 303;\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the location header\n\t */\n\tprivate static LOCATION_HEADER = \"Location\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member representing the authorization header name\n\t */\n\tprivate static AUTHORIZATION_HEADER = \"Authorization\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the manual redirect value\n\t */\n\tprivate static MANUAL_REDIRECT: RequestRedirect = \"manual\";\n\n\t/**\n\t * @private\n\t * A member holding options to customize the handler behavior\n\t */\n\tprivate options: RedirectHandlerOptions;\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * To create an instance of RedirectHandler\n\t * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance\n\t * @returns An instance of RedirectHandler\n\t */\n\n\tpublic constructor(options: RedirectHandlerOptions = new RedirectHandlerOptions()) {\n\t\tthis.options = options;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the response has the redirect status code or not\n\t * @param {Response} response - The response object\n\t * @returns A boolean representing whether the response contains the redirect status code or not\n\t */\n\tprivate isRedirect(response: Response): boolean {\n\t\treturn RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the response has location header or not\n\t * @param {Response} response - The response object\n\t * @returns A boolean representing the whether the response has location header or not\n\t */\n\tprivate hasLocationHeader(response: Response): boolean {\n\t\treturn response.headers.has(RedirectHandler.LOCATION_HEADER);\n\t}\n\n\t/**\n\t * @private\n\t * To get the redirect url from location header in response object\n\t * @param {Response} response - The response object\n\t * @returns A redirect url from location header\n\t */\n\tprivate getLocationHeader(response: Response): string {\n\t\treturn response.headers.get(RedirectHandler.LOCATION_HEADER);\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the given url is a relative url or not\n\t * @param {string} url - The url string value\n\t * @returns A boolean representing whether the given url is a relative url or not\n\t */\n\tprivate isRelativeURL(url: string): boolean {\n\t\treturn url.indexOf(\"://\") === -1;\n\t}\n\n\t/**\n\t * @private\n\t * To check whether the authorization header in the request should be dropped for consequent redirected requests\n\t * @param {string} requestUrl - The request url value\n\t * @param {string} redirectUrl - The redirect url value\n\t * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests\n\t */\n\tprivate shouldDropAuthorizationHeader(requestUrl: string, redirectUrl: string): boolean {\n\t\tconst schemeHostRegex = /^[A-Za-z].+?:\\/\\/.+?(?=\\/|$)/;\n\t\tconst requestMatches: string[] = schemeHostRegex.exec(requestUrl);\n\t\tlet requestAuthority: string;\n\t\tlet redirectAuthority: string;\n\t\tif (requestMatches !== null) {\n\t\t\trequestAuthority = requestMatches[0];\n\t\t}\n\t\tconst redirectMatches: string[] = schemeHostRegex.exec(redirectUrl);\n\t\tif (redirectMatches !== null) {\n\t\t\tredirectAuthority = redirectMatches[0];\n\t\t}\n\t\treturn typeof requestAuthority !== \"undefined\" && typeof redirectAuthority !== \"undefined\" && requestAuthority !== redirectAuthority;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To update a request url with the redirect url\n\t * @param {string} redirectUrl - The redirect url value\n\t * @param {Context} context - The context object value\n\t * @returns Nothing\n\t */\n\tprivate async updateRequestUrl(redirectUrl: string, context: Context): Promise<void> {\n\t\tcontext.request = typeof context.request === \"string\" ? redirectUrl : await cloneRequestWithNewUrl(redirectUrl, context.request as Request);\n\t}\n\n\t/**\n\t * @private\n\t * To get the options for execution of the middleware\n\t * @param {Context} context - The context object\n\t * @returns A options for middleware execution\n\t */\n\tprivate getOptions(context: Context): RedirectHandlerOptions {\n\t\tlet options: RedirectHandlerOptions;\n\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\toptions = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions) as RedirectHandlerOptions;\n\t\t}\n\t\tif (typeof options === \"undefined\") {\n\t\t\toptions = Object.assign(new RedirectHandlerOptions(), this.options);\n\t\t}\n\t\treturn options;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * To execute the next middleware and to handle in case of redirect response returned by the server\n\t * @param {Context} context - The context object\n\t * @param {number} redirectCount - The redirect count value\n\t * @param {RedirectHandlerOptions} options - The redirect handler options instance\n\t * @returns A promise that resolves to nothing\n\t */\n\tprivate async executeWithRedirect(context: Context, redirectCount: number, options: RedirectHandlerOptions): Promise<void> {\n\t\tawait this.nextMiddleware.execute(context);\n\t\tconst response = context.response;\n\t\tif (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) {\n\t\t\t++redirectCount;\n\t\t\tif (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) {\n\t\t\t\tcontext.options.method = RequestMethod.GET;\n\t\t\t\tdelete context.options.body;\n\t\t\t} else {\n\t\t\t\tconst redirectUrl: string = this.getLocationHeader(response);\n\t\t\t\tif (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) {\n\t\t\t\t\tdelete context.options.headers[RedirectHandler.AUTHORIZATION_HEADER];\n\t\t\t\t}\n\t\t\t\tawait this.updateRequestUrl(redirectUrl, context);\n\t\t\t}\n\t\t\tawait this.executeWithRedirect(context, redirectCount, options);\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst redirectCount = 0;\n\t\tconst options = this.getOptions(context);\n\t\tcontext.options.redirect = RedirectHandler.MANUAL_REDIRECT;\n\t\tTelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED);\n\t\treturn await this.executeWithRedirect(context, redirectCount, options);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n// THIS FILE IS AUTO GENERATED\n// ANY CHANGES WILL BE LOST DURING BUILD\n\n/**\n * @module Version\n */\n\nexport const PACKAGE_VERSION = \"3.0.7\";\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module TelemetryHandler\n */\nimport { isCustomHost, isGraphURL } from \"../GraphRequestUtil\";\nimport { Context } from \"../IContext\";\nimport { PACKAGE_VERSION } from \"../Version\";\nimport { Middleware } from \"./IMiddleware\";\nimport { MiddlewareControl } from \"./MiddlewareControl\";\nimport { appendRequestHeader, generateUUID, getRequestHeader, setRequestHeader } from \"./MiddlewareUtil\";\nimport { TelemetryHandlerOptions } from \"./options/TelemetryHandlerOptions\";\n\n/**\n * @class\n * @implements Middleware\n * Class for TelemetryHandler\n */\nexport class TelemetryHandler implements Middleware {\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the client request id header\n\t */\n\tprivate static CLIENT_REQUEST_ID_HEADER = \"client-request-id\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the name of the sdk version header\n\t */\n\tprivate static SDK_VERSION_HEADER = \"SdkVersion\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the language prefix for the sdk version header value\n\t */\n\tprivate static PRODUCT_NAME = \"graph-js\";\n\n\t/**\n\t * @private\n\t * @static\n\t * A member holding the key for the feature usage metrics\n\t */\n\tprivate static FEATURE_USAGE_STRING = \"featureUsage\";\n\n\t/**\n\t * @private\n\t * A member to hold next middleware in the middleware chain\n\t */\n\tprivate nextMiddleware: Middleware;\n\n\t/**\n\t * @public\n\t * @async\n\t * To execute the current middleware\n\t * @param {Context} context - The context object of the request\n\t * @returns A Promise that resolves to nothing\n\t */\n\tpublic async execute(context: Context): Promise<void> {\n\t\tconst url = typeof context.request === \"string\" ? context.request : context.request.url;\n\t\tif (isGraphURL(url) || (context.customHosts && isCustomHost(url, context.customHosts))) {\n\t\t\t// Add telemetry only if the request url is a Graph URL.\n\t\t\t// Errors are reported as in issue #265 if headers are present when redirecting to a non Graph URL\n\t\t\tlet clientRequestId: string = getRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER);\n\t\t\tif (!clientRequestId) {\n\t\t\t\tclientRequestId = generateUUID();\n\t\t\t\tsetRequestHeader(context.request, context.options, TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId);\n\t\t\t}\n\t\t\tlet sdkVersionValue = `${TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`;\n\t\t\tlet options: TelemetryHandlerOptions;\n\t\t\tif (context.middlewareControl instanceof MiddlewareControl) {\n\t\t\t\toptions = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions) as TelemetryHandlerOptions;\n\t\t\t}\n\t\t\tif (options) {\n\t\t\t\tconst featureUsage: string = options.getFeatureUsage();\n\t\t\t\tsdkVersionValue += ` (${TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`;\n\t\t\t}\n\t\t\tappendRequestHeader(context.request, context.options, TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue);\n\t\t} else {\n\t\t\t// Remove telemetry headers if present during redirection.\n\t\t\tdelete context.options.headers[TelemetryHandler.CLIENT_REQUEST_ID_HEADER];\n\t\t\tdelete context.options.headers[TelemetryHandler.SDK_VERSION_HEADER];\n\t\t}\n\t\treturn await this.nextMiddleware.execute(context);\n\t}\n\n\t/**\n\t * @public\n\t * To set the next middleware in the chain\n\t * @param {Middleware} next - The middleware instance\n\t * @returns Nothing\n\t */\n\tpublic setNext(next: Middleware): void {\n\t\tthis.nextMiddleware = next;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module ChaosStrategy\n */\n\n/**\n * Strategy used for Testing Handler\n * @enum\n */\nexport enum ChaosStrategy {\n\tMANUAL,\n\tRANDOM,\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @enum\n * Enum for ResponseType values\n * @property {string} ARRAYBUFFER - To download response content as an [ArrayBuffer]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer}\n * @property {string} BLOB - To download content as a [binary/blob] {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob}\n * @property {string} DOCUMENT - This downloads content as a document or stream\n * @property {string} JSON - To download response content as a json\n * @property {string} STREAM - To download response as a [stream]{@link https://nodejs.org/api/stream.html}\n * @property {string} TEXT - For downloading response as a text\n */\n\nexport enum ResponseType {\n\tARRAYBUFFER = \"arraybuffer\",\n\tBLOB = \"blob\",\n\tDOCUMENT = \"document\",\n\tJSON = \"json\",\n\tRAW = \"raw\",\n\tSTREAM = \"stream\",\n\tTEXT = \"text\",\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphResponseHandler\n * References - https://fetch.spec.whatwg.org/#responses\n */\n\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\nimport { ResponseType } from \"./ResponseType\";\n\n/**\n * @enum\n * Enum for document types\n * @property {string} TEXT_HTML - The text/html content type\n * @property {string} TEXT_XML - The text/xml content type\n * @property {string} APPLICATION_XML - The application/xml content type\n * @property {string} APPLICATION_XHTML - The application/xhml+xml content type\n */\nexport enum DocumentType {\n\tTEXT_HTML = \"text/html\",\n\tTEXT_XML = \"text/xml\",\n\tAPPLICATION_XML = \"application/xml\",\n\tAPPLICATION_XHTML = \"application/xhtml+xml\",\n}\n\n/**\n * @enum\n * Enum for Content types\n * @property {string} TEXT_PLAIN - The text/plain content type\n * @property {string} APPLICATION_JSON - The application/json content type\n */\n\nenum ContentType {\n\tTEXT_PLAIN = \"text/plain\",\n\tAPPLICATION_JSON = \"application/json\",\n}\n\n/**\n * @enum\n * Enum for Content type regex\n * @property {string} DOCUMENT - The regex to match document content types\n * @property {string} IMAGE - The regex to match image content types\n */\nenum ContentTypeRegexStr {\n\tDOCUMENT = \"^(text\\\\/(html|xml))|(application\\\\/(xml|xhtml\\\\+xml))$\",\n\tIMAGE = \"^image\\\\/.+\",\n}\n\n/**\n * @class\n * Class for GraphResponseHandler\n */\n\nexport class GraphResponseHandler {\n\t/**\n\t * @private\n\t * @static\n\t * To parse Document response\n\t * @param {Response} rawResponse - The response object\n\t * @param {DocumentType} type - The type to which the document needs to be parsed\n\t * @returns A promise that resolves to a document content\n\t */\n\tprivate static parseDocumentResponse(rawResponse: Response, type: DocumentType): Promise<any> {\n\t\tif (typeof DOMParser !== \"undefined\") {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\trawResponse.text().then((xmlString) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\tconst xmlDoc = parser.parseFromString(xmlString, type);\n\t\t\t\t\t\tresolve(xmlDoc);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t} else {\n\t\t\treturn Promise.resolve(rawResponse.body);\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * To convert the native Response to response content\n\t * @param {Response} rawResponse - The response object\n\t * @param {ResponseType} [responseType] - The response type value\n\t * @returns A promise that resolves to the converted response content\n\t */\n\tprivate static async convertResponse(rawResponse: Response, responseType?: ResponseType): Promise<any> {\n\t\tif (rawResponse.status === 204) {\n\t\t\t// NO CONTENT\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tlet responseValue: any;\n\t\tconst contentType = rawResponse.headers.get(\"Content-type\");\n\t\tswitch (responseType) {\n\t\t\tcase ResponseType.ARRAYBUFFER:\n\t\t\t\tresponseValue = await rawResponse.arrayBuffer();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.BLOB:\n\t\t\t\tresponseValue = await rawResponse.blob();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.DOCUMENT:\n\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML);\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.JSON:\n\t\t\t\tresponseValue = await rawResponse.json();\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.STREAM:\n\t\t\t\tresponseValue = await Promise.resolve(rawResponse.body);\n\t\t\t\tbreak;\n\t\t\tcase ResponseType.TEXT:\n\t\t\t\tresponseValue = await rawResponse.text();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (contentType !== null) {\n\t\t\t\t\tconst mimeType = contentType.split(\";\")[0];\n\t\t\t\t\tif (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) {\n\t\t\t\t\t\tresponseValue = await GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType as DocumentType);\n\t\t\t\t\t} else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) {\n\t\t\t\t\t\tresponseValue = rawResponse.blob();\n\t\t\t\t\t} else if (mimeType === ContentType.TEXT_PLAIN) {\n\t\t\t\t\t\tresponseValue = await rawResponse.text();\n\t\t\t\t\t} else if (mimeType === ContentType.APPLICATION_JSON) {\n\t\t\t\t\t\tresponseValue = await rawResponse.json();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t/**\n\t\t\t\t\t * RFC specification {@link https://tools.ietf.org/html/rfc7231#section-3.1.1.5} says:\n\t\t\t\t\t * A sender that generates a message containing a payload body SHOULD\n\t\t\t\t\t * generate a Content-Type header field in that message unless the\n\t\t\t\t\t * intended media type of the enclosed representation is unknown to the\n\t\t\t\t\t * sender. If a Content-Type header field is not present, the recipient\n\t\t\t\t\t * MAY either assume a media type of \"application/octet-stream\"\n\t\t\t\t\t * ([RFC2046], Section 4.5.1) or examine the data to determine its type.\n\t\t\t\t\t *\n\t\t\t\t\t * So assuming it as a stream type so returning the body.\n\t\t\t\t\t */\n\t\t\t\t\tresponseValue = Promise.resolve(rawResponse.body);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn responseValue;\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To get the parsed response\n\t * @param {Response} rawResponse - The response object\n\t * @param {ResponseType} [responseType] - The response type value\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\n\t * @returns The parsed response\n\t */\n\tpublic static async getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise<any> {\n\t\tif (responseType === ResponseType.RAW) {\n\t\t\treturn Promise.resolve(rawResponse);\n\t\t} else {\n\t\t\tconst response = await GraphResponseHandler.convertResponse(rawResponse, responseType);\n\t\t\tif (rawResponse.ok) {\n\t\t\t\t// Status Code 2XX\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback(null, response);\n\t\t\t\t} else {\n\t\t\t\t\treturn response;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// NOT OK Response\n\t\t\t\tthrow response;\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Range\n */\n\n/**\n * @class\n * Class representing Range\n */\nexport class Range {\n\t/**\n\t * @public\n\t * The minimum value of the range\n\t */\n\tpublic minValue: number;\n\n\t/**\n\t * @public\n\t * The maximum value of the range\n\t */\n\tpublic maxValue: number;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates a range for given min and max values\n\t * @param {number} [minVal = -1] - The minimum value.\n\t * @param {number} [maxVal = -1] - The maximum value.\n\t * @returns An instance of a Range\n\t */\n\tpublic constructor(minVal = -1, maxVal = -1) {\n\t\tthis.minValue = minVal;\n\t\tthis.maxValue = maxVal;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * Class representing a successful file upload result\n */\nexport class UploadResult {\n\t/**\n\t * @private\n\t * Location value looked up in the response header\n\t */\n\tprivate _location: string;\n\n\t/**\n\t * @private\n\t * Response body of the final raw response\n\t */\n\tprivate _responseBody: unknown;\n\n\t/**\n\t * @public\n\t * Get of the location value.\n\t * Location value is looked up in the response header\n\t */\n\tpublic get location(): string {\n\t\treturn this._location;\n\t}\n\n\t/**\n\t * @public\n\t * Set the location value\n\t * Location value is looked up in the response header\n\t */\n\tpublic set location(location: string) {\n\t\tthis._location = location;\n\t}\n\n\t/**\n\t * @public\n\t * Get The response body from the completed upload response\n\t */\n\tpublic get responseBody() {\n\t\treturn this._responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * Set the response body from the completed upload response\n\t */\n\tpublic set responseBody(responseBody: unknown) {\n\t\tthis._responseBody = responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * @param {responseBody} responsebody - The response body from the completed upload response\n\t * @param {location} location - The location value from the headers from the completed upload response\n\t */\n\tpublic constructor(responseBody: unknown, location: string) {\n\t\t// Response body or the location parameter can be undefined.\n\t\tthis._location = location;\n\t\tthis._responseBody = responseBody;\n\t}\n\n\t/**\n\t * @public\n\t * @param {responseBody} responseBody - The response body from the completed upload response\n\t * @param {responseHeaders} responseHeaders - The headers from the completed upload response\n\t */\n\tpublic static CreateUploadResult(responseBody?: unknown, responseHeaders?: Headers) {\n\t\treturn new UploadResult(responseBody, responseHeaders.get(\"location\"));\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module LargeFileUploadTask\n */\n\nimport { GraphClientError } from \"../GraphClientError\";\nimport { GraphResponseHandler } from \"../GraphResponseHandler\";\nimport { Client } from \"../index\";\nimport { ResponseType } from \"../ResponseType\";\nimport { UploadEventHandlers } from \"./FileUploadTask/Interfaces/IUploadEventHandlers\";\nimport { Range } from \"./FileUploadTask/Range\";\nimport { UploadResult } from \"./FileUploadTask/UploadResult\";\n\n/**\n * @interface\n * Signature to representing key value pairs\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface KeyValuePairObjectStringNumber {\n\t[key: string]: string | number;\n}\n\n/**\n * @interface\n * Signature to represent the resulting response in the status enquiry request\n * @property {string} expirationDateTime - The expiration time of the upload session\n * @property {string[]} nextExpectedRanges - The ranges expected in next consecutive request in the upload\n */\ninterface UploadStatusResponse {\n\texpirationDateTime: string;\n\tnextExpectedRanges: string[];\n}\n\n/**\n * @interface\n * Signature to define options for upload task\n * @property {number} [rangeSize = LargeFileUploadTask.DEFAULT_FILE_SIZE] - Specifies the range chunk size\n * @property {UploadEventHandlers} uploadEventHandlers - UploadEventHandlers attached to an upload task\n */\nexport interface LargeFileUploadTaskOptions {\n\trangeSize?: number;\n\tuploadEventHandlers?: UploadEventHandlers;\n}\n\n/**\n * @interface\n * Signature to represent upload session resulting from the session creation in the server\n * @property {string} url - The URL to which the file upload is made\n * @property {Date} expiry - The expiration of the time of the upload session\n */\nexport interface LargeFileUploadSession {\n\turl: string;\n\texpiry: Date;\n\tisCancelled?: boolean;\n}\n\n/**\n * @type\n * Representing the return type of the sliceFile function that is type of the slice of a given range.\n */\nexport type SliceType = ArrayBuffer | Blob | Uint8Array;\n\n/**\n * @interface\n * Signature to define the properties and content of the file in upload task\n * @property {ArrayBuffer | File} content - The actual file content\n * @property {string} name - Specifies the file name with extension\n * @property {number} size - Specifies size of the file\n */\nexport interface FileObject<T> {\n\tcontent: T;\n\tname: string;\n\tsize: number;\n\tsliceFile(range: Range): SliceType | Promise<SliceType>;\n}\n\n/**\n * @class\n * Class representing LargeFileUploadTask\n */\nexport class LargeFileUploadTask<T> {\n\t/**\n\t * @private\n\t * Default value for the rangeSize\n\t */\n\tprivate DEFAULT_FILE_SIZE: number = 5 * 1024 * 1024;\n\n\t/**\n\t * @protected\n\t * The GraphClient instance\n\t */\n\tprotected client: Client;\n\n\t/**\n\t * @protected\n\t * The object holding file details\n\t */\n\tprotected file: FileObject<T>;\n\n\t/**\n\t * @protected\n\t * The object holding options for the task\n\t */\n\tprotected options: LargeFileUploadTaskOptions;\n\n\t/**\n\t * @protected\n\t * The object for upload session\n\t */\n\tprotected uploadSession: LargeFileUploadSession;\n\n\t/**\n\t * @protected\n\t * The next range needs to be uploaded\n\t */\n\tprotected nextRange: Range;\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Makes request to the server to create an upload session\n\t * @param {Client} client - The GraphClient instance\n\t * @param {string} requestUrl - The URL to create the upload session\n\t * @param {any} payload - The payload that needs to be sent\n\t * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent\n\t * @returns The promise that resolves to LargeFileUploadSession\n\t */\n\tpublic static async createUploadSession(client: Client, requestUrl: string, payload: any, headers: KeyValuePairObjectStringNumber = {}): Promise<LargeFileUploadSession> {\n\t\tconst session = await client\n\t\t\t.api(requestUrl)\n\t\t\t.headers(headers)\n\t\t\t.post(payload);\n\t\tconst largeFileUploadSession: LargeFileUploadSession = {\n\t\t\turl: session.uploadUrl,\n\t\t\texpiry: new Date(session.expirationDateTime),\n\t\t\tisCancelled: false,\n\t\t};\n\t\treturn largeFileUploadSession;\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a LargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded\n\t * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done\n\t * @param {LargeFileUploadTaskOptions} options - The upload task options\n\t * @returns An instance of LargeFileUploadTask\n\t */\n\tpublic constructor(client: Client, file: FileObject<T>, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions = {}) {\n\t\tthis.client = client;\n\n\t\tif (!file.sliceFile) {\n\t\t\tthrow new GraphClientError(\"Please pass the FileUpload object, StreamUpload object or any custom implementation of the FileObject interface\");\n\t\t} else {\n\t\t\tthis.file = file;\n\t\t}\n\t\tthis.file = file;\n\t\tif (!options.rangeSize) {\n\t\t\toptions.rangeSize = this.DEFAULT_FILE_SIZE;\n\t\t}\n\n\t\tthis.options = options;\n\t\tthis.uploadSession = uploadSession;\n\t\tthis.nextRange = new Range(0, this.options.rangeSize - 1);\n\t}\n\n\t/**\n\t * @private\n\t * Parses given range string to the Range instance\n\t * @param {string[]} ranges - The ranges value\n\t * @returns The range instance\n\t */\n\tprivate parseRange(ranges: string[]): Range {\n\t\tconst rangeStr = ranges[0];\n\t\tif (typeof rangeStr === \"undefined\" || rangeStr === \"\") {\n\t\t\treturn new Range();\n\t\t}\n\t\tconst firstRange = rangeStr.split(\"-\");\n\t\tconst minVal = parseInt(firstRange[0], 10);\n\t\tlet maxVal = parseInt(firstRange[1], 10);\n\t\tif (Number.isNaN(maxVal)) {\n\t\t\tmaxVal = this.file.size - 1;\n\t\t}\n\t\treturn new Range(minVal, maxVal);\n\t}\n\n\t/**\n\t * @private\n\t * Updates the expiration date and the next range\n\t * @param {UploadStatusResponse} response - The response of the upload status\n\t * @returns Nothing\n\t */\n\tprivate updateTaskStatus(response: UploadStatusResponse): void {\n\t\tthis.uploadSession.expiry = new Date(response.expirationDateTime);\n\t\tthis.nextRange = this.parseRange(response.nextExpectedRanges);\n\t}\n\n\t/**\n\t * @public\n\t * Gets next range that needs to be uploaded\n\t * @returns The range instance\n\t */\n\tpublic getNextRange(): Range {\n\t\tif (this.nextRange.minValue === -1) {\n\t\t\treturn this.nextRange;\n\t\t}\n\t\tconst minVal = this.nextRange.minValue;\n\t\tlet maxValue = minVal + this.options.rangeSize - 1;\n\t\tif (maxValue >= this.file.size) {\n\t\t\tmaxValue = this.file.size - 1;\n\t\t}\n\t\treturn new Range(minVal, maxValue);\n\t}\n\n\t/**\n\t * @deprecated This function has been moved into FileObject interface.\n\t * @public\n\t * Slices the file content to the given range\n\t * @param {Range} range - The range value\n\t * @returns The sliced ArrayBuffer or Blob\n\t */\n\tpublic sliceFile(range: Range): ArrayBuffer | Blob {\n\t\tconsole.warn(\"The LargeFileUploadTask.sliceFile() function has been deprecated and moved into the FileObject interface.\");\n\t\tif (this.file.content instanceof ArrayBuffer || this.file.content instanceof Blob || this.file.content instanceof Uint8Array) {\n\t\t\treturn this.file.content.slice(range.minValue, range.maxValue + 1);\n\t\t}\n\t\tthrow new GraphClientError(\"The LargeFileUploadTask.sliceFile() function expects only Blob, ArrayBuffer or Uint8Array file content. Please note that the sliceFile() function is deprecated.\");\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads file to the server in a sequential order by slicing the file\n\t * @returns The promise resolves to uploaded response\n\t */\n\tpublic async upload(): Promise<UploadResult> {\n\t\tconst uploadEventHandlers = this.options && this.options.uploadEventHandlers;\n\t\twhile (!this.uploadSession.isCancelled) {\n\t\t\tconst nextRange = this.getNextRange();\n\t\t\tif (nextRange.maxValue === -1) {\n\t\t\t\tconst err = new Error(\"Task with which you are trying to upload is already completed, Please check for your uploaded file\");\n\t\t\t\terr.name = \"Invalid Session\";\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tconst fileSlice = await this.file.sliceFile(nextRange);\n\t\t\tconst rawResponse = await this.uploadSliceGetRawResponse(fileSlice, nextRange, this.file.size);\n\t\t\tif (!rawResponse) {\n\t\t\t\tthrow new GraphClientError(\"Something went wrong! Large file upload slice response is null.\");\n\t\t\t}\n\n\t\t\tconst responseBody = await GraphResponseHandler.getResponse(rawResponse);\n\t\t\t/**\n\t\t\t * (rawResponse.status === 201) -> This condition is applicable for OneDrive, PrintDocument and Outlook APIs.\n\t\t\t * (rawResponse.status === 200 && responseBody.id) -> This additional condition is applicable only for OneDrive API.\n\t\t\t */\n\t\t\tif (rawResponse.status === 201 || (rawResponse.status === 200 && responseBody.id)) {\n\t\t\t\tthis.reportProgress(uploadEventHandlers, nextRange);\n\t\t\t\treturn UploadResult.CreateUploadResult(responseBody, rawResponse.headers);\n\t\t\t}\n\n\t\t\t/* Handling the API issue where the case of Outlook upload response property -'nextExpectedRanges' is not uniform.\n\t\t\t * https://github.com/microsoftgraph/msgraph-sdk-serviceissues/issues/39\n\t\t\t */\n\t\t\tconst res: UploadStatusResponse = {\n\t\t\t\texpirationDateTime: responseBody.expirationDateTime || responseBody.ExpirationDateTime,\n\t\t\t\tnextExpectedRanges: responseBody.NextExpectedRanges || responseBody.nextExpectedRanges,\n\t\t\t};\n\t\t\tthis.updateTaskStatus(res);\n\t\t\tthis.reportProgress(uploadEventHandlers, nextRange);\n\t\t}\n\t}\n\n\tprivate reportProgress(uploadEventHandlers: UploadEventHandlers, nextRange: Range) {\n\t\tif (uploadEventHandlers && uploadEventHandlers.progress) {\n\t\t\tuploadEventHandlers.progress(nextRange, uploadEventHandlers.extraCallbackParam);\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads given slice to the server\n\t * @param {ArrayBuffer | Blob | File} fileSlice - The file slice\n\t * @param {Range} range - The range value\n\t * @param {number} totalSize - The total size of a complete file\n\t * @returns The response body of the upload slice result\n\t */\n\tpublic async uploadSlice(fileSlice: ArrayBuffer | Blob | File, range: Range, totalSize: number): Promise<unknown> {\n\t\treturn await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.headers({\n\t\t\t\t\"Content-Length\": `${range.maxValue - range.minValue + 1}`,\n\t\t\t\t\"Content-Range\": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t})\n\t\t\t.put(fileSlice);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Uploads given slice to the server\n\t * @param {unknown} fileSlice - The file slice\n\t * @param {Range} range - The range value\n\t * @param {number} totalSize - The total size of a complete file\n\t * @returns The raw response of the upload slice result\n\t */\n\tpublic async uploadSliceGetRawResponse(fileSlice: unknown, range: Range, totalSize: number): Promise<Response> {\n\t\treturn await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.headers({\n\t\t\t\t\"Content-Length\": `${range.maxValue - range.minValue + 1}`,\n\t\t\t\t\"Content-Range\": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t})\n\t\t\t.responseType(ResponseType.RAW)\n\t\t\t.put(fileSlice);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Deletes upload session in the server\n\t * @returns The promise resolves to cancelled response\n\t */\n\tpublic async cancel(): Promise<unknown> {\n\t\tconst cancelResponse = await this.client\n\t\t\t.api(this.uploadSession.url)\n\t\t\t.responseType(ResponseType.RAW)\n\t\t\t.delete();\n\t\tif (cancelResponse.status === 204) {\n\t\t\tthis.uploadSession.isCancelled = true;\n\t\t}\n\t\treturn cancelResponse;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Gets status for the upload session\n\t * @returns The promise resolves to the status enquiry response\n\t */\n\tpublic async getStatus(): Promise<unknown> {\n\t\tconst response = await this.client.api(this.uploadSession.url).get();\n\t\tthis.updateTaskStatus(response);\n\t\treturn response;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Resumes upload session and continue uploading the file from the last sent range\n\t * @returns The promise resolves to the uploaded response\n\t */\n\tpublic async resume(): Promise<unknown> {\n\t\tawait this.getStatus();\n\t\treturn await this.upload();\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Get the upload session information\n\t * @returns The large file upload session\n\t */\n\tpublic getUploadSession(): LargeFileUploadSession {\n\t\treturn this.uploadSession;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\nimport { GraphClientError } from \"../../../GraphClientError\";\nimport { FileObject, SliceType } from \"../../LargeFileUploadTask\";\nimport { Range } from \"../Range\";\n\n/**\n * @class\n * Class used for creating LargeFileUploadTask fileobject.\n * This class accepts files of type ArrayBuffer, Blob, Uint8Array.\n */\nexport class FileUpload implements FileObject<SliceType> {\n\t/**\n\t * @public\n\t * @constructor\n\t * @param {ArrayBuffer | Blob | Uint8Array} content - The file to be uploaded\n\t * @param {string} name - The name of the file to be uploaded\n\t * @param {number} size - The total size of the file to be uploaded\n\t * @returns An instance of the FileUpload class\n\t */\n\tpublic constructor(public content: ArrayBuffer | Blob | Uint8Array, public name: string, public size: number) {\n\t\tif (!content || !name || !size) {\n\t\t\tthrow new GraphClientError(\"Please provide the upload content, name of the file and size of the file\");\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * Slices the file content to the given range\n\t * @param {Range} range - The range value\n\t * @returns The sliced file part\n\t */\n\tpublic sliceFile(range: Range): ArrayBuffer | Blob | Uint8Array {\n\t\treturn this.content.slice(range.minValue, range.maxValue + 1);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module OneDriveLargeFileUploadTaskUtil\n */\n\n/**\n * @constant\n * Default value for the rangeSize\n * 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}\n */\nconst DEFAULT_FILE_SIZE: number = 5 * 1024 * 1024;\n\n/**\n * @constant\n * Rounds off the given value to a multiple of 320 KB\n * @param {number} value - The value\n * @returns The rounded off value\n */\nconst roundTo320KB = (value: number): number => {\n\tif (value > 320 * 1024) {\n\t\tvalue = Math.floor(value / (320 * 1024)) * 320 * 1024;\n\t}\n\treturn value;\n};\n\n/**\n * @constant\n * Get the valid rangeSize for a file slicing (validity is based on the constrains mentioned in here\n * {@link https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_createuploadsession#upload-bytes-to-the-upload-session})\n *\n * @param {number} [rangeSize = DEFAULT_FILE_SIZE] - The rangeSize value.\n * @returns The valid rangeSize\n */\nexport const getValidRangeSize = (rangeSize: number = DEFAULT_FILE_SIZE): number => {\n\tconst sixtyMB = 60 * 1024 * 1024;\n\tif (rangeSize > sixtyMB) {\n\t\trangeSize = sixtyMB;\n\t}\n\treturn roundTo320KB(rangeSize);\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module OneDriveLargeFileUploadTask\n */\n\nimport { GraphClientError } from \"../GraphClientError\";\nimport { Client } from \"../index\";\nimport { FileUpload } from \"./FileUploadTask/FileObjectClasses/FileUpload\";\nimport { UploadEventHandlers } from \"./FileUploadTask/Interfaces/IUploadEventHandlers\";\nimport { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from \"./LargeFileUploadTask\";\nimport { getValidRangeSize } from \"./OneDriveLargeFileUploadTaskUtil\";\n\n/**\n * @interface\n * Signature to define options when creating an upload task\n * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)\n * @property {string} [fileDescription] - Specifies the description of the file to be uploaded\n * @property {string} [path] - The path to which the file needs to be uploaded\n * @property {number} [rangeSize] - Specifies the range chunk size\n * @property {string} [conflictBehavior] - Conflict behaviour option\n * @property {UploadEventHandlers} [uploadEventHandlers] - UploadEventHandlers attached to an upload task\n */\nexport interface OneDriveLargeFileUploadOptions {\n\tfileName: string;\n\tfileDescription?: string;\n\tpath?: string;\n\trangeSize?: number;\n\tconflictBehavior?: string;\n\tuploadEventHandlers?: UploadEventHandlers;\n /// <summary>\n /// Default upload session url is : \"/me/drive/root:/{file-path}:/createUploadSession\"\n /// Set this property to override the default upload session url. Example: \"/me/drive/special/{name}\"\n /// </summary>\n uploadSessionURL?: string;\n}\n\n/**\n * @interface\n * Signature to define options when creating an upload task\n * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)\n * @property {string} [fileDescription] - Specifies the description of the file to be uploaded\n * @property {string} [conflictBehavior] - Conflict behaviour option\n */\ninterface OneDriveFileUploadSessionPayLoad {\n\tfileName: string;\n\tfileDescription?: string;\n\tconflictBehavior?: string;\n}\n\n/**\n * @interface\n * Signature to define the file information when processing an upload task\n * @property {File | Uint8Array} content - The file content\n * @property {number} size - The size of file\n */\ninterface FileInfo {\n\tcontent: File | Uint8Array;\n\tsize: number;\n}\n\n/**\n * @class\n * Class representing OneDriveLargeFileUploadTask\n */\nexport class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {\n\t/**\n\t * @private\n\t * @static\n\t * Default path for the file being uploaded\n\t */\n\tprivate static DEFAULT_UPLOAD_PATH = \"/\";\n\n\t/**\n\t * @private\n\t * @static\n\t * Constructs the create session url for Onedrive\n\t * @param {string} fileName - The name of the file\n\t * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload\n\t * @returns The constructed create session url\n\t */\n\tprivate static constructCreateSessionUrl(fileName: string, path: string = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH): string {\n\t\tfileName = fileName.trim();\n\t\tpath = path.trim();\n\t\tif (path === \"\") {\n\t\t\tpath = \"/\";\n\t\t}\n\t\tif (path[0] !== \"/\") {\n\t\t\tpath = `/${path}`;\n\t\t}\n\t\tif (path[path.length - 1] !== \"/\") {\n\t\t\tpath = `${path}/`;\n\t\t}\n\t\t// we choose to encode each component of the file path separately because when encoding full URI\n\t\t// with encodeURI, special characters like # or % in the file name doesn't get encoded as desired\n\t\treturn `/me/drive/root:${path\n\t\t\t.split(\"/\")\n\t\t\t.map((p) => encodeURIComponent(p))\n\t\t\t.join(\"/\")}${encodeURIComponent(fileName)}:/createUploadSession`;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * Get file information\n\t * @param {Blob | Uint8Array | File} file - The file entity\n\t * @param {string} fileName - The file name\n\t * @returns {FileInfo} The file information\n\t */\n\tprivate static getFileInfo(file: Blob | Uint8Array | File, fileName: string): FileInfo {\n\t\tlet content;\n\t\tlet size;\n\t\tif (typeof Blob !== \"undefined\" && file instanceof Blob) {\n\t\t\tcontent = new File([file as Blob], fileName);\n\t\t\tsize = content.size;\n\t\t} else if (typeof File !== \"undefined\" && file instanceof File) {\n\t\t\tcontent = file as File;\n\t\t\tsize = content.size;\n\t\t} else if (typeof Uint8Array !== \"undefined\" && file instanceof Uint8Array) {\n\t\t\tconst b = file as Uint8Array;\n\t\t\tsize = b.byteLength;\n\t\t\tcontent = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);\n\t\t}\n\t\treturn {\n\t\t\tcontent,\n\t\t\tsize,\n\t\t};\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Creates a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {Blob | Uint8Array | File} file - File represented as Blob, Uint8Array or File\n\t * @param {OneDriveLargeFileUploadOptions} options - The options for upload task\n\t * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance\n\t */\n\tpublic static async create(client: Client, file: Blob | Uint8Array | File, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<Blob | ArrayBuffer | Uint8Array>> {\n\t\tif (!client || !file || !options) {\n\t\t\tthrow new GraphClientError(\"Please provide the Graph client instance, file object and OneDriveLargeFileUploadOptions value\");\n\t\t}\n\t\tconst fileName = options.fileName;\n\t\tconst fileInfo = OneDriveLargeFileUploadTask.getFileInfo(file, fileName);\n\t\tconst fileObj = new FileUpload(fileInfo.content, fileName, fileInfo.size);\n\t\treturn this.createTaskWithFileObject<Blob | ArrayBuffer | Uint8Array>(client, fileObj, options);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Creates a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} fileObject - FileObject instance\n\t * @param {OneDriveLargeFileUploadOptions} options - The options for upload task\n\t * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance\n\t */\n\tpublic static async createTaskWithFileObject<T>(client: Client, fileObject: FileObject<T>, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<T>> {\n\t\tif (!client || !fileObject || !options) {\n\t\t\tthrow new GraphClientError(\"Please provide the Graph client instance, FileObject interface implementation and OneDriveLargeFileUploadOptions value\");\n\t\t}\n\t\tconst requestUrl = options.uploadSessionURL ? options.uploadSessionURL: OneDriveLargeFileUploadTask.constructCreateSessionUrl(options.fileName, options.path);\n\t\tconst uploadSessionPayload: OneDriveFileUploadSessionPayLoad = {\n\t\t\tfileName: options.fileName,\n\t\t\tfileDescription: options.fileDescription,\n\t\t\tconflictBehavior: options.conflictBehavior,\n\t\t};\n\t\tconst session = await OneDriveLargeFileUploadTask.createUploadSession(client, requestUrl, uploadSessionPayload);\n\t\tconst rangeSize = getValidRangeSize(options.rangeSize);\n\t\treturn new OneDriveLargeFileUploadTask(client, fileObject, session, {\n\t\t\trangeSize,\n\t\t\tuploadEventHandlers: options.uploadEventHandlers,\n\t\t});\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * Makes request to the server to create an upload session\n\t * @param {Client} client - The GraphClient instance\n\t * @param {string} requestUrl - The URL to create the upload session\n\t * @param {string} payloadOptions - The payload option. Default conflictBehavior is 'rename'\n\t * @returns The promise that resolves to LargeFileUploadSession\n\t */\n\tpublic static async createUploadSession(client: Client, requestUrl: string, payloadOptions: OneDriveFileUploadSessionPayLoad): Promise<LargeFileUploadSession> {\n\t\tconst payload = {\n\t\t\titem: {\n\t\t\t\t\"@microsoft.graph.conflictBehavior\": payloadOptions?.conflictBehavior || \"rename\",\n\t\t\t\tname: payloadOptions?.fileName,\n\t\t\t\tdescription: payloadOptions?.fileDescription,\n\t\t\t},\n\t\t};\n\t\treturn super.createUploadSession(client, requestUrl, payload);\n\t}\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Constructs a OneDriveLargeFileUploadTask\n\t * @param {Client} client - The GraphClient instance\n\t * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded\n\t * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done\n\t * @param {LargeFileUploadTaskOptions} options - The upload task options\n\t * @returns An instance of OneDriveLargeFileUploadTask\n\t */\n\tpublic constructor(client: Client, file: FileObject<T>, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions) {\n\t\tsuper(client, file, uploadSession, options);\n\t}\n\n\t/**\n\t * @public\n\t * Commits upload session to end uploading\n\t * @param {string} requestUrl - The URL to commit the upload session\n\t * @param {string} conflictBehavior - Conflict behaviour option. Default is 'rename'\n\t * @returns The promise resolves to committed response\n\t */\n\tpublic async commit(requestUrl: string, conflictBehavior = \"rename\"): Promise<unknown> {\n\t\tconst payload = {\n\t\t\tname: this.file.name,\n\t\t\t\"@microsoft.graph.conflictBehavior\": conflictBehavior,\n\t\t\t\"@microsoft.graph.sourceUrl\": this.uploadSession.url,\n\t\t};\n\t\treturn await this.client.api(requestUrl).put(payload);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module CustomAuthenticationProvider\n */\n\nimport { GraphClientError } from \"./GraphClientError\";\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\nimport { AuthProvider } from \"./IAuthProvider\";\n\n/**\n * @class\n * Class representing CustomAuthenticationProvider\n * @extends AuthenticationProvider\n */\nexport class CustomAuthenticationProvider implements AuthenticationProvider {\n\t/**\n\t * @private\n\t * A member to hold authProvider callback\n\t */\n\tprivate provider: AuthProvider;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of CustomAuthenticationProvider\n\t * @param {AuthProviderCallback} provider - An authProvider function\n\t * @returns An instance of CustomAuthenticationProvider\n\t */\n\tpublic constructor(provider: AuthProvider) {\n\t\tthis.provider = provider;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To get the access token\n\t * @returns The promise that resolves to an access token\n\t */\n\tpublic async getAccessToken(): Promise<any> {\n\t\treturn new Promise((resolve: (accessToken: string) => void, reject: (error: any) => void) => {\n\t\t\tthis.provider(async (error: any, accessToken: string | null) => {\n\t\t\t\tif (accessToken) {\n\t\t\t\t\tresolve(accessToken);\n\t\t\t\t} else {\n\t\t\t\t\tif (!error) {\n\t\t\t\t\t\tconst invalidTokenMessage = \"Access token is undefined or empty.\\\n\t\t\t\t\t\tPlease provide a valid token.\\\n\t\t\t\t\t\tFor more help - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md\";\n\t\t\t\t\t\terror = new GraphClientError(invalidTokenMessage);\n\t\t\t\t\t}\n\t\t\t\t\tconst err = await GraphClientError.setGraphClientError(error);\n\t\t\t\t\treject(err);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphError\n */\n\n/**\n * @class\n * Class for GraphError\n * @NOTE: This is NOT what is returned from the Graph\n * GraphError is created from parsing JSON errors returned from the graph\n * Some fields are renamed ie, \"request-id\" => requestId so you can use dot notation\n */\n\nexport class GraphError extends Error {\n\t/**\n\t * @public\n\t * A member holding status code of the error\n\t */\n\tpublic statusCode: number;\n\n\t/**\n\t * @public\n\t * A member holding code i.e name of the error\n\t */\n\tpublic code: string | null;\n\n\t/**\n\t * @public\n\t * A member holding request-id i.e identifier of the request\n\t */\n\tpublic requestId: string | null;\n\n\t/**\n\t * @public\n\t * A member holding processed date and time of the request\n\t */\n\tpublic date: Date;\n\n public headers?: Headers;\n\n\t/**\n\t * @public\n\t * A member holding original error response by the graph service\n\t */\n\tpublic body: any;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphError\n\t * @param {number} [statusCode = -1] - The status code of the error\n\t * @param {string} [message] - The message of the error\n\t * @param {Error} [baseError] - The base error\n\t * @returns An instance of GraphError\n\t */\n\tpublic constructor(statusCode = -1, message?: string, baseError?: Error) {\n\t\tsuper(message || (baseError && baseError.message));\n\t\t// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\n\t\tObject.setPrototypeOf(this, GraphError.prototype);\n\t\tthis.statusCode = statusCode;\n\t\tthis.code = null;\n\t\tthis.requestId = null;\n\t\tthis.date = new Date();\n\t\tthis.body = null;\n\t\tthis.stack = baseError ? baseError.stack : this.stack;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphErrorHandler\n */\n\nimport { GraphError } from \"./GraphError\";\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\n\n/**\n * @interface\n * Signature for the json represent of the error response from the Graph API\n * https://docs.microsoft.com/en-us/graph/errors\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface GraphAPIErrorResponse {\n\terror: {\n\t\tcode: string;\n\t\tmessage: string;\n\t\tinnerError: any;\n\t};\n}\n\n/**\n * @class\n * Class for GraphErrorHandler\n */\n\nexport class GraphErrorHandler {\n\t/**\n\t * @private\n\t * @static\n\t * Populates the GraphError instance with Error instance values\n\t * @param {Error} error - The error returned by graph service or some native error\n\t * @param {number} [statusCode] - The status code of the response\n\t * @returns The GraphError instance\n\t */\n\tprivate static constructError(error: Error, statusCode?: number, rawResponse?: Response): GraphError {\n\t\tconst gError = new GraphError(statusCode, \"\", error);\n\t\tif (error.name !== undefined) {\n\t\t\tgError.code = error.name;\n\t\t}\n\t\tgError.body = error.toString();\n\t\tgError.date = new Date();\n\t\tgError.headers = rawResponse?.headers;\n\t\treturn gError;\n\t}\n\n\t/**\n\t * @private\n\t * @static\n\t * @async\n\t * Populates the GraphError instance from the Error returned by graph service\n\t * @param {GraphAPIErrorResponse} graphError - The error possibly returned by graph service or some native error\n\t * @param {number} statusCode - The status code of the response\n\t * @returns A promise that resolves to GraphError instance\n\t *\n\t * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo\n\t * {\n\t * \"error\": {\n\t * \"code\": \"SearchEvents\",\n\t * \"message\": \"The parameter $search is not currently supported on the Events resource.\",\n\t * \"innerError\": {\n\t * \"request-id\": \"b31c83fd-944c-4663-aa50-5d9ceb367e19\",\n\t * \"date\": \"2016-11-17T18:37:45\"\n\t * }\n\t * }\n\t * }\n\t */\n\tprivate static constructErrorFromResponse(graphError: GraphAPIErrorResponse, statusCode: number, rawResponse?: Response): GraphError {\n\t\tconst error = graphError.error;\n\t\tconst gError = new GraphError(statusCode, error.message);\n\t\tgError.code = error.code;\n\t\tif (error.innerError !== undefined) {\n\t\t\tgError.requestId = error.innerError[\"request-id\"];\n\t\t\tgError.date = new Date(error.innerError.date);\n\t\t}\n\n\t\tgError.body = JSON.stringify(error);\n\t\tgError.headers = rawResponse?.headers;\n\n\t\treturn gError;\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * @async\n\t * To get the GraphError object\n\t * Reference - https://docs.microsoft.com/en-us/graph/errors\n\t * @param {any} [error = null] - The error returned by graph service or some native error\n\t * @param {number} [statusCode = -1] - The status code of the response\n\t * @param {GraphRequestCallback} [callback] - The graph request callback function\n\t * @returns A promise that resolves to GraphError instance\n\t */\n\tpublic static async getError(error: any = null, statusCode = -1, callback?: GraphRequestCallback, rawResponse?: Response): Promise<GraphError> {\n\t\tlet gError: GraphError;\n\t\tif (error && error.error) {\n\t\t\tgError = GraphErrorHandler.constructErrorFromResponse(error, statusCode, rawResponse);\n\t\t} else if (error instanceof Error) {\n\t\t\tgError = GraphErrorHandler.constructError(error, statusCode, rawResponse);\n\t\t} else {\n\t\t\tgError = new GraphError(statusCode);\n\t\t\tgError.body = error; // if a custom error is passed which is not instance of Error object or a graph API response\n\t\t}\n\t\tif (typeof callback === \"function\") {\n\t\t\tcallback(gError, null);\n\t\t} else {\n\t\t\treturn gError;\n\t\t}\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module GraphRequest\n */\nimport { GraphClientError } from \"./GraphClientError\";\nimport { GraphError } from \"./GraphError\";\nimport { GraphErrorHandler } from \"./GraphErrorHandler\";\nimport { oDataQueryNames, serializeContent, urlJoin } from \"./GraphRequestUtil\";\nimport { GraphResponseHandler } from \"./GraphResponseHandler\";\nimport { HTTPClient } from \"./HTTPClient\";\nimport { ClientOptions } from \"./IClientOptions\";\nimport { Context } from \"./IContext\";\nimport { FetchOptions } from \"./IFetchOptions\";\nimport { GraphRequestCallback } from \"./IGraphRequestCallback\";\nimport { MiddlewareControl } from \"./middleware/MiddlewareControl\";\nimport { MiddlewareOptions } from \"./middleware/options/IMiddlewareOptions\";\nimport { RequestMethod } from \"./RequestMethod\";\nimport { ResponseType } from \"./ResponseType\";\n/**\n * @interface\n * Signature to representing key value pairs\n * @property {[key: string] : string | number} - The Key value pair\n */\ninterface KeyValuePairObjectStringNumber {\n\t[key: string]: string | number;\n}\n\n/**\n * @interface\n * Signature to define URL components\n * @template http://graph.microsoft.com/VERSION/PATH?QUERYSTRING&OTHER_QUERY_PARAMS\n *\n * @property {string} host - The host to which the request needs to be made\n * @property {string} version - Version of the graph endpoint\n * @property {string} [path] - The path of the resource request\n * @property {KeyValuePairObjectStringNumber} oDataQueryParams - The oData Query Params\n * @property {KeyValuePairObjectStringNumber} otherURLQueryParams - The other query params for a request\n * @property {string[]} otherURLQueryOptions - The non key-value query parameters. Example- '/me?$whatif'\n */\nexport interface URLComponents {\n\thost: string;\n\tversion: string;\n\tpath?: string;\n\toDataQueryParams: KeyValuePairObjectStringNumber;\n\totherURLQueryParams: KeyValuePairObjectStringNumber;\n\totherURLQueryOptions?: string[];\n}\n\n/**\n * @class\n * A Class representing GraphRequest\n */\nexport class GraphRequest {\n\t/**\n\t * @private\n\t * A member variable to hold HTTPClient instance\n\t */\n\tprivate httpClient: HTTPClient;\n\n\t/**\n\t * @private\n\t * A member variable to hold client options\n\t */\n\tprivate config: ClientOptions;\n\n\t/**\n\t * @private\n\t * A member to hold URL Components data\n\t */\n\tprivate urlComponents: URLComponents;\n\n\t/**\n\t * @private\n\t * A member to hold custom header options for a request\n\t */\n\tprivate _headers: HeadersInit;\n\n\t/**\n\t * @private\n\t * A member to hold custom options for a request\n\t */\n\tprivate _options: FetchOptions;\n\n\t/**\n\t * @private\n\t * A member to hold the array of middleware options for a request\n\t */\n\tprivate _middlewareOptions: MiddlewareOptions[];\n\n\t/**\n\t * @private\n\t * A member to hold custom response type for a request\n\t */\n\tprivate _responseType: ResponseType;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of GraphRequest\n\t * @param {HTTPClient} httpClient - The HTTPClient instance\n\t * @param {ClientOptions} config - The options for making request\n\t * @param {string} path - A path string\n\t */\n\tpublic constructor(httpClient: HTTPClient, config: ClientOptions, path: string) {\n\t\tthis.httpClient = httpClient;\n\t\tthis.config = config;\n\t\tthis.urlComponents = {\n\t\t\thost: this.config.baseUrl,\n\t\t\tversion: this.config.defaultVersion,\n\t\t\toDataQueryParams: {},\n\t\t\totherURLQueryParams: {},\n\t\t\totherURLQueryOptions: [],\n\t\t};\n\t\tthis._headers = {};\n\t\tthis._options = {};\n\t\tthis._middlewareOptions = [];\n\t\tthis.parsePath(path);\n\t}\n\n\t/**\n\t * @private\n\t * Parses the path string and creates URLComponents out of it\n\t * @param {string} path - The request path string\n\t * @returns Nothing\n\t */\n\tprivate parsePath = (path: string): void => {\n\t\t// Strips out the base of the url if they passed in\n\t\tif (path.indexOf(\"https://\") !== -1) {\n\t\t\tpath = path.replace(\"https://\", \"\");\n\n\t\t\t// Find where the host ends\n\t\t\tconst endOfHostStrPos = path.indexOf(\"/\");\n\t\t\tif (endOfHostStrPos !== -1) {\n\t\t\t\t// Parse out the host\n\t\t\t\tthis.urlComponents.host = \"https://\" + path.substring(0, endOfHostStrPos);\n\t\t\t\t// Strip the host from path\n\t\t\t\tpath = path.substring(endOfHostStrPos + 1, path.length);\n\t\t\t}\n\n\t\t\t// Remove the following version\n\t\t\tconst endOfVersionStrPos = path.indexOf(\"/\");\n\t\t\tif (endOfVersionStrPos !== -1) {\n\t\t\t\t// Parse out the version\n\t\t\t\tthis.urlComponents.version = path.substring(0, endOfVersionStrPos);\n\t\t\t\t// Strip version from path\n\t\t\t\tpath = path.substring(endOfVersionStrPos + 1, path.length);\n\t\t\t}\n\t\t}\n\n\t\t// Strip out any leading \"/\"\n\t\tif (path.charAt(0) === \"/\") {\n\t\t\tpath = path.substr(1);\n\t\t}\n\n\t\tconst queryStrPos = path.indexOf(\"?\");\n\t\tif (queryStrPos === -1) {\n\t\t\t// No query string\n\t\t\tthis.urlComponents.path = path;\n\t\t} else {\n\t\t\tthis.urlComponents.path = path.substr(0, queryStrPos);\n\n\t\t\t// Capture query string into oDataQueryParams and otherURLQueryParams\n\t\t\tconst queryParams = path.substring(queryStrPos + 1, path.length).split(\"&\");\n\t\t\tfor (const queryParam of queryParams) {\n\t\t\t\tthis.parseQueryParameter(queryParam);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @private\n\t * Adds the query parameter as comma separated values\n\t * @param {string} propertyName - The name of a property\n\t * @param {string|string[]} propertyValue - The vale of a property\n\t * @param {IArguments} additionalProperties - The additional properties\n\t * @returns Nothing\n\t */\n\tprivate addCsvQueryParameter(propertyName: string, propertyValue: string | string[], additionalProperties: IArguments): void {\n\t\t// If there are already $propertyName value there, append a \",\"\n\t\tthis.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + \",\" : \"\";\n\n\t\tlet allValues: string[] = [];\n\n\t\tif (additionalProperties.length > 1 && typeof propertyValue === \"string\") {\n\t\t\tallValues = Array.prototype.slice.call(additionalProperties);\n\t\t} else if (typeof propertyValue === \"string\") {\n\t\t\tallValues.push(propertyValue);\n\t\t} else {\n\t\t\tallValues = allValues.concat(propertyValue);\n\t\t}\n\n\t\tthis.urlComponents.oDataQueryParams[propertyName] += allValues.join(\",\");\n\t}\n\n\t/**\n\t * @private\n\t * Builds the full url from the URLComponents to make a request\n\t * @returns The URL string that is qualified to make a request to graph endpoint\n\t */\n\tprivate buildFullUrl(): string {\n\t\tconst url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString();\n\n\t\tif (this.config.debugLogging) {\n\t\t\tconsole.log(url);\n\t\t}\n\t\treturn url;\n\t}\n\n\t/**\n\t * @private\n\t * Builds the query string from the URLComponents\n\t * @returns The Constructed query string\n\t */\n\tprivate createQueryString(): string {\n\t\t// Combining query params from oDataQueryParams and otherURLQueryParams\n\t\tconst urlComponents = this.urlComponents;\n\t\tconst query: string[] = [];\n\t\tif (Object.keys(urlComponents.oDataQueryParams).length !== 0) {\n\t\t\tfor (const property in urlComponents.oDataQueryParams) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(urlComponents.oDataQueryParams, property)) {\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.oDataQueryParams[property]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Object.keys(urlComponents.otherURLQueryParams).length !== 0) {\n\t\t\tfor (const property in urlComponents.otherURLQueryParams) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(urlComponents.otherURLQueryParams, property)) {\n\t\t\t\t\tquery.push(property + \"=\" + urlComponents.otherURLQueryParams[property]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (urlComponents.otherURLQueryOptions.length !== 0) {\n\t\t\tfor (const str of urlComponents.otherURLQueryOptions) {\n\t\t\t\tquery.push(str);\n\t\t\t}\n\t\t}\n\t\treturn query.length > 0 ? \"?\" + query.join(\"&\") : \"\";\n\t}\n\n\t/**\n\t * @private\n\t * Parses the query parameters to set the urlComponents property of the GraphRequest object\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tprivate parseQueryParameter(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\n\t\tif (typeof queryDictionaryOrString === \"string\") {\n\t\t\tif (queryDictionaryOrString.charAt(0) === \"?\") {\n\t\t\t\tqueryDictionaryOrString = queryDictionaryOrString.substring(1);\n\t\t\t}\n\n\t\t\tif (queryDictionaryOrString.indexOf(\"&\") !== -1) {\n\t\t\t\tconst queryParams = queryDictionaryOrString.split(\"&\");\n\t\t\t\tfor (const str of queryParams) {\n\t\t\t\t\tthis.parseQueryParamenterString(str);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.parseQueryParamenterString(queryDictionaryOrString);\n\t\t\t}\n\t\t} else if (queryDictionaryOrString.constructor === Object) {\n\t\t\tfor (const key in queryDictionaryOrString) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(queryDictionaryOrString, key)) {\n\t\t\t\t\tthis.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * @private\n\t * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object\n\t * @param {string} queryParameter - the query parameters\n\t * returns nothing\n\t */\n\tprivate parseQueryParamenterString(queryParameter: string): void {\n\t\t/* The query key-value pair must be split on the first equals sign to avoid errors in parsing nested query parameters.\n Example-> \"/me?$expand=home($select=city)\" */\n\t\tif (this.isValidQueryKeyValuePair(queryParameter)) {\n\t\t\tconst indexOfFirstEquals = queryParameter.indexOf(\"=\");\n\t\t\tconst paramKey = queryParameter.substring(0, indexOfFirstEquals);\n\t\t\tconst paramValue = queryParameter.substring(indexOfFirstEquals + 1);\n\t\t\tthis.setURLComponentsQueryParamater(paramKey, paramValue);\n\t\t} else {\n\t\t\t/* Push values which are not of key-value structure.\n Example-> Handle an invalid input->.query(test), .query($select($select=name)) and let the Graph API respond with the error in the URL*/\n\t\t\tthis.urlComponents.otherURLQueryOptions.push(queryParameter);\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Sets values into the urlComponents property of GraphRequest object.\n\t * @param {string} paramKey - the query parameter key\n\t * @param {string} paramValue - the query paramter value\n\t * @returns nothing\n\t */\n\tprivate setURLComponentsQueryParamater(paramKey: string, paramValue: string | number): void {\n\t\tif (oDataQueryNames.indexOf(paramKey) !== -1) {\n\t\t\tconst currentValue = this.urlComponents.oDataQueryParams[paramKey];\n\t\t\tconst isValueAppendable = currentValue && (paramKey === \"$expand\" || paramKey === \"$select\" || paramKey === \"$orderby\");\n\t\t\tthis.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + \",\" + paramValue : paramValue;\n\t\t} else {\n\t\t\tthis.urlComponents.otherURLQueryParams[paramKey] = paramValue;\n\t\t}\n\t}\n\t/**\n\t * @private\n\t * Check if the query parameter string has a valid key-value structure\n\t * @param {string} queryString - the query parameter string. Example -> \"name=value\"\n\t * #returns true if the query string has a valid key-value structure else false\n\t */\n\tprivate isValidQueryKeyValuePair(queryString: string): boolean {\n\t\tconst indexofFirstEquals = queryString.indexOf(\"=\");\n\t\tif (indexofFirstEquals === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tconst indexofOpeningParanthesis = queryString.indexOf(\"(\");\n\t\tif (indexofOpeningParanthesis !== -1 && queryString.indexOf(\"(\") < indexofFirstEquals) {\n\t\t\t// Example -> .query($select($expand=true));\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * @private\n\t * Updates the custom headers and options for a request\n\t * @param {FetchOptions} options - The request options object\n\t * @returns Nothing\n\t */\n\tprivate updateRequestOptions(options: FetchOptions): void {\n\t\tconst optionsHeaders: HeadersInit = { ...options.headers };\n\t\tif (this.config.fetchOptions !== undefined) {\n\t\t\tconst fetchOptions: FetchOptions = { ...this.config.fetchOptions };\n\t\t\tObject.assign(options, fetchOptions);\n\t\t\tif (typeof this.config.fetchOptions.headers !== undefined) {\n\t\t\t\toptions.headers = { ...this.config.fetchOptions.headers };\n\t\t\t}\n\t\t}\n\t\tObject.assign(options, this._options);\n\t\tif (options.headers !== undefined) {\n\t\t\tObject.assign(optionsHeaders, options.headers);\n\t\t}\n\t\tObject.assign(optionsHeaders, this._headers);\n\t\toptions.headers = optionsHeaders;\n\t}\n\n\t/**\n\t * @private\n\t * @async\n\t * Adds the custom headers and options to the request and makes the HTTPClient send request call\n\t * @param {RequestInfo} request - The request url string or the Request object value\n\t * @param {FetchOptions} options - The options to make a request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the response content\n\t */\n\tprivate async send(request: RequestInfo, options: FetchOptions, callback?: GraphRequestCallback): Promise<any> {\n\t\tlet rawResponse: Response;\n\t\tconst middlewareControl = new MiddlewareControl(this._middlewareOptions);\n\t\tthis.updateRequestOptions(options);\n\t\tconst customHosts = this.config?.customHosts;\n\t\ttry {\n\t\t\tconst context: Context = await this.httpClient.sendRequest({\n\t\t\t\trequest,\n\t\t\t\toptions,\n\t\t\t\tmiddlewareControl,\n\t\t\t\tcustomHosts,\n\t\t\t});\n\n\t\t\trawResponse = context.response;\n\t\t\tconst response: any = await GraphResponseHandler.getResponse(rawResponse, this._responseType, callback);\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\tif (error instanceof GraphClientError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tlet statusCode: number;\n\n\t\t\tif (rawResponse) {\n\t\t\t\tstatusCode = rawResponse.status;\n\t\t\t}\n\t\t\tconst gError: GraphError = await GraphErrorHandler.getError(error, statusCode, callback, rawResponse);\n\t\t\tthrow gError;\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json\n\t * @param none\n\t * @returns nothing\n\t */\n\tprivate setHeaderContentType(): void {\n\t\tif (!this._headers) {\n\t\t\tthis.header(\"Content-Type\", \"application/json\");\n\t\t\treturn;\n\t\t}\n\t\tconst headerKeys = Object.keys(this._headers);\n\t\tfor (const headerKey of headerKeys) {\n\t\t\tif (headerKey.toLowerCase() === \"content-type\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Default the content-type to application/json in case the content-type is not present in the header\n\t\tthis.header(\"Content-Type\", \"application/json\");\n\t}\n\n\t/**\n\t * @public\n\t * Sets the custom header for a request\n\t * @param {string} headerKey - A header key\n\t * @param {string} headerValue - A header value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic header(headerKey: string, headerValue: string): GraphRequest {\n\t\tthis._headers[headerKey] = headerValue;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the custom headers for a request\n\t * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic headers(headers: KeyValuePairObjectStringNumber | HeadersInit): GraphRequest {\n\t\tfor (const key in headers) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(headers, key)) {\n\t\t\t\tthis._headers[key] = headers[key] as string;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the option for making a request\n\t * @param {string} key - The key value\n\t * @param {any} value - The value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic option(key: string, value: any): GraphRequest {\n\t\tthis._options[key] = value;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the options for making a request\n\t * @param {{ [key: string]: any }} options - The options key value pair\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic options(options: { [key: string]: any }): GraphRequest {\n\t\tfor (const key in options) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(options, key)) {\n\t\t\t\tthis._options[key] = options[key];\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the middleware options for a request\n\t * @param {MiddlewareOptions[]} options - The array of middleware options\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic middlewareOptions(options: MiddlewareOptions[]): GraphRequest {\n\t\tthis._middlewareOptions = options;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the api endpoint version for a request\n\t * @param {string} version - The version value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic version(version: string): GraphRequest {\n\t\tthis.urlComponents.version = version;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Sets the api endpoint version for a request\n\t * @param {ResponseType} responseType - The response type value\n\t * @returns The same GraphRequest instance that is being called with\n\t */\n\tpublic responseType(responseType: ResponseType): GraphRequest {\n\t\tthis._responseType = responseType;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for select OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query\n\t */\n\t/*\n\t * Accepts .select(\"displayName,birthday\")\n\t * and .select([\"displayName\", \"birthday\"])\n\t * and .select(\"displayName\", \"birthday\")\n\t *\n\t */\n\tpublic select(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$select\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for expand OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query\n\t */\n\tpublic expand(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$expand\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * To add properties for orderby OData Query param\n\t * @param {string|string[]} properties - The Properties value\n\t * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query\n\t */\n\tpublic orderby(properties: string | string[]): GraphRequest {\n\t\tthis.addCsvQueryParameter(\"$orderby\", properties, arguments);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} filterStr - The filter query string\n\t * @returns The same GraphRequest instance that is being called with, after adding the $filter query\n\t */\n\tpublic filter(filterStr: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$filter = filterStr;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} searchStr - The search criterion string\n\t * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria\n\t */\n\tpublic search(searchStr: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$search = searchStr;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {number} n - The number value\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for $top query\n\t */\n\tpublic top(n: number): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$top = n;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {number} n - The number value\n\t * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query\n\t */\n\tpublic skip(n: number): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$skip = n;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {string} token - The token value\n\t * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option\n\t */\n\tpublic skipToken(token: string): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$skipToken = token;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * 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.\n\t * @param {boolean} isCount - The count boolean\n\t * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option\n\t */\n\tpublic count(isCount = true): GraphRequest {\n\t\tthis.urlComponents.oDataQueryParams.$count = isCount.toString();\n\t\treturn this;\n\t}\n\n\t/**\n\t * @public\n\t * Appends query string to the urlComponent\n\t * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value\n\t * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component\n\t */\n\t/*\n\t * Accepts .query(\"displayName=xyz\")\n\t * and .select({ name: \"value\" })\n\t */\n\tpublic query(queryDictionaryOrString: string | KeyValuePairObjectStringNumber): GraphRequest {\n\t\treturn this.parseQueryParameter(queryDictionaryOrString);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the get response\n\t */\n\tpublic async get(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.GET,\n\t\t};\n\t\tconst response = await this.send(url, options, callback);\n\t\treturn response;\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with POST method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the post response\n\t */\n\tpublic async post(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.POST,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\tconst className: string = content && content.constructor && content.constructor.name;\n\t\tif (className === \"FormData\") {\n\t\t\t// Content-Type headers should not be specified in case the of FormData type content\n\t\t\toptions.headers = {};\n\t\t} else {\n\t\t\tthis.setHeaderContentType();\n\t\t\toptions.headers = this._headers;\n\t\t}\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for Post request call\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the post response\n\t */\n\tpublic async create(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.post(content, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with PUT method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the put response\n\t */\n\tpublic async put(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tthis.setHeaderContentType();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.PUT,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with PATCH method\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the patch response\n\t */\n\tpublic async patch(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tthis.setHeaderContentType();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.PATCH,\n\t\t\tbody: serializeContent(content),\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for PATCH request\n\t * @param {any} content - The content that needs to be sent with the request\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the patch response\n\t */\n\tpublic async update(content: any, callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.patch(content, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes http request with DELETE method\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the delete response\n\t */\n\tpublic async delete(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options: FetchOptions = {\n\t\t\tmethod: RequestMethod.DELETE,\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Alias for delete request call\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the delete response\n\t */\n\tpublic async del(callback?: GraphRequestCallback): Promise<any> {\n\t\treturn await this.delete(callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method to read response as a stream.\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the getStream response\n\t */\n\tpublic async getStream(callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options = {\n\t\t\tmethod: RequestMethod.GET,\n\t\t};\n\t\tthis.responseType(ResponseType.STREAM);\n\t\treturn await this.send(url, options, callback);\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * Makes a http request with GET method to read response as a stream.\n\t * @param {any} stream - The stream instance\n\t * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call\n\t * @returns A promise that resolves to the putStream response\n\t */\n\tpublic async putStream(stream: any, callback?: GraphRequestCallback): Promise<any> {\n\t\tconst url = this.buildFullUrl();\n\t\tconst options = {\n\t\t\tmethod: RequestMethod.PUT,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/octet-stream\",\n\t\t\t},\n\t\t\tbody: stream,\n\t\t};\n\t\treturn await this.send(url, options, callback);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPClient\n */\n\nimport { Context } from \"./IContext\";\nimport { Middleware } from \"./middleware/IMiddleware\";\n\n/**\n * @class\n * Class representing HTTPClient\n */\nexport class HTTPClient {\n\t/**\n\t * @private\n\t * A member holding first middleware of the middleware chain\n\t */\n\tprivate middleware: Middleware;\n\n\t/**\n\t * @public\n\t * @constructor\n\t * Creates an instance of a HTTPClient\n\t * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\n\t */\n\tpublic constructor(...middleware: Middleware[]) {\n\t\tif (!middleware || !middleware.length) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidMiddlewareChain\";\n\t\t\terror.message = \"Please provide a default middleware chain or custom middleware chain\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.setMiddleware(...middleware);\n\t}\n\n\t/**\n\t * @private\n\t * Processes the middleware parameter passed to set this.middleware property\n\t * The calling function should validate if middleware is not undefined or not empty.\n\t * @param {...Middleware} middleware - The middleware passed\n\t * @returns Nothing\n\t */\n\tprivate setMiddleware(...middleware: Middleware[]): void {\n\t\tif (middleware.length > 1) {\n\t\t\tthis.parseMiddleWareArray(middleware);\n\t\t} else {\n\t\t\tthis.middleware = middleware[0];\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t * Processes the middleware array to construct the chain\n\t * and sets this.middleware property to the first middleware handler of the array\n\t * The calling function should validate if middleware is not undefined or not empty\n\t * @param {Middleware[]} middlewareArray - The array of middleware handlers\n\t * @returns Nothing\n\t */\n\tprivate parseMiddleWareArray(middlewareArray: Middleware[]) {\n\t\tmiddlewareArray.forEach((element, index) => {\n\t\t\tif (index < middlewareArray.length - 1) {\n\t\t\t\telement.setNext(middlewareArray[index + 1]);\n\t\t\t}\n\t\t});\n\t\tthis.middleware = middlewareArray[0];\n\t}\n\n\t/**\n\t * @public\n\t * @async\n\t * To send the request through the middleware chain\n\t * @param {Context} context - The context of a request\n\t * @returns A promise that resolves to the Context\n\t */\n\tpublic async sendRequest(context: Context): Promise<Context> {\n\t\tif (typeof context.request === \"string\" && context.options === undefined) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidRequestOptions\";\n\t\t\terror.message = \"Unable to execute the middleware, Please provide valid options for a request\";\n\t\t\tthrow error;\n\t\t}\n\t\tawait this.middleware.execute(context);\n\t\treturn context;\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module HTTPClientFactory\n */\n\nimport { HTTPClient } from \"./HTTPClient\";\nimport { AuthenticationProvider } from \"./IAuthenticationProvider\";\nimport { AuthenticationHandler } from \"./middleware/AuthenticationHandler\";\nimport { HTTPMessageHandler } from \"./middleware/HTTPMessageHandler\";\nimport { Middleware } from \"./middleware/IMiddleware\";\nimport { RedirectHandlerOptions } from \"./middleware/options/RedirectHandlerOptions\";\nimport { RetryHandlerOptions } from \"./middleware/options/RetryHandlerOptions\";\nimport { RedirectHandler } from \"./middleware/RedirectHandler\";\nimport { RetryHandler } from \"./middleware/RetryHandler\";\nimport { TelemetryHandler } from \"./middleware/TelemetryHandler\";\n\n/**\n * @private\n * To check whether the environment is node or not\n * @returns A boolean representing the environment is node or not\n */\nconst isNodeEnvironment = (): boolean => {\n\treturn typeof process === \"object\" && typeof require === \"function\";\n};\n\n/**\n * @class\n * Class representing HTTPClientFactory\n */\nexport class HTTPClientFactory {\n\t/**\n\t * @public\n\t * @static\n\t * Creates HTTPClient with default middleware chain\n\t * @param {AuthenticationProvider} authProvider - The authentication provider instance\n\t * @returns A HTTPClient instance\n\t *\n\t * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline.\n\t * \t\t* HTTPMessageHandler should be the last one in the middleware pipeline, because this makes the actual network call of the request\n\t * \t\t* 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 \t*\t\t before making the actual network call ensures that the usage of all features are recorded in the flag.\n\t * \t\t* 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\n\t * \t\t 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.\n\t */\n\tpublic static createWithAuthenticationProvider(authProvider: AuthenticationProvider): HTTPClient {\n\t\tconst authenticationHandler = new AuthenticationHandler(authProvider);\n\t\tconst retryHandler = new RetryHandler(new RetryHandlerOptions());\n\t\tconst telemetryHandler = new TelemetryHandler();\n\t\tconst httpMessageHandler = new HTTPMessageHandler();\n\n\t\tauthenticationHandler.setNext(retryHandler);\n\t\tif (isNodeEnvironment()) {\n\t\t\tconst redirectHandler = new RedirectHandler(new RedirectHandlerOptions());\n\t\t\tretryHandler.setNext(redirectHandler);\n\t\t\tredirectHandler.setNext(telemetryHandler);\n\t\t} else {\n\t\t\tretryHandler.setNext(telemetryHandler);\n\t\t}\n\t\ttelemetryHandler.setNext(httpMessageHandler);\n\t\treturn HTTPClientFactory.createWithMiddleware(authenticationHandler);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * Creates a middleware chain with the given one\n\t * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers\n\t * @returns A HTTPClient instance\n\t */\n\tpublic static createWithMiddleware(...middleware: Middleware[]): HTTPClient {\n\t\t// Middleware should not empty or undefined. This is check is present in the HTTPClient constructor.\n\t\treturn new HTTPClient(...middleware);\n\t}\n}\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @constant\n * @function\n * Validates availability of Promise and fetch in global context\n * @returns The true in case the Promise and fetch available, otherwise throws error\n */\n\nexport const validatePolyFilling = (): boolean => {\n\tif (typeof Promise === \"undefined\" && typeof fetch === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without Promise and fetch. So, please provide polyfill for them.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t} else if (typeof Promise === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without Promise. So, please provide polyfill for it.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t} else if (typeof fetch === \"undefined\") {\n\t\tconst error = new Error(\"Library cannot function without fetch. So, please provide polyfill for it.\");\n\t\terror.name = \"PolyFillNotAvailable\";\n\t\tthrow error;\n\t}\n\treturn true;\n};\n","/**\n * -------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.\n * See License in the project root for license information.\n * -------------------------------------------------------------------------------------------\n */\n\n/**\n * @module Client\n */\n\nimport { GRAPH_API_VERSION, GRAPH_BASE_URL } from \"./Constants\";\nimport { CustomAuthenticationProvider } from \"./CustomAuthenticationProvider\";\nimport { GraphRequest } from \"./GraphRequest\";\nimport { HTTPClient } from \"./HTTPClient\";\nimport { HTTPClientFactory } from \"./HTTPClientFactory\";\nimport { ClientOptions } from \"./IClientOptions\";\nimport { Options } from \"./IOptions\";\nimport { validatePolyFilling } from \"./ValidatePolyFilling\";\n\nexport class Client {\n\t/**\n\t * @private\n\t * A member which stores the Client instance options\n\t */\n\tprivate config: ClientOptions = {\n\t\tbaseUrl: GRAPH_BASE_URL,\n\t\tdebugLogging: false,\n\t\tdefaultVersion: GRAPH_API_VERSION,\n\t};\n\n\t/**\n\t * @private\n\t * A member which holds the HTTPClient instance\n\t */\n\tprivate httpClient: HTTPClient;\n\n\t/**\n\t * @public\n\t * @static\n\t * To create a client instance with options and initializes the default middleware chain\n\t * @param {Options} options - The options for client instance\n\t * @returns The Client instance\n\t */\n\tpublic static init(options: Options): Client {\n\t\tconst clientOptions: ClientOptions = {};\n\t\tfor (const i in options) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(options, i)) {\n\t\t\t\tclientOptions[i] = i === \"authProvider\" ? new CustomAuthenticationProvider(options[i]) : options[i];\n\t\t\t}\n\t\t}\n\t\treturn Client.initWithMiddleware(clientOptions);\n\t}\n\n\t/**\n\t * @public\n\t * @static\n\t * To create a client instance with the Client Options\n\t * @param {ClientOptions} clientOptions - The options object for initializing the client\n\t * @returns The Client instance\n\t */\n\tpublic static initWithMiddleware(clientOptions: ClientOptions): Client {\n\t\treturn new Client(clientOptions);\n\t}\n\n\t/**\n\t * @private\n\t * @constructor\n\t * Creates an instance of Client\n\t * @param {ClientOptions} clientOptions - The options to instantiate the client object\n\t */\n\tprivate constructor(clientOptions: ClientOptions) {\n\t\tvalidatePolyFilling();\n\t\tfor (const key in clientOptions) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(clientOptions, key)) {\n\t\t\t\tthis.config[key] = clientOptions[key];\n\t\t\t}\n\t\t}\n\t\tlet httpClient: HTTPClient;\n\t\tif (clientOptions.authProvider !== undefined && clientOptions.middleware !== undefined) {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"AmbiguityInInitialization\";\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both\";\n\t\t\tthrow error;\n\t\t} else if (clientOptions.authProvider !== undefined) {\n\t\t\thttpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider);\n\t\t} else if (clientOptions.middleware !== undefined) {\n\t\t\thttpClient = new HTTPClient(...[].concat(clientOptions.middleware));\n\t\t} else {\n\t\t\tconst error = new Error();\n\t\t\terror.name = \"InvalidMiddlewareChain\";\n\t\t\terror.message = \"Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.httpClient = httpClient;\n\t}\n\n\t/**\n\t * @public\n\t * Entry point to make requests\n\t * @param {string} path - The path string value\n\t * @returns The graph request instance\n\t */\n\tpublic api(path: string): GraphRequest {\n\t\treturn new GraphRequest(this.httpClient, this.config, path);\n\t}\n}\n","/**\n * Teams Adaptive Card converter for cross-platform cards.\n *\n * Converts CardElement to Microsoft Adaptive Cards format.\n * @see https://adaptivecards.io/\n */\n\nimport {\n createEmojiConverter,\n mapButtonStyle,\n cardToFallbackText as sharedCardToFallbackText,\n} from \"@chat-adapter/shared\";\nimport type {\n ActionsElement,\n ButtonElement,\n CardChild,\n CardElement,\n DividerElement,\n FieldsElement,\n ImageElement,\n LinkButtonElement,\n SectionElement,\n TableElement,\n TextElement,\n} from \"chat\";\nimport { cardChildToFallbackText } from \"chat\";\n\n/**\n * Convert emoji placeholders in text to Teams format.\n */\nconst convertEmoji = createEmojiConverter(\"teams\");\n\n// Adaptive Card types (simplified)\nexport interface AdaptiveCard {\n $schema: string;\n actions?: AdaptiveCardAction[];\n body: AdaptiveCardElement[];\n type: \"AdaptiveCard\";\n version: string;\n}\n\nexport interface AdaptiveCardElement {\n type: string;\n [key: string]: unknown;\n}\n\nexport interface AdaptiveCardAction {\n data?: Record<string, unknown>;\n style?: string;\n title: string;\n type: string;\n url?: string;\n}\n\nconst ADAPTIVE_CARD_SCHEMA =\n \"http://adaptivecards.io/schemas/adaptive-card.json\";\nconst ADAPTIVE_CARD_VERSION = \"1.4\";\n\n/**\n * Convert a CardElement to a Teams Adaptive Card.\n */\nexport function cardToAdaptiveCard(card: CardElement): AdaptiveCard {\n const body: AdaptiveCardElement[] = [];\n const actions: AdaptiveCardAction[] = [];\n\n // Add title as TextBlock\n if (card.title) {\n body.push({\n type: \"TextBlock\",\n text: convertEmoji(card.title),\n weight: \"bolder\",\n size: \"large\",\n wrap: true,\n });\n }\n\n // Add subtitle as TextBlock\n if (card.subtitle) {\n body.push({\n type: \"TextBlock\",\n text: convertEmoji(card.subtitle),\n isSubtle: true,\n wrap: true,\n });\n }\n\n // Add header image if present\n if (card.imageUrl) {\n body.push({\n type: \"Image\",\n url: card.imageUrl,\n size: \"stretch\",\n });\n }\n\n // Convert children\n for (const child of card.children) {\n const result = convertChildToAdaptive(child);\n body.push(...result.elements);\n actions.push(...result.actions);\n }\n\n const adaptiveCard: AdaptiveCard = {\n type: \"AdaptiveCard\",\n $schema: ADAPTIVE_CARD_SCHEMA,\n version: ADAPTIVE_CARD_VERSION,\n body,\n };\n\n if (actions.length > 0) {\n adaptiveCard.actions = actions;\n }\n\n return adaptiveCard;\n}\n\ninterface ConvertResult {\n actions: AdaptiveCardAction[];\n elements: AdaptiveCardElement[];\n}\n\n/**\n * Convert a card child element to Adaptive Card elements.\n */\nfunction convertChildToAdaptive(child: CardChild): ConvertResult {\n switch (child.type) {\n case \"text\":\n return { elements: [convertTextToElement(child)], actions: [] };\n case \"image\":\n return { elements: [convertImageToElement(child)], actions: [] };\n case \"divider\":\n return { elements: [convertDividerToElement(child)], actions: [] };\n case \"actions\":\n return convertActionsToElements(child);\n case \"section\":\n return convertSectionToElements(child);\n case \"fields\":\n return { elements: [convertFieldsToElement(child)], actions: [] };\n case \"link\":\n return {\n elements: [\n {\n type: \"TextBlock\",\n text: `[${convertEmoji(child.label)}](${child.url})`,\n wrap: true,\n },\n ],\n actions: [],\n };\n case \"table\":\n return { elements: [convertTableToElement(child)], actions: [] };\n default: {\n const text = cardChildToFallbackText(child);\n if (text) {\n return {\n elements: [{ type: \"TextBlock\", text, wrap: true }],\n actions: [],\n };\n }\n return { elements: [], actions: [] };\n }\n }\n}\n\nfunction convertTextToElement(element: TextElement): AdaptiveCardElement {\n const textBlock: AdaptiveCardElement = {\n type: \"TextBlock\",\n text: convertEmoji(element.content),\n wrap: true,\n };\n\n if (element.style === \"bold\") {\n textBlock.weight = \"bolder\";\n } else if (element.style === \"muted\") {\n textBlock.isSubtle = true;\n }\n\n return textBlock;\n}\n\nfunction convertImageToElement(element: ImageElement): AdaptiveCardElement {\n return {\n type: \"Image\",\n url: element.url,\n altText: element.alt || \"Image\",\n size: \"auto\",\n };\n}\n\nfunction convertDividerToElement(\n _element: DividerElement\n): AdaptiveCardElement {\n // Adaptive Cards don't have a native divider, use a separator container\n return {\n type: \"Container\",\n separator: true,\n items: [],\n };\n}\n\nfunction convertActionsToElements(element: ActionsElement): ConvertResult {\n // In Adaptive Cards, actions go at the card level, not inline\n const actions: AdaptiveCardAction[] = element.children\n .filter((child) => child.type === \"button\" || child.type === \"link-button\")\n .map((button) => {\n if (button.type === \"link-button\") {\n return convertLinkButtonToAction(button);\n }\n return convertButtonToAction(button);\n });\n\n return { elements: [], actions };\n}\n\nfunction convertButtonToAction(button: ButtonElement): AdaptiveCardAction {\n const action: AdaptiveCardAction = {\n type: \"Action.Submit\",\n title: convertEmoji(button.label),\n data: {\n actionId: button.id,\n value: button.value,\n },\n };\n\n const style = mapButtonStyle(button.style, \"teams\");\n if (style) {\n action.style = style;\n }\n\n return action;\n}\n\nfunction convertLinkButtonToAction(\n button: LinkButtonElement\n): AdaptiveCardAction {\n const action: AdaptiveCardAction = {\n type: \"Action.OpenUrl\",\n title: convertEmoji(button.label),\n url: button.url,\n };\n\n const style = mapButtonStyle(button.style, \"teams\");\n if (style) {\n action.style = style;\n }\n\n return action;\n}\n\nfunction convertSectionToElements(element: SectionElement): ConvertResult {\n const elements: AdaptiveCardElement[] = [];\n const actions: AdaptiveCardAction[] = [];\n\n // Wrap section in a container\n const containerItems: AdaptiveCardElement[] = [];\n\n for (const child of element.children) {\n const result = convertChildToAdaptive(child);\n containerItems.push(...result.elements);\n actions.push(...result.actions);\n }\n\n if (containerItems.length > 0) {\n elements.push({\n type: \"Container\",\n items: containerItems,\n });\n }\n\n return { elements, actions };\n}\n\nfunction convertTableToElement(element: TableElement): AdaptiveCardElement {\n // Adaptive Cards Table element\n const columns = element.headers.map((header) => ({\n type: \"Column\",\n width: \"stretch\",\n items: [\n {\n type: \"TextBlock\",\n text: convertEmoji(header),\n weight: \"bolder\",\n wrap: true,\n },\n ],\n }));\n\n const headerRow = {\n type: \"ColumnSet\",\n columns,\n };\n\n const dataRows = element.rows.map((row) => ({\n type: \"ColumnSet\",\n columns: row.map((cell) => ({\n type: \"Column\",\n width: \"stretch\",\n items: [\n {\n type: \"TextBlock\",\n text: convertEmoji(cell),\n wrap: true,\n },\n ],\n })),\n }));\n\n return {\n type: \"Container\",\n items: [headerRow, ...dataRows],\n };\n}\n\nfunction convertFieldsToElement(element: FieldsElement): AdaptiveCardElement {\n // Use FactSet for key-value pairs\n const facts = element.children.map((field) => ({\n title: convertEmoji(field.label),\n value: convertEmoji(field.value),\n }));\n\n return {\n type: \"FactSet\",\n facts,\n };\n}\n\n/**\n * Generate fallback text from a card element.\n * Used when adaptive cards aren't supported.\n */\nexport function cardToFallbackText(card: CardElement): string {\n return sharedCardToFallbackText(card, {\n boldFormat: \"**\",\n lineBreak: \"\\n\\n\",\n platform: \"teams\",\n });\n}\n","/**\n * Teams-specific format conversion using AST-based parsing.\n *\n * Teams supports a subset of HTML for formatting:\n * - Bold: <b> or <strong>\n * - Italic: <i> or <em>\n * - Strikethrough: <s> or <strike>\n * - Links: <a href=\"url\">text</a>\n * - Code: <pre> and <code>\n *\n * Teams also accepts standard markdown in most cases.\n */\n\nimport { escapeTableCell } from \"@chat-adapter/shared\";\nimport {\n type AdapterPostableMessage,\n BaseFormatConverter,\n type Content,\n getNodeChildren,\n isBlockquoteNode,\n isCodeNode,\n isDeleteNode,\n isEmphasisNode,\n isInlineCodeNode,\n isLinkNode,\n isListNode,\n isParagraphNode,\n isStrongNode,\n isTableNode,\n isTextNode,\n type MdastTable,\n parseMarkdown,\n type Root,\n} from \"chat\";\n\nexport class TeamsFormatConverter extends BaseFormatConverter {\n /**\n * Convert @mentions to Teams format in plain text.\n * @name → <at>name</at>\n */\n private convertMentionsToTeams(text: string): string {\n return text.replace(/@(\\w+)/g, \"<at>$1</at>\");\n }\n\n /**\n * Override renderPostable to convert @mentions in plain strings.\n */\n override renderPostable(message: AdapterPostableMessage): string {\n if (typeof message === \"string\") {\n return this.convertMentionsToTeams(message);\n }\n if (\"raw\" in message) {\n return this.convertMentionsToTeams(message.raw);\n }\n if (\"markdown\" in message) {\n return this.fromAst(parseMarkdown(message.markdown));\n }\n if (\"ast\" in message) {\n return this.fromAst(message.ast);\n }\n return \"\";\n }\n\n /**\n * Render an AST to Teams format.\n * Teams accepts standard markdown, so we just stringify cleanly.\n */\n fromAst(ast: Root): string {\n return this.fromAstWithNodeConverter(ast, (node) => this.nodeToTeams(node));\n }\n\n /**\n * Parse Teams message into an AST.\n * Converts Teams HTML/mentions to standard markdown format.\n */\n toAst(teamsText: string): Root {\n // Convert Teams HTML to markdown, then parse\n let markdown = teamsText;\n\n // Convert @mentions from Teams format: <at>Name</at> -> @Name\n markdown = markdown.replace(/<at>([^<]+)<\\/at>/gi, \"@$1\");\n\n // Convert HTML tags to markdown\n // Bold: <b>, <strong> -> **text**\n markdown = markdown.replace(\n /<(b|strong)>([^<]+)<\\/(b|strong)>/gi,\n \"**$2**\"\n );\n\n // Italic: <i>, <em> -> _text_\n markdown = markdown.replace(/<(i|em)>([^<]+)<\\/(i|em)>/gi, \"_$2_\");\n\n // Strikethrough: <s>, <strike> -> ~~text~~\n markdown = markdown.replace(\n /<(s|strike)>([^<]+)<\\/(s|strike)>/gi,\n \"~~$2~~\"\n );\n\n // Links: <a href=\"url\">text</a> -> [text](url)\n markdown = markdown.replace(\n /<a[^>]+href=\"([^\"]+)\"[^>]*>([^<]+)<\\/a>/gi,\n \"[$2]($1)\"\n );\n\n // Code: <code>text</code> -> `text`\n markdown = markdown.replace(/<code>([^<]+)<\\/code>/gi, \"`$1`\");\n\n // Pre: <pre>text</pre> -> ```text```\n markdown = markdown.replace(/<pre>([^<]+)<\\/pre>/gi, \"```\\n$1\\n```\");\n\n // Strip remaining HTML tags\n markdown = markdown.replace(/<[^>]+>/g, \"\");\n\n // Decode HTML entities\n markdown = markdown\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&amp;/g, \"&\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\");\n\n return parseMarkdown(markdown);\n }\n\n private nodeToTeams(node: Content): string {\n // Use type guards for type-safe node handling\n if (isParagraphNode(node)) {\n return getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n }\n\n if (isTextNode(node)) {\n // Convert @mentions to Teams format <at>mention</at>\n return node.value.replace(/@(\\w+)/g, \"<at>$1</at>\");\n }\n\n if (isStrongNode(node)) {\n // Teams supports **text** markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `**${content}**`;\n }\n\n if (isEmphasisNode(node)) {\n // Teams supports _text_ markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `_${content}_`;\n }\n\n if (isDeleteNode(node)) {\n // Teams supports ~~text~~ markdown\n const content = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n return `~~${content}~~`;\n }\n\n if (isInlineCodeNode(node)) {\n return `\\`${node.value}\\``;\n }\n\n if (isCodeNode(node)) {\n return `\\`\\`\\`${node.lang || \"\"}\\n${node.value}\\n\\`\\`\\``;\n }\n\n if (isLinkNode(node)) {\n const linkText = getNodeChildren(node)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n // Standard markdown link format\n return `[${linkText}](${node.url})`;\n }\n\n if (isBlockquoteNode(node)) {\n return getNodeChildren(node)\n .map((child) => `> ${this.nodeToTeams(child)}`)\n .join(\"\\n\");\n }\n\n if (isListNode(node)) {\n return this.renderList(node, 0, (child) => this.nodeToTeams(child));\n }\n\n if (node.type === \"break\") {\n return \"\\n\";\n }\n\n if (node.type === \"thematicBreak\") {\n return \"---\";\n }\n\n if (isTableNode(node)) {\n return this.tableToGfm(node);\n }\n\n return this.defaultNodeToText(node, (child) => this.nodeToTeams(child));\n }\n\n /**\n * Render an mdast table node as a GFM markdown table.\n * Teams renders markdown tables natively.\n */\n private tableToGfm(node: MdastTable): string {\n const rows: string[][] = [];\n for (const row of node.children) {\n const cells: string[] = [];\n for (const cell of row.children) {\n const cellContent = getNodeChildren(cell)\n .map((child) => this.nodeToTeams(child))\n .join(\"\");\n cells.push(cellContent);\n }\n rows.push(cells);\n }\n\n if (rows.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [];\n // Header row\n lines.push(`| ${rows[0].map(escapeTableCell).join(\" | \")} |`);\n // Separator\n const separators = rows[0].map(() => \"---\");\n lines.push(`| ${separators.join(\" | \")} |`);\n // Data rows\n for (let i = 1; i < rows.length; i++) {\n lines.push(`| ${rows[i].map(escapeTableCell).join(\" | \")} |`);\n }\n return lines.join(\"\\n\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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AAA,QACnC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK;AACtB,cAAM,aACJ,OAAO,IAAI,eAAe,WAAW,IAAI,aAAa;AACxD,cAAM,IAAI,sBAAsB,SAAS,UAAU;AAAA,MACrD;AAGA,UACE,eAAe,OACd,IAAI,WACH,OAAO,IAAI,YAAY,YACvB,IAAI,QAAQ,YAAY,EAAE,SAAS,YAAY,GACjD;AACA,cAAM,IAAI,gBAAgB,SAAS,SAAS;AAAA,MAC9C;AAGA,UAAI,IAAI,WAAW,OAAO,IAAI,YAAY,UAAU;AAClD,cAAM,IAAI;AAAA,UACR;AAAA,UACA,0BAA0B,SAAS,KAAK,IAAI,OAAO;AAAA,UACnD,iBAAiB,QAAQ,QAAQ;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAGA,UAAM,IAAI;AAAA,MACR;AAAA,MACA,0BAA0B,SAAS,KAAK,OAAO,KAAK,CAAC;AAAA,MACrD,iBAAiB,QAAQ,QAAQ;AAAA,IACnC;AAAA,EACF;AACF;AAEO,SAAS,mBACd,QACc;AACd,QAAM,QAAQ,QAAQ,SAAS,QAAQ,IAAI;AAC3C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,cAAc,QAAQ,eAAe,QAAQ,IAAI;AACvD,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,WAA+B;AAAA,IACnC;AAAA,IACA;AAAA,IACA,aAAa,QAAQ,eAAe,QAAQ,IAAI;AAAA,IAChD,SAAS,QAAQ;AAAA,IACjB,QAAQ,QAAQ,UAAU,IAAI,cAAc,MAAM,EAAE,MAAM,OAAO;AAAA,IACjE,UAAU,QAAQ;AAAA,EACpB;AACA,SAAO,IAAI,aAAa,QAAQ;AAClC;","names":["v","d","b","__assign","o","GraphClientError","TokenCredentialAuthenticationProvider","RequestMethod","FeatureUsageFlag","ChaosStrategy","ResponseType","DocumentType","ContentType","ContentTypeRegexStr","path","context"]}