@chat-adapter/teams 4.13.4 → 4.15.0

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 CHANGED
@@ -1,9 +1,3562 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
+
41
+ // ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
42
+ var tslib_es6_exports = {};
43
+ __export(tslib_es6_exports, {
44
+ __addDisposableResource: () => __addDisposableResource,
45
+ __assign: () => __assign,
46
+ __asyncDelegator: () => __asyncDelegator,
47
+ __asyncGenerator: () => __asyncGenerator,
48
+ __asyncValues: () => __asyncValues,
49
+ __await: () => __await,
50
+ __awaiter: () => __awaiter,
51
+ __classPrivateFieldGet: () => __classPrivateFieldGet,
52
+ __classPrivateFieldIn: () => __classPrivateFieldIn,
53
+ __classPrivateFieldSet: () => __classPrivateFieldSet,
54
+ __createBinding: () => __createBinding,
55
+ __decorate: () => __decorate,
56
+ __disposeResources: () => __disposeResources,
57
+ __esDecorate: () => __esDecorate,
58
+ __exportStar: () => __exportStar,
59
+ __extends: () => __extends,
60
+ __generator: () => __generator,
61
+ __importDefault: () => __importDefault,
62
+ __importStar: () => __importStar,
63
+ __makeTemplateObject: () => __makeTemplateObject,
64
+ __metadata: () => __metadata,
65
+ __param: () => __param,
66
+ __propKey: () => __propKey,
67
+ __read: () => __read,
68
+ __rest: () => __rest,
69
+ __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
70
+ __runInitializers: () => __runInitializers,
71
+ __setFunctionName: () => __setFunctionName,
72
+ __spread: () => __spread,
73
+ __spreadArray: () => __spreadArray,
74
+ __spreadArrays: () => __spreadArrays,
75
+ __values: () => __values,
76
+ default: () => tslib_es6_default
77
+ });
78
+ function __extends(d, b) {
79
+ if (typeof b !== "function" && b !== null)
80
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
81
+ extendStatics(d, b);
82
+ function __() {
83
+ this.constructor = d;
84
+ }
85
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
86
+ }
87
+ function __rest(s, e) {
88
+ var t = {};
89
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
90
+ t[p] = s[p];
91
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
92
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
93
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
94
+ t[p[i]] = s[p[i]];
95
+ }
96
+ return t;
97
+ }
98
+ function __decorate(decorators, target, key, desc) {
99
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
100
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
101
+ 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;
102
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
103
+ }
104
+ function __param(paramIndex, decorator) {
105
+ return function(target, key) {
106
+ decorator(target, key, paramIndex);
107
+ };
108
+ }
109
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
110
+ function accept(f) {
111
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
112
+ return f;
113
+ }
114
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
115
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
116
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
117
+ var _, done = false;
118
+ for (var i = decorators.length - 1; i >= 0; i--) {
119
+ var context = {};
120
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
121
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
122
+ context.addInitializer = function(f) {
123
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
124
+ extraInitializers.push(accept(f || null));
125
+ };
126
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
127
+ if (kind === "accessor") {
128
+ if (result === void 0) continue;
129
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
130
+ if (_ = accept(result.get)) descriptor.get = _;
131
+ if (_ = accept(result.set)) descriptor.set = _;
132
+ if (_ = accept(result.init)) initializers.unshift(_);
133
+ } else if (_ = accept(result)) {
134
+ if (kind === "field") initializers.unshift(_);
135
+ else descriptor[key] = _;
136
+ }
137
+ }
138
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
139
+ done = true;
140
+ }
141
+ function __runInitializers(thisArg, initializers, value) {
142
+ var useValue = arguments.length > 2;
143
+ for (var i = 0; i < initializers.length; i++) {
144
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
145
+ }
146
+ return useValue ? value : void 0;
147
+ }
148
+ function __propKey(x) {
149
+ return typeof x === "symbol" ? x : "".concat(x);
150
+ }
151
+ function __setFunctionName(f, name, prefix) {
152
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
153
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
154
+ }
155
+ function __metadata(metadataKey, metadataValue) {
156
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
157
+ }
158
+ function __awaiter(thisArg, _arguments, P, generator) {
159
+ function adopt(value) {
160
+ return value instanceof P ? value : new P(function(resolve) {
161
+ resolve(value);
162
+ });
163
+ }
164
+ return new (P || (P = Promise))(function(resolve, reject) {
165
+ function fulfilled(value) {
166
+ try {
167
+ step(generator.next(value));
168
+ } catch (e) {
169
+ reject(e);
170
+ }
171
+ }
172
+ function rejected(value) {
173
+ try {
174
+ step(generator["throw"](value));
175
+ } catch (e) {
176
+ reject(e);
177
+ }
178
+ }
179
+ function step(result) {
180
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
181
+ }
182
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
183
+ });
184
+ }
185
+ function __generator(thisArg, body) {
186
+ var _ = { label: 0, sent: function() {
187
+ if (t[0] & 1) throw t[1];
188
+ return t[1];
189
+ }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
190
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
191
+ return this;
192
+ }), g;
193
+ function verb(n) {
194
+ return function(v) {
195
+ return step([n, v]);
196
+ };
197
+ }
198
+ function step(op) {
199
+ if (f) throw new TypeError("Generator is already executing.");
200
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
201
+ 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;
202
+ if (y = 0, t) op = [op[0] & 2, t.value];
203
+ switch (op[0]) {
204
+ case 0:
205
+ case 1:
206
+ t = op;
207
+ break;
208
+ case 4:
209
+ _.label++;
210
+ return { value: op[1], done: false };
211
+ case 5:
212
+ _.label++;
213
+ y = op[1];
214
+ op = [0];
215
+ continue;
216
+ case 7:
217
+ op = _.ops.pop();
218
+ _.trys.pop();
219
+ continue;
220
+ default:
221
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
222
+ _ = 0;
223
+ continue;
224
+ }
225
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
226
+ _.label = op[1];
227
+ break;
228
+ }
229
+ if (op[0] === 6 && _.label < t[1]) {
230
+ _.label = t[1];
231
+ t = op;
232
+ break;
233
+ }
234
+ if (t && _.label < t[2]) {
235
+ _.label = t[2];
236
+ _.ops.push(op);
237
+ break;
238
+ }
239
+ if (t[2]) _.ops.pop();
240
+ _.trys.pop();
241
+ continue;
242
+ }
243
+ op = body.call(thisArg, _);
244
+ } catch (e) {
245
+ op = [6, e];
246
+ y = 0;
247
+ } finally {
248
+ f = t = 0;
249
+ }
250
+ if (op[0] & 5) throw op[1];
251
+ return { value: op[0] ? op[1] : void 0, done: true };
252
+ }
253
+ }
254
+ function __exportStar(m, o) {
255
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
256
+ }
257
+ function __values(o) {
258
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
259
+ if (m) return m.call(o);
260
+ if (o && typeof o.length === "number") return {
261
+ next: function() {
262
+ if (o && i >= o.length) o = void 0;
263
+ return { value: o && o[i++], done: !o };
264
+ }
265
+ };
266
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
267
+ }
268
+ function __read(o, n) {
269
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
270
+ if (!m) return o;
271
+ var i = m.call(o), r, ar = [], e;
272
+ try {
273
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
274
+ } catch (error) {
275
+ e = { error };
276
+ } finally {
277
+ try {
278
+ if (r && !r.done && (m = i["return"])) m.call(i);
279
+ } finally {
280
+ if (e) throw e.error;
281
+ }
282
+ }
283
+ return ar;
284
+ }
285
+ function __spread() {
286
+ for (var ar = [], i = 0; i < arguments.length; i++)
287
+ ar = ar.concat(__read(arguments[i]));
288
+ return ar;
289
+ }
290
+ function __spreadArrays() {
291
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
292
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
293
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
294
+ r[k] = a[j];
295
+ return r;
296
+ }
297
+ function __spreadArray(to, from, pack) {
298
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
299
+ if (ar || !(i in from)) {
300
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
301
+ ar[i] = from[i];
302
+ }
303
+ }
304
+ return to.concat(ar || Array.prototype.slice.call(from));
305
+ }
306
+ function __await(v) {
307
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
308
+ }
309
+ function __asyncGenerator(thisArg, _arguments, generator) {
310
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
311
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
312
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
313
+ return this;
314
+ }, i;
315
+ function awaitReturn(f) {
316
+ return function(v) {
317
+ return Promise.resolve(v).then(f, reject);
318
+ };
319
+ }
320
+ function verb(n, f) {
321
+ if (g[n]) {
322
+ i[n] = function(v) {
323
+ return new Promise(function(a, b) {
324
+ q.push([n, v, a, b]) > 1 || resume(n, v);
325
+ });
326
+ };
327
+ if (f) i[n] = f(i[n]);
328
+ }
329
+ }
330
+ function resume(n, v) {
331
+ try {
332
+ step(g[n](v));
333
+ } catch (e) {
334
+ settle(q[0][3], e);
335
+ }
336
+ }
337
+ function step(r) {
338
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
339
+ }
340
+ function fulfill(value) {
341
+ resume("next", value);
342
+ }
343
+ function reject(value) {
344
+ resume("throw", value);
345
+ }
346
+ function settle(f, v) {
347
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
348
+ }
349
+ }
350
+ function __asyncDelegator(o) {
351
+ var i, p;
352
+ return i = {}, verb("next"), verb("throw", function(e) {
353
+ throw e;
354
+ }), verb("return"), i[Symbol.iterator] = function() {
355
+ return this;
356
+ }, i;
357
+ function verb(n, f) {
358
+ i[n] = o[n] ? function(v) {
359
+ return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
360
+ } : f;
361
+ }
362
+ }
363
+ function __asyncValues(o) {
364
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
365
+ var m = o[Symbol.asyncIterator], i;
366
+ 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() {
367
+ return this;
368
+ }, i);
369
+ function verb(n) {
370
+ i[n] = o[n] && function(v) {
371
+ return new Promise(function(resolve, reject) {
372
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
373
+ });
374
+ };
375
+ }
376
+ function settle(resolve, reject, d, v) {
377
+ Promise.resolve(v).then(function(v2) {
378
+ resolve({ value: v2, done: d });
379
+ }, reject);
380
+ }
381
+ }
382
+ function __makeTemplateObject(cooked, raw) {
383
+ if (Object.defineProperty) {
384
+ Object.defineProperty(cooked, "raw", { value: raw });
385
+ } else {
386
+ cooked.raw = raw;
387
+ }
388
+ return cooked;
389
+ }
390
+ function __importStar(mod) {
391
+ if (mod && mod.__esModule) return mod;
392
+ var result = {};
393
+ if (mod != null) {
394
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
395
+ }
396
+ __setModuleDefault(result, mod);
397
+ return result;
398
+ }
399
+ function __importDefault(mod) {
400
+ return mod && mod.__esModule ? mod : { default: mod };
401
+ }
402
+ function __classPrivateFieldGet(receiver, state, kind, f) {
403
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
404
+ 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");
405
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
406
+ }
407
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
408
+ if (kind === "m") throw new TypeError("Private method is not writable");
409
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
410
+ 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");
411
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
412
+ }
413
+ function __classPrivateFieldIn(state, receiver) {
414
+ if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
415
+ return typeof state === "function" ? receiver === state : state.has(receiver);
416
+ }
417
+ function __addDisposableResource(env, value, async) {
418
+ if (value !== null && value !== void 0) {
419
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
420
+ var dispose, inner;
421
+ if (async) {
422
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
423
+ dispose = value[Symbol.asyncDispose];
424
+ }
425
+ if (dispose === void 0) {
426
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
427
+ dispose = value[Symbol.dispose];
428
+ if (async) inner = dispose;
429
+ }
430
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
431
+ if (inner) dispose = function() {
432
+ try {
433
+ inner.call(this);
434
+ } catch (e) {
435
+ return Promise.reject(e);
436
+ }
437
+ };
438
+ env.stack.push({ value, dispose, async });
439
+ } else if (async) {
440
+ env.stack.push({ async: true });
441
+ }
442
+ return value;
443
+ }
444
+ function __disposeResources(env) {
445
+ function fail(e) {
446
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
447
+ env.hasError = true;
448
+ }
449
+ var r, s = 0;
450
+ function next() {
451
+ while (r = env.stack.pop()) {
452
+ try {
453
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
454
+ if (r.dispose) {
455
+ var result = r.dispose.call(r.value);
456
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
457
+ fail(e);
458
+ return next();
459
+ });
460
+ } else s |= 1;
461
+ } catch (e) {
462
+ fail(e);
463
+ }
464
+ }
465
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
466
+ if (env.hasError) throw env.error;
467
+ }
468
+ return next();
469
+ }
470
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
471
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
472
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
473
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
474
+ });
475
+ }
476
+ return path;
477
+ }
478
+ var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
479
+ var init_tslib_es6 = __esm({
480
+ "../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"() {
481
+ "use strict";
482
+ extendStatics = function(d, b) {
483
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
484
+ d2.__proto__ = b2;
485
+ } || function(d2, b2) {
486
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
487
+ };
488
+ return extendStatics(d, b);
489
+ };
490
+ __assign = function() {
491
+ __assign = Object.assign || function __assign2(t) {
492
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
493
+ s = arguments[i];
494
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
495
+ }
496
+ return t;
497
+ };
498
+ return __assign.apply(this, arguments);
499
+ };
500
+ __createBinding = Object.create ? (function(o, m, k, k2) {
501
+ if (k2 === void 0) k2 = k;
502
+ var desc = Object.getOwnPropertyDescriptor(m, k);
503
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
504
+ desc = { enumerable: true, get: function() {
505
+ return m[k];
506
+ } };
507
+ }
508
+ Object.defineProperty(o, k2, desc);
509
+ }) : (function(o, m, k, k2) {
510
+ if (k2 === void 0) k2 = k;
511
+ o[k2] = m[k];
512
+ });
513
+ __setModuleDefault = Object.create ? (function(o, v) {
514
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
515
+ }) : function(o, v) {
516
+ o["default"] = v;
517
+ };
518
+ ownKeys = function(o) {
519
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
520
+ var ar = [];
521
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
522
+ return ar;
523
+ };
524
+ return ownKeys(o);
525
+ };
526
+ _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
527
+ var e = new Error(message);
528
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
529
+ };
530
+ tslib_es6_default = {
531
+ __extends,
532
+ __assign,
533
+ __rest,
534
+ __decorate,
535
+ __param,
536
+ __esDecorate,
537
+ __runInitializers,
538
+ __propKey,
539
+ __setFunctionName,
540
+ __metadata,
541
+ __awaiter,
542
+ __generator,
543
+ __createBinding,
544
+ __exportStar,
545
+ __values,
546
+ __read,
547
+ __spread,
548
+ __spreadArrays,
549
+ __spreadArray,
550
+ __await,
551
+ __asyncGenerator,
552
+ __asyncDelegator,
553
+ __asyncValues,
554
+ __makeTemplateObject,
555
+ __importStar,
556
+ __importDefault,
557
+ __classPrivateFieldGet,
558
+ __classPrivateFieldSet,
559
+ __classPrivateFieldIn,
560
+ __addDisposableResource,
561
+ __disposeResources,
562
+ __rewriteRelativeImportExtension
563
+ };
564
+ }
565
+ });
566
+
567
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphClientError.js
568
+ var require_GraphClientError = __commonJS({
569
+ "../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/src/GraphClientError.js"(exports) {
570
+ "use strict";
571
+ Object.defineProperty(exports, "__esModule", { value: true });
572
+ exports.GraphClientError = void 0;
573
+ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
574
+ var GraphClientError2 = (
575
+ /** @class */
576
+ (function(_super) {
577
+ tslib_1.__extends(GraphClientError3, _super);
578
+ function GraphClientError3(message) {
579
+ var _this = _super.call(this, message) || this;
580
+ Object.setPrototypeOf(_this, GraphClientError3.prototype);
581
+ return _this;
582
+ }
583
+ GraphClientError3.setGraphClientError = function(error) {
584
+ var graphClientError;
585
+ if (error instanceof Error) {
586
+ graphClientError = error;
587
+ } else {
588
+ graphClientError = new GraphClientError3();
589
+ graphClientError.customError = error;
590
+ }
591
+ return graphClientError;
592
+ };
593
+ return GraphClientError3;
594
+ })(Error)
595
+ );
596
+ exports.GraphClientError = GraphClientError2;
597
+ }
598
+ });
599
+
600
+ // ../../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/TokenCredentialAuthenticationProvider.js
601
+ var require_TokenCredentialAuthenticationProvider = __commonJS({
602
+ "../../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/TokenCredentialAuthenticationProvider.js"(exports) {
603
+ "use strict";
604
+ Object.defineProperty(exports, "__esModule", { value: true });
605
+ exports.TokenCredentialAuthenticationProvider = void 0;
606
+ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
607
+ var GraphClientError_1 = require_GraphClientError();
608
+ var TokenCredentialAuthenticationProvider2 = (
609
+ /** @class */
610
+ (function() {
611
+ function TokenCredentialAuthenticationProvider3(tokenCredential, authenticationProviderOptions) {
612
+ if (!tokenCredential) {
613
+ throw new GraphClientError_1.GraphClientError("Please pass a token credential object to the TokenCredentialAuthenticationProvider class constructor");
614
+ }
615
+ if (!authenticationProviderOptions) {
616
+ throw new GraphClientError_1.GraphClientError("Please pass the TokenCredentialAuthenticationProviderOptions with scopes to the TokenCredentialAuthenticationProvider class constructor");
617
+ }
618
+ this.authenticationProviderOptions = authenticationProviderOptions;
619
+ this.tokenCredential = tokenCredential;
620
+ }
621
+ TokenCredentialAuthenticationProvider3.prototype.getAccessToken = function() {
622
+ return tslib_1.__awaiter(this, void 0, void 0, function() {
623
+ var scopes, error, response;
624
+ return tslib_1.__generator(this, function(_a) {
625
+ switch (_a.label) {
626
+ case 0:
627
+ scopes = this.authenticationProviderOptions.scopes;
628
+ error = new GraphClientError_1.GraphClientError();
629
+ if (!scopes || scopes.length === 0) {
630
+ error.name = "Empty Scopes";
631
+ error.message = "Scopes cannot be empty, Please provide scopes";
632
+ throw error;
633
+ }
634
+ return [4, this.tokenCredential.getToken(scopes, this.authenticationProviderOptions.getTokenOptions)];
635
+ case 1:
636
+ response = _a.sent();
637
+ if (response) {
638
+ return [2, response.token];
639
+ }
640
+ error.message = "Cannot retrieve accessToken from the Token Credential object";
641
+ error.name = "Access token is undefined";
642
+ throw error;
643
+ }
644
+ });
645
+ });
646
+ };
647
+ return TokenCredentialAuthenticationProvider3;
648
+ })()
649
+ );
650
+ exports.TokenCredentialAuthenticationProvider = TokenCredentialAuthenticationProvider2;
651
+ }
652
+ });
653
+
654
+ // ../../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
655
+ var require_ITokenCredentialAuthenticationProviderOptions = __commonJS({
656
+ "../../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"(exports) {
657
+ "use strict";
658
+ Object.defineProperty(exports, "__esModule", { value: true });
659
+ }
660
+ });
661
+
662
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials/index.js
663
+ var require_azureTokenCredentials = __commonJS({
664
+ "../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials/index.js"(exports) {
665
+ "use strict";
666
+ Object.defineProperty(exports, "__esModule", { value: true });
667
+ var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
668
+ tslib_1.__exportStar(require_TokenCredentialAuthenticationProvider(), exports);
669
+ tslib_1.__exportStar(require_ITokenCredentialAuthenticationProviderOptions(), exports);
670
+ }
671
+ });
672
+
673
+ // src/index.ts
674
+ import { ClientSecretCredential } from "@azure/identity";
675
+
676
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/content/BatchRequestContent.js
677
+ init_tslib_es6();
678
+
679
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/RequestMethod.js
680
+ var RequestMethod;
681
+ (function(RequestMethod2) {
682
+ RequestMethod2["GET"] = "GET";
683
+ RequestMethod2["PATCH"] = "PATCH";
684
+ RequestMethod2["POST"] = "POST";
685
+ RequestMethod2["PUT"] = "PUT";
686
+ RequestMethod2["DELETE"] = "DELETE";
687
+ })(RequestMethod || (RequestMethod = {}));
688
+
689
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/content/BatchRequestContent.js
690
+ var BatchRequestContent = class _BatchRequestContent {
691
+ /**
692
+ * @private
693
+ * @static
694
+ * Validates the dependency chain of the requests
695
+ *
696
+ * Note:
697
+ * 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:
698
+ * 1. Parallel - no individual request states a dependency in the dependsOn property.
699
+ * 2. Serial - all individual requests depend on the previous individual request.
700
+ * 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.
701
+ * As JSON batching matures, these limitations will be removed.
702
+ * @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}
703
+ *
704
+ * @param {Map<string, BatchRequestStep>} requests - The map of requests.
705
+ * @returns The boolean indicating the validation status
706
+ */
707
+ static validateDependencies(requests) {
708
+ const isParallel = (reqs) => {
709
+ const iterator = reqs.entries();
710
+ let cur = iterator.next();
711
+ while (!cur.done) {
712
+ const curReq = cur.value[1];
713
+ if (curReq.dependsOn !== void 0 && curReq.dependsOn.length > 0) {
714
+ return false;
715
+ }
716
+ cur = iterator.next();
717
+ }
718
+ return true;
719
+ };
720
+ const isSerial = (reqs) => {
721
+ const iterator = reqs.entries();
722
+ let cur = iterator.next();
723
+ const firstRequest = cur.value[1];
724
+ if (firstRequest.dependsOn !== void 0 && firstRequest.dependsOn.length > 0) {
725
+ return false;
726
+ }
727
+ let prev = cur;
728
+ cur = iterator.next();
729
+ while (!cur.done) {
730
+ const curReq = cur.value[1];
731
+ if (curReq.dependsOn === void 0 || curReq.dependsOn.length !== 1 || curReq.dependsOn[0] !== prev.value[1].id) {
732
+ return false;
733
+ }
734
+ prev = cur;
735
+ cur = iterator.next();
736
+ }
737
+ return true;
738
+ };
739
+ const isSame = (reqs) => {
740
+ const iterator = reqs.entries();
741
+ let cur = iterator.next();
742
+ const firstRequest = cur.value[1];
743
+ let dependencyId;
744
+ if (firstRequest.dependsOn === void 0 || firstRequest.dependsOn.length === 0) {
745
+ dependencyId = firstRequest.id;
746
+ } else {
747
+ if (firstRequest.dependsOn.length === 1) {
748
+ const fDependencyId = firstRequest.dependsOn[0];
749
+ if (fDependencyId !== firstRequest.id && reqs.has(fDependencyId)) {
750
+ dependencyId = fDependencyId;
751
+ } else {
752
+ return false;
753
+ }
754
+ } else {
755
+ return false;
756
+ }
757
+ }
758
+ cur = iterator.next();
759
+ while (!cur.done) {
760
+ const curReq = cur.value[1];
761
+ if ((curReq.dependsOn === void 0 || curReq.dependsOn.length === 0) && dependencyId !== curReq.id) {
762
+ return false;
763
+ }
764
+ if (curReq.dependsOn !== void 0 && curReq.dependsOn.length !== 0) {
765
+ if (curReq.dependsOn.length === 1 && (curReq.id === dependencyId || curReq.dependsOn[0] !== dependencyId)) {
766
+ return false;
767
+ }
768
+ if (curReq.dependsOn.length > 1) {
769
+ return false;
770
+ }
771
+ }
772
+ cur = iterator.next();
773
+ }
774
+ return true;
775
+ };
776
+ if (requests.size === 0) {
777
+ const error = new Error("Empty requests map, Please provide at least one request.");
778
+ error.name = "Empty Requests Error";
779
+ throw error;
780
+ }
781
+ return isParallel(requests) || isSerial(requests) || isSame(requests);
782
+ }
783
+ /**
784
+ * @private
785
+ * @static
786
+ * @async
787
+ * Converts Request Object instance to a JSON
788
+ * @param {IsomorphicRequest} request - The IsomorphicRequest Object instance
789
+ * @returns A promise that resolves to JSON representation of a request
790
+ */
791
+ static getRequestData(request) {
792
+ return __awaiter(this, void 0, void 0, function* () {
793
+ const requestData = {
794
+ url: ""
795
+ };
796
+ const hasHttpRegex = new RegExp("^https?://");
797
+ requestData.url = hasHttpRegex.test(request.url) ? "/" + request.url.split(/.*?\/\/.*?\//)[1] : request.url;
798
+ requestData.method = request.method;
799
+ const headers = {};
800
+ request.headers.forEach((value, key) => {
801
+ headers[key] = value;
802
+ });
803
+ if (Object.keys(headers).length) {
804
+ requestData.headers = headers;
805
+ }
806
+ if (request.method === RequestMethod.PATCH || request.method === RequestMethod.POST || request.method === RequestMethod.PUT) {
807
+ requestData.body = yield _BatchRequestContent.getRequestBody(request);
808
+ }
809
+ return requestData;
810
+ });
811
+ }
812
+ /**
813
+ * @private
814
+ * @static
815
+ * @async
816
+ * Gets the body of a Request object instance
817
+ * @param {IsomorphicRequest} request - The IsomorphicRequest object instance
818
+ * @returns The Promise that resolves to a body value of a Request
819
+ */
820
+ static getRequestBody(request) {
821
+ return __awaiter(this, void 0, void 0, function* () {
822
+ let bodyParsed = false;
823
+ let body;
824
+ try {
825
+ const cloneReq = request.clone();
826
+ body = yield cloneReq.json();
827
+ bodyParsed = true;
828
+ } catch (e) {
829
+ }
830
+ if (!bodyParsed) {
831
+ try {
832
+ if (typeof Blob !== "undefined") {
833
+ const blob = yield request.blob();
834
+ const reader = new FileReader();
835
+ body = yield new Promise((resolve) => {
836
+ reader.addEventListener("load", () => {
837
+ const dataURL = reader.result;
838
+ const regex = new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$");
839
+ const segments = regex.exec(dataURL);
840
+ resolve(segments[4]);
841
+ }, false);
842
+ reader.readAsDataURL(blob);
843
+ });
844
+ } else if (typeof Buffer !== "undefined") {
845
+ const buffer = yield request.buffer();
846
+ body = buffer.toString("base64");
847
+ }
848
+ bodyParsed = true;
849
+ } catch (e) {
850
+ }
851
+ }
852
+ return body;
853
+ });
854
+ }
855
+ /**
856
+ * @public
857
+ * @constructor
858
+ * Constructs a BatchRequestContent instance
859
+ * @param {BatchRequestStep[]} [requests] - Array of requests value
860
+ * @returns An instance of a BatchRequestContent
861
+ */
862
+ constructor(requests) {
863
+ this.requests = /* @__PURE__ */ new Map();
864
+ if (typeof requests !== "undefined") {
865
+ const limit = _BatchRequestContent.requestLimit;
866
+ if (requests.length > limit) {
867
+ const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);
868
+ error.name = "Limit Exceeded Error";
869
+ throw error;
870
+ }
871
+ for (const req of requests) {
872
+ this.addRequest(req);
873
+ }
874
+ }
875
+ }
876
+ /**
877
+ * @public
878
+ * Adds a request to the batch request content
879
+ * @param {BatchRequestStep} request - The request value
880
+ * @returns The id of the added request
881
+ */
882
+ addRequest(request) {
883
+ const limit = _BatchRequestContent.requestLimit;
884
+ if (request.id === "") {
885
+ const error = new Error(`Id for a request is empty, Please provide an unique id`);
886
+ error.name = "Empty Id For Request";
887
+ throw error;
888
+ }
889
+ if (this.requests.size === limit) {
890
+ const error = new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${limit}`);
891
+ error.name = "Limit Exceeded Error";
892
+ throw error;
893
+ }
894
+ if (this.requests.has(request.id)) {
895
+ const error = new Error(`Adding request with duplicate id ${request.id}, Make the id of the requests unique`);
896
+ error.name = "Duplicate RequestId Error";
897
+ throw error;
898
+ }
899
+ this.requests.set(request.id, request);
900
+ return request.id;
901
+ }
902
+ /**
903
+ * @public
904
+ * Removes request from the batch payload and its dependencies from all dependents
905
+ * @param {string} requestId - The id of a request that needs to be removed
906
+ * @returns The boolean indicating removed status
907
+ */
908
+ removeRequest(requestId) {
909
+ const deleteStatus = this.requests.delete(requestId);
910
+ const iterator = this.requests.entries();
911
+ let cur = iterator.next();
912
+ while (!cur.done) {
913
+ const dependencies = cur.value[1].dependsOn;
914
+ if (typeof dependencies !== "undefined") {
915
+ const index = dependencies.indexOf(requestId);
916
+ if (index !== -1) {
917
+ dependencies.splice(index, 1);
918
+ }
919
+ if (dependencies.length === 0) {
920
+ delete cur.value[1].dependsOn;
921
+ }
922
+ }
923
+ cur = iterator.next();
924
+ }
925
+ return deleteStatus;
926
+ }
927
+ /**
928
+ * @public
929
+ * @async
930
+ * Serialize content from BatchRequestContent instance
931
+ * @returns The body content to make batch request
932
+ */
933
+ getContent() {
934
+ return __awaiter(this, void 0, void 0, function* () {
935
+ const requests = [];
936
+ const requestBody = {
937
+ requests
938
+ };
939
+ const iterator = this.requests.entries();
940
+ let cur = iterator.next();
941
+ if (cur.done) {
942
+ const error = new Error("No requests added yet, Please add at least one request.");
943
+ error.name = "Empty Payload";
944
+ throw error;
945
+ }
946
+ if (!_BatchRequestContent.validateDependencies(this.requests)) {
947
+ const error = new Error(`Invalid dependency found, Dependency should be:
948
+ 1. Parallel - no individual request states a dependency in the dependsOn property.
949
+ 2. Serial - all individual requests depend on the previous individual request.
950
+ 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.`);
951
+ error.name = "Invalid Dependency";
952
+ throw error;
953
+ }
954
+ while (!cur.done) {
955
+ const requestStep = cur.value[1];
956
+ const batchRequestData = yield _BatchRequestContent.getRequestData(requestStep.request);
957
+ if (batchRequestData.body !== void 0 && (batchRequestData.headers === void 0 || batchRequestData.headers["content-type"] === void 0)) {
958
+ const error = new Error(`Content-type header is not mentioned for request #${requestStep.id}, For request having body, Content-type header should be mentioned`);
959
+ error.name = "Invalid Content-type header";
960
+ throw error;
961
+ }
962
+ batchRequestData.id = requestStep.id;
963
+ if (requestStep.dependsOn !== void 0 && requestStep.dependsOn.length > 0) {
964
+ batchRequestData.dependsOn = requestStep.dependsOn;
965
+ }
966
+ requests.push(batchRequestData);
967
+ cur = iterator.next();
968
+ }
969
+ requestBody.requests = requests;
970
+ return requestBody;
971
+ });
972
+ }
973
+ /**
974
+ * @public
975
+ * Adds a dependency for a given dependent request
976
+ * @param {string} dependentId - The id of the dependent request
977
+ * @param {string} [dependencyId] - The id of the dependency request, if not specified the preceding request will be considered as a dependency
978
+ * @returns Nothing
979
+ */
980
+ addDependency(dependentId, dependencyId) {
981
+ if (!this.requests.has(dependentId)) {
982
+ const error = new Error(`Dependent ${dependentId} does not exists, Please check the id`);
983
+ error.name = "Invalid Dependent";
984
+ throw error;
985
+ }
986
+ if (typeof dependencyId !== "undefined" && !this.requests.has(dependencyId)) {
987
+ const error = new Error(`Dependency ${dependencyId} does not exists, Please check the id`);
988
+ error.name = "Invalid Dependency";
989
+ throw error;
990
+ }
991
+ if (typeof dependencyId !== "undefined") {
992
+ const dependent = this.requests.get(dependentId);
993
+ if (dependent.dependsOn === void 0) {
994
+ dependent.dependsOn = [];
995
+ }
996
+ if (dependent.dependsOn.indexOf(dependencyId) !== -1) {
997
+ const error = new Error(`Dependency ${dependencyId} is already added for the request ${dependentId}`);
998
+ error.name = "Duplicate Dependency";
999
+ throw error;
1000
+ }
1001
+ dependent.dependsOn.push(dependencyId);
1002
+ } else {
1003
+ const iterator = this.requests.entries();
1004
+ let prev;
1005
+ let cur = iterator.next();
1006
+ while (!cur.done && cur.value[1].id !== dependentId) {
1007
+ prev = cur;
1008
+ cur = iterator.next();
1009
+ }
1010
+ if (typeof prev !== "undefined") {
1011
+ const dId = prev.value[0];
1012
+ if (cur.value[1].dependsOn === void 0) {
1013
+ cur.value[1].dependsOn = [];
1014
+ }
1015
+ if (cur.value[1].dependsOn.indexOf(dId) !== -1) {
1016
+ const error = new Error(`Dependency ${dId} is already added for the request ${dependentId}`);
1017
+ error.name = "Duplicate Dependency";
1018
+ throw error;
1019
+ }
1020
+ cur.value[1].dependsOn.push(dId);
1021
+ } else {
1022
+ const error = new Error(`Can't add dependency ${dependencyId}, There is only a dependent request in the batch`);
1023
+ error.name = "Invalid Dependency Addition";
1024
+ throw error;
1025
+ }
1026
+ }
1027
+ }
1028
+ /**
1029
+ * @public
1030
+ * Removes a dependency for a given dependent request id
1031
+ * @param {string} dependentId - The id of the dependent request
1032
+ * @param {string} [dependencyId] - The id of the dependency request, if not specified will remove all the dependencies of that request
1033
+ * @returns The boolean indicating removed status
1034
+ */
1035
+ removeDependency(dependentId, dependencyId) {
1036
+ const request = this.requests.get(dependentId);
1037
+ if (typeof request === "undefined" || request.dependsOn === void 0 || request.dependsOn.length === 0) {
1038
+ return false;
1039
+ }
1040
+ if (typeof dependencyId !== "undefined") {
1041
+ const index = request.dependsOn.indexOf(dependencyId);
1042
+ if (index === -1) {
1043
+ return false;
1044
+ }
1045
+ request.dependsOn.splice(index, 1);
1046
+ return true;
1047
+ } else {
1048
+ delete request.dependsOn;
1049
+ return true;
1050
+ }
1051
+ }
1052
+ };
1053
+ BatchRequestContent.requestLimit = 20;
1054
+
1055
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/AuthenticationHandler.js
1056
+ init_tslib_es6();
1057
+
1058
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/Constants.js
1059
+ var GRAPH_API_VERSION = "v1.0";
1060
+ var GRAPH_BASE_URL = "https://graph.microsoft.com/";
1061
+ var GRAPH_URLS = /* @__PURE__ */ new Set(["graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"]);
1062
+
1063
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphClientError.js
1064
+ var GraphClientError = class _GraphClientError extends Error {
1065
+ /**
1066
+ * @public
1067
+ * @static
1068
+ * @async
1069
+ * To set the GraphClientError object
1070
+ * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request
1071
+ * @returns GraphClientError object set to the error passed
1072
+ */
1073
+ static setGraphClientError(error) {
1074
+ let graphClientError;
1075
+ if (error instanceof Error) {
1076
+ graphClientError = error;
1077
+ } else {
1078
+ graphClientError = new _GraphClientError();
1079
+ graphClientError.customError = error;
1080
+ }
1081
+ return graphClientError;
1082
+ }
1083
+ /**
1084
+ * @public
1085
+ * @constructor
1086
+ * Creates an instance of GraphClientError
1087
+ * @param {string} message? - Error message
1088
+ * @returns An instance of GraphClientError
1089
+ */
1090
+ constructor(message) {
1091
+ super(message);
1092
+ Object.setPrototypeOf(this, _GraphClientError.prototype);
1093
+ }
1094
+ };
1095
+
1096
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphRequestUtil.js
1097
+ var oDataQueryNames = ["$select", "$expand", "$orderby", "$filter", "$top", "$skip", "$skipToken", "$count"];
1098
+ var urlJoin = (urlSegments) => {
1099
+ const removePostSlash = (s) => s.replace(/\/+$/, "");
1100
+ const removePreSlash = (s) => s.replace(/^\/+/, "");
1101
+ const joiner = (pre, cur) => [removePostSlash(pre), removePreSlash(cur)].join("/");
1102
+ const parts = Array.prototype.slice.call(urlSegments);
1103
+ return parts.reduce(joiner);
1104
+ };
1105
+ var serializeContent = (content) => {
1106
+ const className = content && content.constructor && content.constructor.name;
1107
+ if (className === "Buffer" || className === "Blob" || className === "File" || className === "FormData" || typeof content === "string") {
1108
+ return content;
1109
+ }
1110
+ if (className === "ArrayBuffer") {
1111
+ content = Buffer.from(content);
1112
+ } else if (className === "Int8Array" || className === "Int16Array" || className === "Int32Array" || className === "Uint8Array" || className === "Uint16Array" || className === "Uint32Array" || className === "Uint8ClampedArray" || className === "Float32Array" || className === "Float64Array" || className === "DataView") {
1113
+ content = Buffer.from(content.buffer);
1114
+ } else {
1115
+ try {
1116
+ content = JSON.stringify(content);
1117
+ } catch (error) {
1118
+ throw new Error("Unable to stringify the content");
1119
+ }
1120
+ }
1121
+ return content;
1122
+ };
1123
+ var isGraphURL = (url) => {
1124
+ return isValidEndpoint(url);
1125
+ };
1126
+ var isCustomHost = (url, customHosts) => {
1127
+ customHosts.forEach((host) => isCustomHostValid(host));
1128
+ return isValidEndpoint(url, customHosts);
1129
+ };
1130
+ var isValidEndpoint = (url, allowedHosts = GRAPH_URLS) => {
1131
+ url = url.toLowerCase();
1132
+ if (url.indexOf("https://") !== -1) {
1133
+ url = url.replace("https://", "");
1134
+ const startofPortNoPos = url.indexOf(":");
1135
+ const endOfHostStrPos = url.indexOf("/");
1136
+ let hostName = "";
1137
+ if (endOfHostStrPos !== -1) {
1138
+ if (startofPortNoPos !== -1 && startofPortNoPos < endOfHostStrPos) {
1139
+ hostName = url.substring(0, startofPortNoPos);
1140
+ return allowedHosts.has(hostName);
1141
+ }
1142
+ hostName = url.substring(0, endOfHostStrPos);
1143
+ return allowedHosts.has(hostName);
1144
+ }
1145
+ }
1146
+ return false;
1147
+ };
1148
+ var isCustomHostValid = (host) => {
1149
+ if (host.indexOf("/") !== -1) {
1150
+ throw new GraphClientError("Please add only hosts or hostnames to the CustomHosts config. If the url is `http://example.com:3000/`, host is `example:3000`");
1151
+ }
1152
+ };
1153
+
1154
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/MiddlewareControl.js
1155
+ var MiddlewareControl = class {
1156
+ /**
1157
+ * @public
1158
+ * @constructor
1159
+ * Creates an instance of MiddlewareControl
1160
+ * @param {MiddlewareOptions[]} [middlewareOptions = []] - The array of middlewareOptions
1161
+ * @returns The instance of MiddlewareControl
1162
+ */
1163
+ constructor(middlewareOptions = []) {
1164
+ this.middlewareOptions = /* @__PURE__ */ new Map();
1165
+ for (const option of middlewareOptions) {
1166
+ const fn = option.constructor;
1167
+ this.middlewareOptions.set(fn, option);
1168
+ }
1169
+ }
1170
+ /**
1171
+ * @public
1172
+ * To get the middleware option using the class of the option
1173
+ * @param {Function} fn - The class of the strongly typed option class
1174
+ * @returns The middleware option
1175
+ * @example
1176
+ * // if you wanted to return the middleware option associated with this class (MiddlewareControl)
1177
+ * // call this function like this:
1178
+ * getMiddlewareOptions(MiddlewareControl)
1179
+ */
1180
+ getMiddlewareOptions(fn) {
1181
+ return this.middlewareOptions.get(fn);
1182
+ }
1183
+ /**
1184
+ * @public
1185
+ * To set the middleware options using the class of the option
1186
+ * @param {Function} fn - The class of the strongly typed option class
1187
+ * @param {MiddlewareOptions} option - The strongly typed middleware option
1188
+ * @returns nothing
1189
+ */
1190
+ setMiddlewareOptions(fn, option) {
1191
+ this.middlewareOptions.set(fn, option);
1192
+ }
1193
+ };
1194
+
1195
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/MiddlewareUtil.js
1196
+ init_tslib_es6();
1197
+ var generateUUID = () => {
1198
+ let uuid = "";
1199
+ for (let j = 0; j < 32; j++) {
1200
+ if (j === 8 || j === 12 || j === 16 || j === 20) {
1201
+ uuid += "-";
1202
+ }
1203
+ uuid += Math.floor(Math.random() * 16).toString(16);
1204
+ }
1205
+ return uuid;
1206
+ };
1207
+ var getRequestHeader = (request, options, key) => {
1208
+ let value = null;
1209
+ if (typeof Request !== "undefined" && request instanceof Request) {
1210
+ value = request.headers.get(key);
1211
+ } else if (typeof options !== "undefined" && options.headers !== void 0) {
1212
+ if (typeof Headers !== "undefined" && options.headers instanceof Headers) {
1213
+ value = options.headers.get(key);
1214
+ } else if (options.headers instanceof Array) {
1215
+ const headers = options.headers;
1216
+ for (let i = 0, l = headers.length; i < l; i++) {
1217
+ if (headers[i][0] === key) {
1218
+ value = headers[i][1];
1219
+ break;
1220
+ }
1221
+ }
1222
+ } else if (options.headers[key] !== void 0) {
1223
+ value = options.headers[key];
1224
+ }
1225
+ }
1226
+ return value;
1227
+ };
1228
+ var setRequestHeader = (request, options, key, value) => {
1229
+ if (typeof Request !== "undefined" && request instanceof Request) {
1230
+ request.headers.set(key, value);
1231
+ } else if (typeof options !== "undefined") {
1232
+ if (options.headers === void 0) {
1233
+ options.headers = new Headers({
1234
+ [key]: value
1235
+ });
1236
+ } else {
1237
+ if (typeof Headers !== "undefined" && options.headers instanceof Headers) {
1238
+ options.headers.set(key, value);
1239
+ } else if (options.headers instanceof Array) {
1240
+ let i = 0;
1241
+ const l = options.headers.length;
1242
+ for (; i < l; i++) {
1243
+ const header = options.headers[i];
1244
+ if (header[0] === key) {
1245
+ header[1] = value;
1246
+ break;
1247
+ }
1248
+ }
1249
+ if (i === l) {
1250
+ options.headers.push([key, value]);
1251
+ }
1252
+ } else {
1253
+ Object.assign(options.headers, { [key]: value });
1254
+ }
1255
+ }
1256
+ }
1257
+ };
1258
+ var appendRequestHeader = (request, options, key, value) => {
1259
+ if (typeof Request !== "undefined" && request instanceof Request) {
1260
+ request.headers.append(key, value);
1261
+ } else if (typeof options !== "undefined") {
1262
+ if (options.headers === void 0) {
1263
+ options.headers = new Headers({
1264
+ [key]: value
1265
+ });
1266
+ } else {
1267
+ if (typeof Headers !== "undefined" && options.headers instanceof Headers) {
1268
+ options.headers.append(key, value);
1269
+ } else if (options.headers instanceof Array) {
1270
+ options.headers.push([key, value]);
1271
+ } else if (options.headers === void 0) {
1272
+ options.headers = { [key]: value };
1273
+ } else if (options.headers[key] === void 0) {
1274
+ options.headers[key] = value;
1275
+ } else {
1276
+ options.headers[key] += `, ${value}`;
1277
+ }
1278
+ }
1279
+ }
1280
+ };
1281
+ var cloneRequestWithNewUrl = (newUrl, request) => __awaiter(void 0, void 0, void 0, function* () {
1282
+ const body = request.headers.get("Content-Type") ? yield request.blob() : yield Promise.resolve(void 0);
1283
+ const { method, headers, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal } = request;
1284
+ return new Request(newUrl, { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, signal });
1285
+ });
1286
+
1287
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/options/AuthenticationHandlerOptions.js
1288
+ var AuthenticationHandlerOptions = class {
1289
+ /**
1290
+ * @public
1291
+ * @constructor
1292
+ * To create an instance of AuthenticationHandlerOptions
1293
+ * @param {AuthenticationProvider} [authenticationProvider] - The authentication provider instance
1294
+ * @param {AuthenticationProviderOptions} [authenticationProviderOptions] - The authentication provider options instance
1295
+ * @returns An instance of AuthenticationHandlerOptions
1296
+ */
1297
+ constructor(authenticationProvider, authenticationProviderOptions) {
1298
+ this.authenticationProvider = authenticationProvider;
1299
+ this.authenticationProviderOptions = authenticationProviderOptions;
1300
+ }
1301
+ };
1302
+
1303
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/options/TelemetryHandlerOptions.js
1304
+ var FeatureUsageFlag;
1305
+ (function(FeatureUsageFlag2) {
1306
+ FeatureUsageFlag2[FeatureUsageFlag2["NONE"] = 0] = "NONE";
1307
+ FeatureUsageFlag2[FeatureUsageFlag2["REDIRECT_HANDLER_ENABLED"] = 1] = "REDIRECT_HANDLER_ENABLED";
1308
+ FeatureUsageFlag2[FeatureUsageFlag2["RETRY_HANDLER_ENABLED"] = 2] = "RETRY_HANDLER_ENABLED";
1309
+ FeatureUsageFlag2[FeatureUsageFlag2["AUTHENTICATION_HANDLER_ENABLED"] = 4] = "AUTHENTICATION_HANDLER_ENABLED";
1310
+ })(FeatureUsageFlag || (FeatureUsageFlag = {}));
1311
+ var TelemetryHandlerOptions = class _TelemetryHandlerOptions {
1312
+ constructor() {
1313
+ this.featureUsage = FeatureUsageFlag.NONE;
1314
+ }
1315
+ /**
1316
+ * @public
1317
+ * @static
1318
+ * To update the feature usage in the context object
1319
+ * @param {Context} context - The request context object containing middleware options
1320
+ * @param {FeatureUsageFlag} flag - The flag value
1321
+ * @returns nothing
1322
+ */
1323
+ static updateFeatureUsageFlag(context, flag) {
1324
+ let options;
1325
+ if (context.middlewareControl instanceof MiddlewareControl) {
1326
+ options = context.middlewareControl.getMiddlewareOptions(_TelemetryHandlerOptions);
1327
+ } else {
1328
+ context.middlewareControl = new MiddlewareControl();
1329
+ }
1330
+ if (typeof options === "undefined") {
1331
+ options = new _TelemetryHandlerOptions();
1332
+ context.middlewareControl.setMiddlewareOptions(_TelemetryHandlerOptions, options);
1333
+ }
1334
+ options.setFeatureUsage(flag);
1335
+ }
1336
+ /**
1337
+ * @private
1338
+ * To set the feature usage flag
1339
+ * @param {FeatureUsageFlag} flag - The flag value
1340
+ * @returns nothing
1341
+ */
1342
+ setFeatureUsage(flag) {
1343
+ this.featureUsage = this.featureUsage | flag;
1344
+ }
1345
+ /**
1346
+ * @public
1347
+ * To get the feature usage
1348
+ * @returns A feature usage flag as hexadecimal string
1349
+ */
1350
+ getFeatureUsage() {
1351
+ return this.featureUsage.toString(16);
1352
+ }
1353
+ };
1354
+
1355
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/AuthenticationHandler.js
1356
+ var AuthenticationHandler = class _AuthenticationHandler {
1357
+ /**
1358
+ * @public
1359
+ * @constructor
1360
+ * Creates an instance of AuthenticationHandler
1361
+ * @param {AuthenticationProvider} authenticationProvider - The authentication provider for the authentication handler
1362
+ */
1363
+ constructor(authenticationProvider) {
1364
+ this.authenticationProvider = authenticationProvider;
1365
+ }
1366
+ /**
1367
+ * @public
1368
+ * @async
1369
+ * To execute the current middleware
1370
+ * @param {Context} context - The context object of the request
1371
+ * @returns A Promise that resolves to nothing
1372
+ */
1373
+ execute(context) {
1374
+ return __awaiter(this, void 0, void 0, function* () {
1375
+ const url = typeof context.request === "string" ? context.request : context.request.url;
1376
+ if (isGraphURL(url) || context.customHosts && isCustomHost(url, context.customHosts)) {
1377
+ let options;
1378
+ if (context.middlewareControl instanceof MiddlewareControl) {
1379
+ options = context.middlewareControl.getMiddlewareOptions(AuthenticationHandlerOptions);
1380
+ }
1381
+ let authenticationProvider;
1382
+ let authenticationProviderOptions;
1383
+ if (options) {
1384
+ authenticationProvider = options.authenticationProvider;
1385
+ authenticationProviderOptions = options.authenticationProviderOptions;
1386
+ }
1387
+ if (!authenticationProvider) {
1388
+ authenticationProvider = this.authenticationProvider;
1389
+ }
1390
+ const token = yield authenticationProvider.getAccessToken(authenticationProviderOptions);
1391
+ const bearerKey = `Bearer ${token}`;
1392
+ appendRequestHeader(context.request, context.options, _AuthenticationHandler.AUTHORIZATION_HEADER, bearerKey);
1393
+ TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED);
1394
+ } else {
1395
+ if (context.options.headers) {
1396
+ delete context.options.headers[_AuthenticationHandler.AUTHORIZATION_HEADER];
1397
+ }
1398
+ }
1399
+ return yield this.nextMiddleware.execute(context);
1400
+ });
1401
+ }
1402
+ /**
1403
+ * @public
1404
+ * To set the next middleware in the chain
1405
+ * @param {Middleware} next - The middleware instance
1406
+ * @returns Nothing
1407
+ */
1408
+ setNext(next) {
1409
+ this.nextMiddleware = next;
1410
+ }
1411
+ };
1412
+ AuthenticationHandler.AUTHORIZATION_HEADER = "Authorization";
1413
+
1414
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/HTTPMessageHandler.js
1415
+ init_tslib_es6();
1416
+ var HTTPMessageHandler = class {
1417
+ /**
1418
+ * @public
1419
+ * @async
1420
+ * To execute the current middleware
1421
+ * @param {Context} context - The request context object
1422
+ * @returns A promise that resolves to nothing
1423
+ */
1424
+ execute(context) {
1425
+ return __awaiter(this, void 0, void 0, function* () {
1426
+ context.response = yield fetch(context.request, context.options);
1427
+ });
1428
+ }
1429
+ };
1430
+
1431
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/RetryHandler.js
1432
+ init_tslib_es6();
1433
+
1434
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/options/RetryHandlerOptions.js
1435
+ var RetryHandlerOptions = class _RetryHandlerOptions {
1436
+ /**
1437
+ * @public
1438
+ * @constructor
1439
+ * To create an instance of RetryHandlerOptions
1440
+ * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds
1441
+ * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value
1442
+ * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function
1443
+ * @returns An instance of RetryHandlerOptions
1444
+ */
1445
+ constructor(delay = _RetryHandlerOptions.DEFAULT_DELAY, maxRetries = _RetryHandlerOptions.DEFAULT_MAX_RETRIES, shouldRetry = _RetryHandlerOptions.defaultShouldRetry) {
1446
+ if (delay > _RetryHandlerOptions.MAX_DELAY && maxRetries > _RetryHandlerOptions.MAX_MAX_RETRIES) {
1447
+ const error = new Error(`Delay and MaxRetries should not be more than ${_RetryHandlerOptions.MAX_DELAY} and ${_RetryHandlerOptions.MAX_MAX_RETRIES}`);
1448
+ error.name = "MaxLimitExceeded";
1449
+ throw error;
1450
+ } else if (delay > _RetryHandlerOptions.MAX_DELAY) {
1451
+ const error = new Error(`Delay should not be more than ${_RetryHandlerOptions.MAX_DELAY}`);
1452
+ error.name = "MaxLimitExceeded";
1453
+ throw error;
1454
+ } else if (maxRetries > _RetryHandlerOptions.MAX_MAX_RETRIES) {
1455
+ const error = new Error(`MaxRetries should not be more than ${_RetryHandlerOptions.MAX_MAX_RETRIES}`);
1456
+ error.name = "MaxLimitExceeded";
1457
+ throw error;
1458
+ } else if (delay < 0 && maxRetries < 0) {
1459
+ const error = new Error(`Delay and MaxRetries should not be negative`);
1460
+ error.name = "MinExpectationNotMet";
1461
+ throw error;
1462
+ } else if (delay < 0) {
1463
+ const error = new Error(`Delay should not be negative`);
1464
+ error.name = "MinExpectationNotMet";
1465
+ throw error;
1466
+ } else if (maxRetries < 0) {
1467
+ const error = new Error(`MaxRetries should not be negative`);
1468
+ error.name = "MinExpectationNotMet";
1469
+ throw error;
1470
+ }
1471
+ this.delay = Math.min(delay, _RetryHandlerOptions.MAX_DELAY);
1472
+ this.maxRetries = Math.min(maxRetries, _RetryHandlerOptions.MAX_MAX_RETRIES);
1473
+ this.shouldRetry = shouldRetry;
1474
+ }
1475
+ /**
1476
+ * @public
1477
+ * To get the maximum delay
1478
+ * @returns A maximum delay
1479
+ */
1480
+ getMaxDelay() {
1481
+ return _RetryHandlerOptions.MAX_DELAY;
1482
+ }
1483
+ };
1484
+ RetryHandlerOptions.DEFAULT_DELAY = 3;
1485
+ RetryHandlerOptions.DEFAULT_MAX_RETRIES = 3;
1486
+ RetryHandlerOptions.MAX_DELAY = 180;
1487
+ RetryHandlerOptions.MAX_MAX_RETRIES = 10;
1488
+ RetryHandlerOptions.defaultShouldRetry = () => true;
1489
+
1490
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/RetryHandler.js
1491
+ var RetryHandler = class _RetryHandler {
1492
+ /**
1493
+ * @public
1494
+ * @constructor
1495
+ * To create an instance of RetryHandler
1496
+ * @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value
1497
+ * @returns An instance of RetryHandler
1498
+ */
1499
+ constructor(options = new RetryHandlerOptions()) {
1500
+ this.options = options;
1501
+ }
1502
+ /**
1503
+ *
1504
+ * @private
1505
+ * To check whether the response has the retry status code
1506
+ * @param {Response} response - The response object
1507
+ * @returns Whether the response has retry status code or not
1508
+ */
1509
+ isRetry(response) {
1510
+ return _RetryHandler.RETRY_STATUS_CODES.indexOf(response.status) !== -1;
1511
+ }
1512
+ /**
1513
+ * @private
1514
+ * To check whether the payload is buffered or not
1515
+ * @param {RequestInfo} request - The url string or the request object value
1516
+ * @param {FetchOptions} options - The options of a request
1517
+ * @returns Whether the payload is buffered or not
1518
+ */
1519
+ isBuffered(request, options) {
1520
+ const method = typeof request === "string" ? options.method : request.method;
1521
+ const isPutPatchOrPost = method === RequestMethod.PUT || method === RequestMethod.PATCH || method === RequestMethod.POST;
1522
+ if (isPutPatchOrPost) {
1523
+ const isStream = getRequestHeader(request, options, "Content-Type") === "application/octet-stream";
1524
+ if (isStream) {
1525
+ return false;
1526
+ }
1527
+ }
1528
+ return true;
1529
+ }
1530
+ /**
1531
+ * @private
1532
+ * To get the delay for a retry
1533
+ * @param {Response} response - The response object
1534
+ * @param {number} retryAttempts - The current attempt count
1535
+ * @param {number} delay - The delay value in seconds
1536
+ * @returns A delay for a retry
1537
+ */
1538
+ getDelay(response, retryAttempts, delay) {
1539
+ const getRandomness = () => Number(Math.random().toFixed(3));
1540
+ const retryAfter = response.headers !== void 0 ? response.headers.get(_RetryHandler.RETRY_AFTER_HEADER) : null;
1541
+ let newDelay;
1542
+ if (retryAfter !== null) {
1543
+ if (Number.isNaN(Number(retryAfter))) {
1544
+ newDelay = Math.round((new Date(retryAfter).getTime() - Date.now()) / 1e3);
1545
+ } else {
1546
+ newDelay = Number(retryAfter);
1547
+ }
1548
+ } else {
1549
+ newDelay = retryAttempts >= 2 ? this.getExponentialBackOffTime(retryAttempts) + delay + getRandomness() : delay + getRandomness();
1550
+ }
1551
+ return Math.min(newDelay, this.options.getMaxDelay() + getRandomness());
1552
+ }
1553
+ /**
1554
+ * @private
1555
+ * To get an exponential back off value
1556
+ * @param {number} attempts - The current attempt count
1557
+ * @returns An exponential back off value
1558
+ */
1559
+ getExponentialBackOffTime(attempts) {
1560
+ return Math.round(1 / 2 * (Math.pow(2, attempts) - 1));
1561
+ }
1562
+ /**
1563
+ * @private
1564
+ * @async
1565
+ * To add delay for the execution
1566
+ * @param {number} delaySeconds - The delay value in seconds
1567
+ * @returns Nothing
1568
+ */
1569
+ sleep(delaySeconds) {
1570
+ return __awaiter(this, void 0, void 0, function* () {
1571
+ const delayMilliseconds = delaySeconds * 1e3;
1572
+ return new Promise((resolve) => setTimeout(resolve, delayMilliseconds));
1573
+ });
1574
+ }
1575
+ getOptions(context) {
1576
+ let options;
1577
+ if (context.middlewareControl instanceof MiddlewareControl) {
1578
+ options = context.middlewareControl.getMiddlewareOptions(this.options.constructor);
1579
+ }
1580
+ if (typeof options === "undefined") {
1581
+ options = Object.assign(new RetryHandlerOptions(), this.options);
1582
+ }
1583
+ return options;
1584
+ }
1585
+ /**
1586
+ * @private
1587
+ * @async
1588
+ * To execute the middleware with retries
1589
+ * @param {Context} context - The context object
1590
+ * @param {number} retryAttempts - The current attempt count
1591
+ * @param {RetryHandlerOptions} options - The retry middleware options instance
1592
+ * @returns A Promise that resolves to nothing
1593
+ */
1594
+ executeWithRetry(context, retryAttempts, options) {
1595
+ return __awaiter(this, void 0, void 0, function* () {
1596
+ yield this.nextMiddleware.execute(context);
1597
+ if (retryAttempts < options.maxRetries && this.isRetry(context.response) && this.isBuffered(context.request, context.options) && options.shouldRetry(options.delay, retryAttempts, context.request, context.options, context.response)) {
1598
+ ++retryAttempts;
1599
+ setRequestHeader(context.request, context.options, _RetryHandler.RETRY_ATTEMPT_HEADER, retryAttempts.toString());
1600
+ const delay = this.getDelay(context.response, retryAttempts, options.delay);
1601
+ yield this.sleep(delay);
1602
+ return yield this.executeWithRetry(context, retryAttempts, options);
1603
+ } else {
1604
+ return;
1605
+ }
1606
+ });
1607
+ }
1608
+ /**
1609
+ * @public
1610
+ * @async
1611
+ * To execute the current middleware
1612
+ * @param {Context} context - The context object of the request
1613
+ * @returns A Promise that resolves to nothing
1614
+ */
1615
+ execute(context) {
1616
+ return __awaiter(this, void 0, void 0, function* () {
1617
+ const retryAttempts = 0;
1618
+ const options = this.getOptions(context);
1619
+ TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.RETRY_HANDLER_ENABLED);
1620
+ return yield this.executeWithRetry(context, retryAttempts, options);
1621
+ });
1622
+ }
1623
+ /**
1624
+ * @public
1625
+ * To set the next middleware in the chain
1626
+ * @param {Middleware} next - The middleware instance
1627
+ * @returns Nothing
1628
+ */
1629
+ setNext(next) {
1630
+ this.nextMiddleware = next;
1631
+ }
1632
+ };
1633
+ RetryHandler.RETRY_STATUS_CODES = [
1634
+ 429,
1635
+ 503,
1636
+ 504
1637
+ // Gateway timeout
1638
+ ];
1639
+ RetryHandler.RETRY_ATTEMPT_HEADER = "Retry-Attempt";
1640
+ RetryHandler.RETRY_AFTER_HEADER = "Retry-After";
1641
+
1642
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/RedirectHandler.js
1643
+ init_tslib_es6();
1644
+
1645
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/options/RedirectHandlerOptions.js
1646
+ var RedirectHandlerOptions = class _RedirectHandlerOptions {
1647
+ /**
1648
+ * @public
1649
+ * @constructor
1650
+ * To create an instance of RedirectHandlerOptions
1651
+ * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value
1652
+ * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback
1653
+ * @returns An instance of RedirectHandlerOptions
1654
+ */
1655
+ constructor(maxRedirects = _RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS, shouldRedirect = _RedirectHandlerOptions.defaultShouldRedirect) {
1656
+ if (maxRedirects > _RedirectHandlerOptions.MAX_MAX_REDIRECTS) {
1657
+ const error = new Error(`MaxRedirects should not be more than ${_RedirectHandlerOptions.MAX_MAX_REDIRECTS}`);
1658
+ error.name = "MaxLimitExceeded";
1659
+ throw error;
1660
+ }
1661
+ if (maxRedirects < 0) {
1662
+ const error = new Error(`MaxRedirects should not be negative`);
1663
+ error.name = "MinExpectationNotMet";
1664
+ throw error;
1665
+ }
1666
+ this.maxRedirects = maxRedirects;
1667
+ this.shouldRedirect = shouldRedirect;
1668
+ }
1669
+ };
1670
+ RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS = 5;
1671
+ RedirectHandlerOptions.MAX_MAX_REDIRECTS = 20;
1672
+ RedirectHandlerOptions.defaultShouldRedirect = () => true;
1673
+
1674
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/RedirectHandler.js
1675
+ var RedirectHandler = class _RedirectHandler {
1676
+ /**
1677
+ * @public
1678
+ * @constructor
1679
+ * To create an instance of RedirectHandler
1680
+ * @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance
1681
+ * @returns An instance of RedirectHandler
1682
+ */
1683
+ constructor(options = new RedirectHandlerOptions()) {
1684
+ this.options = options;
1685
+ }
1686
+ /**
1687
+ * @private
1688
+ * To check whether the response has the redirect status code or not
1689
+ * @param {Response} response - The response object
1690
+ * @returns A boolean representing whether the response contains the redirect status code or not
1691
+ */
1692
+ isRedirect(response) {
1693
+ return _RedirectHandler.REDIRECT_STATUS_CODES.indexOf(response.status) !== -1;
1694
+ }
1695
+ /**
1696
+ * @private
1697
+ * To check whether the response has location header or not
1698
+ * @param {Response} response - The response object
1699
+ * @returns A boolean representing the whether the response has location header or not
1700
+ */
1701
+ hasLocationHeader(response) {
1702
+ return response.headers.has(_RedirectHandler.LOCATION_HEADER);
1703
+ }
1704
+ /**
1705
+ * @private
1706
+ * To get the redirect url from location header in response object
1707
+ * @param {Response} response - The response object
1708
+ * @returns A redirect url from location header
1709
+ */
1710
+ getLocationHeader(response) {
1711
+ return response.headers.get(_RedirectHandler.LOCATION_HEADER);
1712
+ }
1713
+ /**
1714
+ * @private
1715
+ * To check whether the given url is a relative url or not
1716
+ * @param {string} url - The url string value
1717
+ * @returns A boolean representing whether the given url is a relative url or not
1718
+ */
1719
+ isRelativeURL(url) {
1720
+ return url.indexOf("://") === -1;
1721
+ }
1722
+ /**
1723
+ * @private
1724
+ * To check whether the authorization header in the request should be dropped for consequent redirected requests
1725
+ * @param {string} requestUrl - The request url value
1726
+ * @param {string} redirectUrl - The redirect url value
1727
+ * @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests
1728
+ */
1729
+ shouldDropAuthorizationHeader(requestUrl, redirectUrl) {
1730
+ const schemeHostRegex = /^[A-Za-z].+?:\/\/.+?(?=\/|$)/;
1731
+ const requestMatches = schemeHostRegex.exec(requestUrl);
1732
+ let requestAuthority;
1733
+ let redirectAuthority;
1734
+ if (requestMatches !== null) {
1735
+ requestAuthority = requestMatches[0];
1736
+ }
1737
+ const redirectMatches = schemeHostRegex.exec(redirectUrl);
1738
+ if (redirectMatches !== null) {
1739
+ redirectAuthority = redirectMatches[0];
1740
+ }
1741
+ return typeof requestAuthority !== "undefined" && typeof redirectAuthority !== "undefined" && requestAuthority !== redirectAuthority;
1742
+ }
1743
+ /**
1744
+ * @private
1745
+ * @async
1746
+ * To update a request url with the redirect url
1747
+ * @param {string} redirectUrl - The redirect url value
1748
+ * @param {Context} context - The context object value
1749
+ * @returns Nothing
1750
+ */
1751
+ updateRequestUrl(redirectUrl, context) {
1752
+ return __awaiter(this, void 0, void 0, function* () {
1753
+ context.request = typeof context.request === "string" ? redirectUrl : yield cloneRequestWithNewUrl(redirectUrl, context.request);
1754
+ });
1755
+ }
1756
+ /**
1757
+ * @private
1758
+ * To get the options for execution of the middleware
1759
+ * @param {Context} context - The context object
1760
+ * @returns A options for middleware execution
1761
+ */
1762
+ getOptions(context) {
1763
+ let options;
1764
+ if (context.middlewareControl instanceof MiddlewareControl) {
1765
+ options = context.middlewareControl.getMiddlewareOptions(RedirectHandlerOptions);
1766
+ }
1767
+ if (typeof options === "undefined") {
1768
+ options = Object.assign(new RedirectHandlerOptions(), this.options);
1769
+ }
1770
+ return options;
1771
+ }
1772
+ /**
1773
+ * @private
1774
+ * @async
1775
+ * To execute the next middleware and to handle in case of redirect response returned by the server
1776
+ * @param {Context} context - The context object
1777
+ * @param {number} redirectCount - The redirect count value
1778
+ * @param {RedirectHandlerOptions} options - The redirect handler options instance
1779
+ * @returns A promise that resolves to nothing
1780
+ */
1781
+ executeWithRedirect(context, redirectCount, options) {
1782
+ return __awaiter(this, void 0, void 0, function* () {
1783
+ yield this.nextMiddleware.execute(context);
1784
+ const response = context.response;
1785
+ if (redirectCount < options.maxRedirects && this.isRedirect(response) && this.hasLocationHeader(response) && options.shouldRedirect(response)) {
1786
+ ++redirectCount;
1787
+ if (response.status === _RedirectHandler.STATUS_CODE_SEE_OTHER) {
1788
+ context.options.method = RequestMethod.GET;
1789
+ delete context.options.body;
1790
+ } else {
1791
+ const redirectUrl = this.getLocationHeader(response);
1792
+ if (!this.isRelativeURL(redirectUrl) && this.shouldDropAuthorizationHeader(response.url, redirectUrl)) {
1793
+ delete context.options.headers[_RedirectHandler.AUTHORIZATION_HEADER];
1794
+ }
1795
+ yield this.updateRequestUrl(redirectUrl, context);
1796
+ }
1797
+ yield this.executeWithRedirect(context, redirectCount, options);
1798
+ } else {
1799
+ return;
1800
+ }
1801
+ });
1802
+ }
1803
+ /**
1804
+ * @public
1805
+ * @async
1806
+ * To execute the current middleware
1807
+ * @param {Context} context - The context object of the request
1808
+ * @returns A Promise that resolves to nothing
1809
+ */
1810
+ execute(context) {
1811
+ return __awaiter(this, void 0, void 0, function* () {
1812
+ const redirectCount = 0;
1813
+ const options = this.getOptions(context);
1814
+ context.options.redirect = _RedirectHandler.MANUAL_REDIRECT;
1815
+ TelemetryHandlerOptions.updateFeatureUsageFlag(context, FeatureUsageFlag.REDIRECT_HANDLER_ENABLED);
1816
+ return yield this.executeWithRedirect(context, redirectCount, options);
1817
+ });
1818
+ }
1819
+ /**
1820
+ * @public
1821
+ * To set the next middleware in the chain
1822
+ * @param {Middleware} next - The middleware instance
1823
+ * @returns Nothing
1824
+ */
1825
+ setNext(next) {
1826
+ this.nextMiddleware = next;
1827
+ }
1828
+ };
1829
+ RedirectHandler.REDIRECT_STATUS_CODES = [
1830
+ 301,
1831
+ 302,
1832
+ 303,
1833
+ 307,
1834
+ 308
1835
+ // Moved Permanently
1836
+ ];
1837
+ RedirectHandler.STATUS_CODE_SEE_OTHER = 303;
1838
+ RedirectHandler.LOCATION_HEADER = "Location";
1839
+ RedirectHandler.AUTHORIZATION_HEADER = "Authorization";
1840
+ RedirectHandler.MANUAL_REDIRECT = "manual";
1841
+
1842
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/TelemetryHandler.js
1843
+ init_tslib_es6();
1844
+
1845
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/Version.js
1846
+ var PACKAGE_VERSION = "3.0.7";
1847
+
1848
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/TelemetryHandler.js
1849
+ var TelemetryHandler = class _TelemetryHandler {
1850
+ /**
1851
+ * @public
1852
+ * @async
1853
+ * To execute the current middleware
1854
+ * @param {Context} context - The context object of the request
1855
+ * @returns A Promise that resolves to nothing
1856
+ */
1857
+ execute(context) {
1858
+ return __awaiter(this, void 0, void 0, function* () {
1859
+ const url = typeof context.request === "string" ? context.request : context.request.url;
1860
+ if (isGraphURL(url) || context.customHosts && isCustomHost(url, context.customHosts)) {
1861
+ let clientRequestId = getRequestHeader(context.request, context.options, _TelemetryHandler.CLIENT_REQUEST_ID_HEADER);
1862
+ if (!clientRequestId) {
1863
+ clientRequestId = generateUUID();
1864
+ setRequestHeader(context.request, context.options, _TelemetryHandler.CLIENT_REQUEST_ID_HEADER, clientRequestId);
1865
+ }
1866
+ let sdkVersionValue = `${_TelemetryHandler.PRODUCT_NAME}/${PACKAGE_VERSION}`;
1867
+ let options;
1868
+ if (context.middlewareControl instanceof MiddlewareControl) {
1869
+ options = context.middlewareControl.getMiddlewareOptions(TelemetryHandlerOptions);
1870
+ }
1871
+ if (options) {
1872
+ const featureUsage = options.getFeatureUsage();
1873
+ sdkVersionValue += ` (${_TelemetryHandler.FEATURE_USAGE_STRING}=${featureUsage})`;
1874
+ }
1875
+ appendRequestHeader(context.request, context.options, _TelemetryHandler.SDK_VERSION_HEADER, sdkVersionValue);
1876
+ } else {
1877
+ delete context.options.headers[_TelemetryHandler.CLIENT_REQUEST_ID_HEADER];
1878
+ delete context.options.headers[_TelemetryHandler.SDK_VERSION_HEADER];
1879
+ }
1880
+ return yield this.nextMiddleware.execute(context);
1881
+ });
1882
+ }
1883
+ /**
1884
+ * @public
1885
+ * To set the next middleware in the chain
1886
+ * @param {Middleware} next - The middleware instance
1887
+ * @returns Nothing
1888
+ */
1889
+ setNext(next) {
1890
+ this.nextMiddleware = next;
1891
+ }
1892
+ };
1893
+ TelemetryHandler.CLIENT_REQUEST_ID_HEADER = "client-request-id";
1894
+ TelemetryHandler.SDK_VERSION_HEADER = "SdkVersion";
1895
+ TelemetryHandler.PRODUCT_NAME = "graph-js";
1896
+ TelemetryHandler.FEATURE_USAGE_STRING = "featureUsage";
1897
+
1898
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/middleware/options/ChaosStrategy.js
1899
+ var ChaosStrategy;
1900
+ (function(ChaosStrategy2) {
1901
+ ChaosStrategy2[ChaosStrategy2["MANUAL"] = 0] = "MANUAL";
1902
+ ChaosStrategy2[ChaosStrategy2["RANDOM"] = 1] = "RANDOM";
1903
+ })(ChaosStrategy || (ChaosStrategy = {}));
1904
+
1905
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/LargeFileUploadTask.js
1906
+ init_tslib_es6();
1907
+
1908
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphResponseHandler.js
1909
+ init_tslib_es6();
1910
+
1911
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/ResponseType.js
1912
+ var ResponseType;
1913
+ (function(ResponseType2) {
1914
+ ResponseType2["ARRAYBUFFER"] = "arraybuffer";
1915
+ ResponseType2["BLOB"] = "blob";
1916
+ ResponseType2["DOCUMENT"] = "document";
1917
+ ResponseType2["JSON"] = "json";
1918
+ ResponseType2["RAW"] = "raw";
1919
+ ResponseType2["STREAM"] = "stream";
1920
+ ResponseType2["TEXT"] = "text";
1921
+ })(ResponseType || (ResponseType = {}));
1922
+
1923
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphResponseHandler.js
1924
+ var DocumentType;
1925
+ (function(DocumentType2) {
1926
+ DocumentType2["TEXT_HTML"] = "text/html";
1927
+ DocumentType2["TEXT_XML"] = "text/xml";
1928
+ DocumentType2["APPLICATION_XML"] = "application/xml";
1929
+ DocumentType2["APPLICATION_XHTML"] = "application/xhtml+xml";
1930
+ })(DocumentType || (DocumentType = {}));
1931
+ var ContentType;
1932
+ (function(ContentType2) {
1933
+ ContentType2["TEXT_PLAIN"] = "text/plain";
1934
+ ContentType2["APPLICATION_JSON"] = "application/json";
1935
+ })(ContentType || (ContentType = {}));
1936
+ var ContentTypeRegexStr;
1937
+ (function(ContentTypeRegexStr2) {
1938
+ ContentTypeRegexStr2["DOCUMENT"] = "^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$";
1939
+ ContentTypeRegexStr2["IMAGE"] = "^image\\/.+";
1940
+ })(ContentTypeRegexStr || (ContentTypeRegexStr = {}));
1941
+ var GraphResponseHandler = class _GraphResponseHandler {
1942
+ /**
1943
+ * @private
1944
+ * @static
1945
+ * To parse Document response
1946
+ * @param {Response} rawResponse - The response object
1947
+ * @param {DocumentType} type - The type to which the document needs to be parsed
1948
+ * @returns A promise that resolves to a document content
1949
+ */
1950
+ static parseDocumentResponse(rawResponse, type) {
1951
+ if (typeof DOMParser !== "undefined") {
1952
+ return new Promise((resolve, reject) => {
1953
+ rawResponse.text().then((xmlString) => {
1954
+ try {
1955
+ const parser = new DOMParser();
1956
+ const xmlDoc = parser.parseFromString(xmlString, type);
1957
+ resolve(xmlDoc);
1958
+ } catch (error) {
1959
+ reject(error);
1960
+ }
1961
+ });
1962
+ });
1963
+ } else {
1964
+ return Promise.resolve(rawResponse.body);
1965
+ }
1966
+ }
1967
+ /**
1968
+ * @private
1969
+ * @static
1970
+ * @async
1971
+ * To convert the native Response to response content
1972
+ * @param {Response} rawResponse - The response object
1973
+ * @param {ResponseType} [responseType] - The response type value
1974
+ * @returns A promise that resolves to the converted response content
1975
+ */
1976
+ static convertResponse(rawResponse, responseType) {
1977
+ return __awaiter(this, void 0, void 0, function* () {
1978
+ if (rawResponse.status === 204) {
1979
+ return Promise.resolve();
1980
+ }
1981
+ let responseValue;
1982
+ const contentType = rawResponse.headers.get("Content-type");
1983
+ switch (responseType) {
1984
+ case ResponseType.ARRAYBUFFER:
1985
+ responseValue = yield rawResponse.arrayBuffer();
1986
+ break;
1987
+ case ResponseType.BLOB:
1988
+ responseValue = yield rawResponse.blob();
1989
+ break;
1990
+ case ResponseType.DOCUMENT:
1991
+ responseValue = yield _GraphResponseHandler.parseDocumentResponse(rawResponse, DocumentType.TEXT_XML);
1992
+ break;
1993
+ case ResponseType.JSON:
1994
+ responseValue = yield rawResponse.json();
1995
+ break;
1996
+ case ResponseType.STREAM:
1997
+ responseValue = yield Promise.resolve(rawResponse.body);
1998
+ break;
1999
+ case ResponseType.TEXT:
2000
+ responseValue = yield rawResponse.text();
2001
+ break;
2002
+ default:
2003
+ if (contentType !== null) {
2004
+ const mimeType = contentType.split(";")[0];
2005
+ if (new RegExp(ContentTypeRegexStr.DOCUMENT).test(mimeType)) {
2006
+ responseValue = yield _GraphResponseHandler.parseDocumentResponse(rawResponse, mimeType);
2007
+ } else if (new RegExp(ContentTypeRegexStr.IMAGE).test(mimeType)) {
2008
+ responseValue = rawResponse.blob();
2009
+ } else if (mimeType === ContentType.TEXT_PLAIN) {
2010
+ responseValue = yield rawResponse.text();
2011
+ } else if (mimeType === ContentType.APPLICATION_JSON) {
2012
+ responseValue = yield rawResponse.json();
2013
+ } else {
2014
+ responseValue = Promise.resolve(rawResponse.body);
2015
+ }
2016
+ } else {
2017
+ responseValue = Promise.resolve(rawResponse.body);
2018
+ }
2019
+ break;
2020
+ }
2021
+ return responseValue;
2022
+ });
2023
+ }
2024
+ /**
2025
+ * @public
2026
+ * @static
2027
+ * @async
2028
+ * To get the parsed response
2029
+ * @param {Response} rawResponse - The response object
2030
+ * @param {ResponseType} [responseType] - The response type value
2031
+ * @param {GraphRequestCallback} [callback] - The graph request callback function
2032
+ * @returns The parsed response
2033
+ */
2034
+ static getResponse(rawResponse, responseType, callback) {
2035
+ return __awaiter(this, void 0, void 0, function* () {
2036
+ if (responseType === ResponseType.RAW) {
2037
+ return Promise.resolve(rawResponse);
2038
+ } else {
2039
+ const response = yield _GraphResponseHandler.convertResponse(rawResponse, responseType);
2040
+ if (rawResponse.ok) {
2041
+ if (typeof callback === "function") {
2042
+ callback(null, response);
2043
+ } else {
2044
+ return response;
2045
+ }
2046
+ } else {
2047
+ throw response;
2048
+ }
2049
+ }
2050
+ });
2051
+ }
2052
+ };
2053
+
2054
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/FileUploadTask/Range.js
2055
+ var Range = class {
2056
+ /**
2057
+ * @public
2058
+ * @constructor
2059
+ * Creates a range for given min and max values
2060
+ * @param {number} [minVal = -1] - The minimum value.
2061
+ * @param {number} [maxVal = -1] - The maximum value.
2062
+ * @returns An instance of a Range
2063
+ */
2064
+ constructor(minVal = -1, maxVal = -1) {
2065
+ this.minValue = minVal;
2066
+ this.maxValue = maxVal;
2067
+ }
2068
+ };
2069
+
2070
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/FileUploadTask/UploadResult.js
2071
+ var UploadResult = class _UploadResult {
2072
+ /**
2073
+ * @public
2074
+ * Get of the location value.
2075
+ * Location value is looked up in the response header
2076
+ */
2077
+ get location() {
2078
+ return this._location;
2079
+ }
2080
+ /**
2081
+ * @public
2082
+ * Set the location value
2083
+ * Location value is looked up in the response header
2084
+ */
2085
+ set location(location) {
2086
+ this._location = location;
2087
+ }
2088
+ /**
2089
+ * @public
2090
+ * Get The response body from the completed upload response
2091
+ */
2092
+ get responseBody() {
2093
+ return this._responseBody;
2094
+ }
2095
+ /**
2096
+ * @public
2097
+ * Set the response body from the completed upload response
2098
+ */
2099
+ set responseBody(responseBody) {
2100
+ this._responseBody = responseBody;
2101
+ }
2102
+ /**
2103
+ * @public
2104
+ * @param {responseBody} responsebody - The response body from the completed upload response
2105
+ * @param {location} location - The location value from the headers from the completed upload response
2106
+ */
2107
+ constructor(responseBody, location) {
2108
+ this._location = location;
2109
+ this._responseBody = responseBody;
2110
+ }
2111
+ /**
2112
+ * @public
2113
+ * @param {responseBody} responseBody - The response body from the completed upload response
2114
+ * @param {responseHeaders} responseHeaders - The headers from the completed upload response
2115
+ */
2116
+ static CreateUploadResult(responseBody, responseHeaders) {
2117
+ return new _UploadResult(responseBody, responseHeaders.get("location"));
2118
+ }
2119
+ };
2120
+
2121
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/LargeFileUploadTask.js
2122
+ var LargeFileUploadTask = class {
2123
+ /**
2124
+ * @public
2125
+ * @static
2126
+ * @async
2127
+ * Makes request to the server to create an upload session
2128
+ * @param {Client} client - The GraphClient instance
2129
+ * @param {string} requestUrl - The URL to create the upload session
2130
+ * @param {any} payload - The payload that needs to be sent
2131
+ * @param {KeyValuePairObjectStringNumber} headers - The headers that needs to be sent
2132
+ * @returns The promise that resolves to LargeFileUploadSession
2133
+ */
2134
+ static createUploadSession(client, requestUrl, payload, headers = {}) {
2135
+ return __awaiter(this, void 0, void 0, function* () {
2136
+ const session = yield client.api(requestUrl).headers(headers).post(payload);
2137
+ const largeFileUploadSession = {
2138
+ url: session.uploadUrl,
2139
+ expiry: new Date(session.expirationDateTime),
2140
+ isCancelled: false
2141
+ };
2142
+ return largeFileUploadSession;
2143
+ });
2144
+ }
2145
+ /**
2146
+ * @public
2147
+ * @constructor
2148
+ * Constructs a LargeFileUploadTask
2149
+ * @param {Client} client - The GraphClient instance
2150
+ * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded
2151
+ * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done
2152
+ * @param {LargeFileUploadTaskOptions} options - The upload task options
2153
+ * @returns An instance of LargeFileUploadTask
2154
+ */
2155
+ constructor(client, file, uploadSession, options = {}) {
2156
+ this.DEFAULT_FILE_SIZE = 5 * 1024 * 1024;
2157
+ this.client = client;
2158
+ if (!file.sliceFile) {
2159
+ throw new GraphClientError("Please pass the FileUpload object, StreamUpload object or any custom implementation of the FileObject interface");
2160
+ } else {
2161
+ this.file = file;
2162
+ }
2163
+ this.file = file;
2164
+ if (!options.rangeSize) {
2165
+ options.rangeSize = this.DEFAULT_FILE_SIZE;
2166
+ }
2167
+ this.options = options;
2168
+ this.uploadSession = uploadSession;
2169
+ this.nextRange = new Range(0, this.options.rangeSize - 1);
2170
+ }
2171
+ /**
2172
+ * @private
2173
+ * Parses given range string to the Range instance
2174
+ * @param {string[]} ranges - The ranges value
2175
+ * @returns The range instance
2176
+ */
2177
+ parseRange(ranges) {
2178
+ const rangeStr = ranges[0];
2179
+ if (typeof rangeStr === "undefined" || rangeStr === "") {
2180
+ return new Range();
2181
+ }
2182
+ const firstRange = rangeStr.split("-");
2183
+ const minVal = parseInt(firstRange[0], 10);
2184
+ let maxVal = parseInt(firstRange[1], 10);
2185
+ if (Number.isNaN(maxVal)) {
2186
+ maxVal = this.file.size - 1;
2187
+ }
2188
+ return new Range(minVal, maxVal);
2189
+ }
2190
+ /**
2191
+ * @private
2192
+ * Updates the expiration date and the next range
2193
+ * @param {UploadStatusResponse} response - The response of the upload status
2194
+ * @returns Nothing
2195
+ */
2196
+ updateTaskStatus(response) {
2197
+ this.uploadSession.expiry = new Date(response.expirationDateTime);
2198
+ this.nextRange = this.parseRange(response.nextExpectedRanges);
2199
+ }
2200
+ /**
2201
+ * @public
2202
+ * Gets next range that needs to be uploaded
2203
+ * @returns The range instance
2204
+ */
2205
+ getNextRange() {
2206
+ if (this.nextRange.minValue === -1) {
2207
+ return this.nextRange;
2208
+ }
2209
+ const minVal = this.nextRange.minValue;
2210
+ let maxValue = minVal + this.options.rangeSize - 1;
2211
+ if (maxValue >= this.file.size) {
2212
+ maxValue = this.file.size - 1;
2213
+ }
2214
+ return new Range(minVal, maxValue);
2215
+ }
2216
+ /**
2217
+ * @deprecated This function has been moved into FileObject interface.
2218
+ * @public
2219
+ * Slices the file content to the given range
2220
+ * @param {Range} range - The range value
2221
+ * @returns The sliced ArrayBuffer or Blob
2222
+ */
2223
+ sliceFile(range) {
2224
+ console.warn("The LargeFileUploadTask.sliceFile() function has been deprecated and moved into the FileObject interface.");
2225
+ if (this.file.content instanceof ArrayBuffer || this.file.content instanceof Blob || this.file.content instanceof Uint8Array) {
2226
+ return this.file.content.slice(range.minValue, range.maxValue + 1);
2227
+ }
2228
+ throw new GraphClientError("The LargeFileUploadTask.sliceFile() function expects only Blob, ArrayBuffer or Uint8Array file content. Please note that the sliceFile() function is deprecated.");
2229
+ }
2230
+ /**
2231
+ * @public
2232
+ * @async
2233
+ * Uploads file to the server in a sequential order by slicing the file
2234
+ * @returns The promise resolves to uploaded response
2235
+ */
2236
+ upload() {
2237
+ return __awaiter(this, void 0, void 0, function* () {
2238
+ const uploadEventHandlers = this.options && this.options.uploadEventHandlers;
2239
+ while (!this.uploadSession.isCancelled) {
2240
+ const nextRange = this.getNextRange();
2241
+ if (nextRange.maxValue === -1) {
2242
+ const err = new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file");
2243
+ err.name = "Invalid Session";
2244
+ throw err;
2245
+ }
2246
+ const fileSlice = yield this.file.sliceFile(nextRange);
2247
+ const rawResponse = yield this.uploadSliceGetRawResponse(fileSlice, nextRange, this.file.size);
2248
+ if (!rawResponse) {
2249
+ throw new GraphClientError("Something went wrong! Large file upload slice response is null.");
2250
+ }
2251
+ const responseBody = yield GraphResponseHandler.getResponse(rawResponse);
2252
+ if (rawResponse.status === 201 || rawResponse.status === 200 && responseBody.id) {
2253
+ this.reportProgress(uploadEventHandlers, nextRange);
2254
+ return UploadResult.CreateUploadResult(responseBody, rawResponse.headers);
2255
+ }
2256
+ const res = {
2257
+ expirationDateTime: responseBody.expirationDateTime || responseBody.ExpirationDateTime,
2258
+ nextExpectedRanges: responseBody.NextExpectedRanges || responseBody.nextExpectedRanges
2259
+ };
2260
+ this.updateTaskStatus(res);
2261
+ this.reportProgress(uploadEventHandlers, nextRange);
2262
+ }
2263
+ });
2264
+ }
2265
+ reportProgress(uploadEventHandlers, nextRange) {
2266
+ if (uploadEventHandlers && uploadEventHandlers.progress) {
2267
+ uploadEventHandlers.progress(nextRange, uploadEventHandlers.extraCallbackParam);
2268
+ }
2269
+ }
2270
+ /**
2271
+ * @public
2272
+ * @async
2273
+ * Uploads given slice to the server
2274
+ * @param {ArrayBuffer | Blob | File} fileSlice - The file slice
2275
+ * @param {Range} range - The range value
2276
+ * @param {number} totalSize - The total size of a complete file
2277
+ * @returns The response body of the upload slice result
2278
+ */
2279
+ uploadSlice(fileSlice, range, totalSize) {
2280
+ return __awaiter(this, void 0, void 0, function* () {
2281
+ return yield this.client.api(this.uploadSession.url).headers({
2282
+ "Content-Length": `${range.maxValue - range.minValue + 1}`,
2283
+ "Content-Range": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,
2284
+ "Content-Type": "application/octet-stream"
2285
+ }).put(fileSlice);
2286
+ });
2287
+ }
2288
+ /**
2289
+ * @public
2290
+ * @async
2291
+ * Uploads given slice to the server
2292
+ * @param {unknown} fileSlice - The file slice
2293
+ * @param {Range} range - The range value
2294
+ * @param {number} totalSize - The total size of a complete file
2295
+ * @returns The raw response of the upload slice result
2296
+ */
2297
+ uploadSliceGetRawResponse(fileSlice, range, totalSize) {
2298
+ return __awaiter(this, void 0, void 0, function* () {
2299
+ return yield this.client.api(this.uploadSession.url).headers({
2300
+ "Content-Length": `${range.maxValue - range.minValue + 1}`,
2301
+ "Content-Range": `bytes ${range.minValue}-${range.maxValue}/${totalSize}`,
2302
+ "Content-Type": "application/octet-stream"
2303
+ }).responseType(ResponseType.RAW).put(fileSlice);
2304
+ });
2305
+ }
2306
+ /**
2307
+ * @public
2308
+ * @async
2309
+ * Deletes upload session in the server
2310
+ * @returns The promise resolves to cancelled response
2311
+ */
2312
+ cancel() {
2313
+ return __awaiter(this, void 0, void 0, function* () {
2314
+ const cancelResponse = yield this.client.api(this.uploadSession.url).responseType(ResponseType.RAW).delete();
2315
+ if (cancelResponse.status === 204) {
2316
+ this.uploadSession.isCancelled = true;
2317
+ }
2318
+ return cancelResponse;
2319
+ });
2320
+ }
2321
+ /**
2322
+ * @public
2323
+ * @async
2324
+ * Gets status for the upload session
2325
+ * @returns The promise resolves to the status enquiry response
2326
+ */
2327
+ getStatus() {
2328
+ return __awaiter(this, void 0, void 0, function* () {
2329
+ const response = yield this.client.api(this.uploadSession.url).get();
2330
+ this.updateTaskStatus(response);
2331
+ return response;
2332
+ });
2333
+ }
2334
+ /**
2335
+ * @public
2336
+ * @async
2337
+ * Resumes upload session and continue uploading the file from the last sent range
2338
+ * @returns The promise resolves to the uploaded response
2339
+ */
2340
+ resume() {
2341
+ return __awaiter(this, void 0, void 0, function* () {
2342
+ yield this.getStatus();
2343
+ return yield this.upload();
2344
+ });
2345
+ }
2346
+ /**
2347
+ * @public
2348
+ * @async
2349
+ * Get the upload session information
2350
+ * @returns The large file upload session
2351
+ */
2352
+ getUploadSession() {
2353
+ return this.uploadSession;
2354
+ }
2355
+ };
2356
+
2357
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/OneDriveLargeFileUploadTask.js
2358
+ init_tslib_es6();
2359
+
2360
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/FileUploadTask/FileObjectClasses/FileUpload.js
2361
+ var FileUpload = class {
2362
+ /**
2363
+ * @public
2364
+ * @constructor
2365
+ * @param {ArrayBuffer | Blob | Uint8Array} content - The file to be uploaded
2366
+ * @param {string} name - The name of the file to be uploaded
2367
+ * @param {number} size - The total size of the file to be uploaded
2368
+ * @returns An instance of the FileUpload class
2369
+ */
2370
+ constructor(content, name, size) {
2371
+ this.content = content;
2372
+ this.name = name;
2373
+ this.size = size;
2374
+ if (!content || !name || !size) {
2375
+ throw new GraphClientError("Please provide the upload content, name of the file and size of the file");
2376
+ }
2377
+ }
2378
+ /**
2379
+ * @public
2380
+ * Slices the file content to the given range
2381
+ * @param {Range} range - The range value
2382
+ * @returns The sliced file part
2383
+ */
2384
+ sliceFile(range) {
2385
+ return this.content.slice(range.minValue, range.maxValue + 1);
2386
+ }
2387
+ };
2388
+
2389
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/OneDriveLargeFileUploadTaskUtil.js
2390
+ var DEFAULT_FILE_SIZE = 5 * 1024 * 1024;
2391
+ var roundTo320KB = (value) => {
2392
+ if (value > 320 * 1024) {
2393
+ value = Math.floor(value / (320 * 1024)) * 320 * 1024;
2394
+ }
2395
+ return value;
2396
+ };
2397
+ var getValidRangeSize = (rangeSize = DEFAULT_FILE_SIZE) => {
2398
+ const sixtyMB = 60 * 1024 * 1024;
2399
+ if (rangeSize > sixtyMB) {
2400
+ rangeSize = sixtyMB;
2401
+ }
2402
+ return roundTo320KB(rangeSize);
2403
+ };
2404
+
2405
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/tasks/OneDriveLargeFileUploadTask.js
2406
+ var OneDriveLargeFileUploadTask = class _OneDriveLargeFileUploadTask extends LargeFileUploadTask {
2407
+ /**
2408
+ * @private
2409
+ * @static
2410
+ * Constructs the create session url for Onedrive
2411
+ * @param {string} fileName - The name of the file
2412
+ * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload
2413
+ * @returns The constructed create session url
2414
+ */
2415
+ static constructCreateSessionUrl(fileName, path = _OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH) {
2416
+ fileName = fileName.trim();
2417
+ path = path.trim();
2418
+ if (path === "") {
2419
+ path = "/";
2420
+ }
2421
+ if (path[0] !== "/") {
2422
+ path = `/${path}`;
2423
+ }
2424
+ if (path[path.length - 1] !== "/") {
2425
+ path = `${path}/`;
2426
+ }
2427
+ return `/me/drive/root:${path.split("/").map((p) => encodeURIComponent(p)).join("/")}${encodeURIComponent(fileName)}:/createUploadSession`;
2428
+ }
2429
+ /**
2430
+ * @private
2431
+ * @static
2432
+ * Get file information
2433
+ * @param {Blob | Uint8Array | File} file - The file entity
2434
+ * @param {string} fileName - The file name
2435
+ * @returns {FileInfo} The file information
2436
+ */
2437
+ static getFileInfo(file, fileName) {
2438
+ let content;
2439
+ let size;
2440
+ if (typeof Blob !== "undefined" && file instanceof Blob) {
2441
+ content = new File([file], fileName);
2442
+ size = content.size;
2443
+ } else if (typeof File !== "undefined" && file instanceof File) {
2444
+ content = file;
2445
+ size = content.size;
2446
+ } else if (typeof Uint8Array !== "undefined" && file instanceof Uint8Array) {
2447
+ const b = file;
2448
+ size = b.byteLength;
2449
+ content = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);
2450
+ }
2451
+ return {
2452
+ content,
2453
+ size
2454
+ };
2455
+ }
2456
+ /**
2457
+ * @public
2458
+ * @static
2459
+ * @async
2460
+ * Creates a OneDriveLargeFileUploadTask
2461
+ * @param {Client} client - The GraphClient instance
2462
+ * @param {Blob | Uint8Array | File} file - File represented as Blob, Uint8Array or File
2463
+ * @param {OneDriveLargeFileUploadOptions} options - The options for upload task
2464
+ * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
2465
+ */
2466
+ static create(client, file, options) {
2467
+ return __awaiter(this, void 0, void 0, function* () {
2468
+ if (!client || !file || !options) {
2469
+ throw new GraphClientError("Please provide the Graph client instance, file object and OneDriveLargeFileUploadOptions value");
2470
+ }
2471
+ const fileName = options.fileName;
2472
+ const fileInfo = _OneDriveLargeFileUploadTask.getFileInfo(file, fileName);
2473
+ const fileObj = new FileUpload(fileInfo.content, fileName, fileInfo.size);
2474
+ return this.createTaskWithFileObject(client, fileObj, options);
2475
+ });
2476
+ }
2477
+ /**
2478
+ * @public
2479
+ * @static
2480
+ * @async
2481
+ * Creates a OneDriveLargeFileUploadTask
2482
+ * @param {Client} client - The GraphClient instance
2483
+ * @param {FileObject} fileObject - FileObject instance
2484
+ * @param {OneDriveLargeFileUploadOptions} options - The options for upload task
2485
+ * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
2486
+ */
2487
+ static createTaskWithFileObject(client, fileObject, options) {
2488
+ return __awaiter(this, void 0, void 0, function* () {
2489
+ if (!client || !fileObject || !options) {
2490
+ throw new GraphClientError("Please provide the Graph client instance, FileObject interface implementation and OneDriveLargeFileUploadOptions value");
2491
+ }
2492
+ const requestUrl = options.uploadSessionURL ? options.uploadSessionURL : _OneDriveLargeFileUploadTask.constructCreateSessionUrl(options.fileName, options.path);
2493
+ const uploadSessionPayload = {
2494
+ fileName: options.fileName,
2495
+ fileDescription: options.fileDescription,
2496
+ conflictBehavior: options.conflictBehavior
2497
+ };
2498
+ const session = yield _OneDriveLargeFileUploadTask.createUploadSession(client, requestUrl, uploadSessionPayload);
2499
+ const rangeSize = getValidRangeSize(options.rangeSize);
2500
+ return new _OneDriveLargeFileUploadTask(client, fileObject, session, {
2501
+ rangeSize,
2502
+ uploadEventHandlers: options.uploadEventHandlers
2503
+ });
2504
+ });
2505
+ }
2506
+ /**
2507
+ * @public
2508
+ * @static
2509
+ * @async
2510
+ * Makes request to the server to create an upload session
2511
+ * @param {Client} client - The GraphClient instance
2512
+ * @param {string} requestUrl - The URL to create the upload session
2513
+ * @param {string} payloadOptions - The payload option. Default conflictBehavior is 'rename'
2514
+ * @returns The promise that resolves to LargeFileUploadSession
2515
+ */
2516
+ static createUploadSession(client, requestUrl, payloadOptions) {
2517
+ const _super = Object.create(null, {
2518
+ createUploadSession: { get: () => super.createUploadSession }
2519
+ });
2520
+ return __awaiter(this, void 0, void 0, function* () {
2521
+ const payload = {
2522
+ item: {
2523
+ "@microsoft.graph.conflictBehavior": (payloadOptions === null || payloadOptions === void 0 ? void 0 : payloadOptions.conflictBehavior) || "rename",
2524
+ name: payloadOptions === null || payloadOptions === void 0 ? void 0 : payloadOptions.fileName,
2525
+ description: payloadOptions === null || payloadOptions === void 0 ? void 0 : payloadOptions.fileDescription
2526
+ }
2527
+ };
2528
+ return _super.createUploadSession.call(this, client, requestUrl, payload);
2529
+ });
2530
+ }
2531
+ /**
2532
+ * @public
2533
+ * @constructor
2534
+ * Constructs a OneDriveLargeFileUploadTask
2535
+ * @param {Client} client - The GraphClient instance
2536
+ * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded
2537
+ * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done
2538
+ * @param {LargeFileUploadTaskOptions} options - The upload task options
2539
+ * @returns An instance of OneDriveLargeFileUploadTask
2540
+ */
2541
+ constructor(client, file, uploadSession, options) {
2542
+ super(client, file, uploadSession, options);
2543
+ }
2544
+ /**
2545
+ * @public
2546
+ * Commits upload session to end uploading
2547
+ * @param {string} requestUrl - The URL to commit the upload session
2548
+ * @param {string} conflictBehavior - Conflict behaviour option. Default is 'rename'
2549
+ * @returns The promise resolves to committed response
2550
+ */
2551
+ commit(requestUrl, conflictBehavior = "rename") {
2552
+ return __awaiter(this, void 0, void 0, function* () {
2553
+ const payload = {
2554
+ name: this.file.name,
2555
+ "@microsoft.graph.conflictBehavior": conflictBehavior,
2556
+ "@microsoft.graph.sourceUrl": this.uploadSession.url
2557
+ };
2558
+ return yield this.client.api(requestUrl).put(payload);
2559
+ });
2560
+ }
2561
+ };
2562
+ OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH = "/";
2563
+
2564
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/CustomAuthenticationProvider.js
2565
+ init_tslib_es6();
2566
+ var CustomAuthenticationProvider = class {
2567
+ /**
2568
+ * @public
2569
+ * @constructor
2570
+ * Creates an instance of CustomAuthenticationProvider
2571
+ * @param {AuthProviderCallback} provider - An authProvider function
2572
+ * @returns An instance of CustomAuthenticationProvider
2573
+ */
2574
+ constructor(provider) {
2575
+ this.provider = provider;
2576
+ }
2577
+ /**
2578
+ * @public
2579
+ * @async
2580
+ * To get the access token
2581
+ * @returns The promise that resolves to an access token
2582
+ */
2583
+ getAccessToken() {
2584
+ return __awaiter(this, void 0, void 0, function* () {
2585
+ return new Promise((resolve, reject) => {
2586
+ this.provider((error, accessToken) => __awaiter(this, void 0, void 0, function* () {
2587
+ if (accessToken) {
2588
+ resolve(accessToken);
2589
+ } else {
2590
+ if (!error) {
2591
+ const invalidTokenMessage = "Access token is undefined or empty. Please provide a valid token. For more help - https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CustomAuthenticationProvider.md";
2592
+ error = new GraphClientError(invalidTokenMessage);
2593
+ }
2594
+ const err = yield GraphClientError.setGraphClientError(error);
2595
+ reject(err);
2596
+ }
2597
+ }));
2598
+ });
2599
+ });
2600
+ }
2601
+ };
2602
+
2603
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphRequest.js
2604
+ init_tslib_es6();
2605
+
2606
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphErrorHandler.js
2607
+ init_tslib_es6();
2608
+
2609
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphError.js
2610
+ var GraphError = class _GraphError extends Error {
2611
+ /**
2612
+ * @public
2613
+ * @constructor
2614
+ * Creates an instance of GraphError
2615
+ * @param {number} [statusCode = -1] - The status code of the error
2616
+ * @param {string} [message] - The message of the error
2617
+ * @param {Error} [baseError] - The base error
2618
+ * @returns An instance of GraphError
2619
+ */
2620
+ constructor(statusCode = -1, message, baseError) {
2621
+ super(message || baseError && baseError.message);
2622
+ Object.setPrototypeOf(this, _GraphError.prototype);
2623
+ this.statusCode = statusCode;
2624
+ this.code = null;
2625
+ this.requestId = null;
2626
+ this.date = /* @__PURE__ */ new Date();
2627
+ this.body = null;
2628
+ this.stack = baseError ? baseError.stack : this.stack;
2629
+ }
2630
+ };
2631
+
2632
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphErrorHandler.js
2633
+ var GraphErrorHandler = class _GraphErrorHandler {
2634
+ /**
2635
+ * @private
2636
+ * @static
2637
+ * Populates the GraphError instance with Error instance values
2638
+ * @param {Error} error - The error returned by graph service or some native error
2639
+ * @param {number} [statusCode] - The status code of the response
2640
+ * @returns The GraphError instance
2641
+ */
2642
+ static constructError(error, statusCode, rawResponse) {
2643
+ const gError = new GraphError(statusCode, "", error);
2644
+ if (error.name !== void 0) {
2645
+ gError.code = error.name;
2646
+ }
2647
+ gError.body = error.toString();
2648
+ gError.date = /* @__PURE__ */ new Date();
2649
+ gError.headers = rawResponse === null || rawResponse === void 0 ? void 0 : rawResponse.headers;
2650
+ return gError;
2651
+ }
2652
+ /**
2653
+ * @private
2654
+ * @static
2655
+ * @async
2656
+ * Populates the GraphError instance from the Error returned by graph service
2657
+ * @param {GraphAPIErrorResponse} graphError - The error possibly returned by graph service or some native error
2658
+ * @param {number} statusCode - The status code of the response
2659
+ * @returns A promise that resolves to GraphError instance
2660
+ *
2661
+ * Example error for https://graph.microsoft.com/v1.0/me/events?$top=3&$search=foo
2662
+ * {
2663
+ * "error": {
2664
+ * "code": "SearchEvents",
2665
+ * "message": "The parameter $search is not currently supported on the Events resource.",
2666
+ * "innerError": {
2667
+ * "request-id": "b31c83fd-944c-4663-aa50-5d9ceb367e19",
2668
+ * "date": "2016-11-17T18:37:45"
2669
+ * }
2670
+ * }
2671
+ * }
2672
+ */
2673
+ static constructErrorFromResponse(graphError, statusCode, rawResponse) {
2674
+ const error = graphError.error;
2675
+ const gError = new GraphError(statusCode, error.message);
2676
+ gError.code = error.code;
2677
+ if (error.innerError !== void 0) {
2678
+ gError.requestId = error.innerError["request-id"];
2679
+ gError.date = new Date(error.innerError.date);
2680
+ }
2681
+ gError.body = JSON.stringify(error);
2682
+ gError.headers = rawResponse === null || rawResponse === void 0 ? void 0 : rawResponse.headers;
2683
+ return gError;
2684
+ }
2685
+ /**
2686
+ * @public
2687
+ * @static
2688
+ * @async
2689
+ * To get the GraphError object
2690
+ * Reference - https://docs.microsoft.com/en-us/graph/errors
2691
+ * @param {any} [error = null] - The error returned by graph service or some native error
2692
+ * @param {number} [statusCode = -1] - The status code of the response
2693
+ * @param {GraphRequestCallback} [callback] - The graph request callback function
2694
+ * @returns A promise that resolves to GraphError instance
2695
+ */
2696
+ static getError(error = null, statusCode = -1, callback, rawResponse) {
2697
+ return __awaiter(this, void 0, void 0, function* () {
2698
+ let gError;
2699
+ if (error && error.error) {
2700
+ gError = _GraphErrorHandler.constructErrorFromResponse(error, statusCode, rawResponse);
2701
+ } else if (error instanceof Error) {
2702
+ gError = _GraphErrorHandler.constructError(error, statusCode, rawResponse);
2703
+ } else {
2704
+ gError = new GraphError(statusCode);
2705
+ gError.body = error;
2706
+ }
2707
+ if (typeof callback === "function") {
2708
+ callback(gError, null);
2709
+ } else {
2710
+ return gError;
2711
+ }
2712
+ });
2713
+ }
2714
+ };
2715
+
2716
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/GraphRequest.js
2717
+ var GraphRequest = class {
2718
+ /**
2719
+ * @public
2720
+ * @constructor
2721
+ * Creates an instance of GraphRequest
2722
+ * @param {HTTPClient} httpClient - The HTTPClient instance
2723
+ * @param {ClientOptions} config - The options for making request
2724
+ * @param {string} path - A path string
2725
+ */
2726
+ constructor(httpClient, config, path) {
2727
+ this.parsePath = (path2) => {
2728
+ if (path2.indexOf("https://") !== -1) {
2729
+ path2 = path2.replace("https://", "");
2730
+ const endOfHostStrPos = path2.indexOf("/");
2731
+ if (endOfHostStrPos !== -1) {
2732
+ this.urlComponents.host = "https://" + path2.substring(0, endOfHostStrPos);
2733
+ path2 = path2.substring(endOfHostStrPos + 1, path2.length);
2734
+ }
2735
+ const endOfVersionStrPos = path2.indexOf("/");
2736
+ if (endOfVersionStrPos !== -1) {
2737
+ this.urlComponents.version = path2.substring(0, endOfVersionStrPos);
2738
+ path2 = path2.substring(endOfVersionStrPos + 1, path2.length);
2739
+ }
2740
+ }
2741
+ if (path2.charAt(0) === "/") {
2742
+ path2 = path2.substr(1);
2743
+ }
2744
+ const queryStrPos = path2.indexOf("?");
2745
+ if (queryStrPos === -1) {
2746
+ this.urlComponents.path = path2;
2747
+ } else {
2748
+ this.urlComponents.path = path2.substr(0, queryStrPos);
2749
+ const queryParams = path2.substring(queryStrPos + 1, path2.length).split("&");
2750
+ for (const queryParam of queryParams) {
2751
+ this.parseQueryParameter(queryParam);
2752
+ }
2753
+ }
2754
+ };
2755
+ this.httpClient = httpClient;
2756
+ this.config = config;
2757
+ this.urlComponents = {
2758
+ host: this.config.baseUrl,
2759
+ version: this.config.defaultVersion,
2760
+ oDataQueryParams: {},
2761
+ otherURLQueryParams: {},
2762
+ otherURLQueryOptions: []
2763
+ };
2764
+ this._headers = {};
2765
+ this._options = {};
2766
+ this._middlewareOptions = [];
2767
+ this.parsePath(path);
2768
+ }
2769
+ /**
2770
+ * @private
2771
+ * Adds the query parameter as comma separated values
2772
+ * @param {string} propertyName - The name of a property
2773
+ * @param {string|string[]} propertyValue - The vale of a property
2774
+ * @param {IArguments} additionalProperties - The additional properties
2775
+ * @returns Nothing
2776
+ */
2777
+ addCsvQueryParameter(propertyName, propertyValue, additionalProperties) {
2778
+ this.urlComponents.oDataQueryParams[propertyName] = this.urlComponents.oDataQueryParams[propertyName] ? this.urlComponents.oDataQueryParams[propertyName] + "," : "";
2779
+ let allValues = [];
2780
+ if (additionalProperties.length > 1 && typeof propertyValue === "string") {
2781
+ allValues = Array.prototype.slice.call(additionalProperties);
2782
+ } else if (typeof propertyValue === "string") {
2783
+ allValues.push(propertyValue);
2784
+ } else {
2785
+ allValues = allValues.concat(propertyValue);
2786
+ }
2787
+ this.urlComponents.oDataQueryParams[propertyName] += allValues.join(",");
2788
+ }
2789
+ /**
2790
+ * @private
2791
+ * Builds the full url from the URLComponents to make a request
2792
+ * @returns The URL string that is qualified to make a request to graph endpoint
2793
+ */
2794
+ buildFullUrl() {
2795
+ const url = urlJoin([this.urlComponents.host, this.urlComponents.version, this.urlComponents.path]) + this.createQueryString();
2796
+ if (this.config.debugLogging) {
2797
+ console.log(url);
2798
+ }
2799
+ return url;
2800
+ }
2801
+ /**
2802
+ * @private
2803
+ * Builds the query string from the URLComponents
2804
+ * @returns The Constructed query string
2805
+ */
2806
+ createQueryString() {
2807
+ const urlComponents = this.urlComponents;
2808
+ const query = [];
2809
+ if (Object.keys(urlComponents.oDataQueryParams).length !== 0) {
2810
+ for (const property in urlComponents.oDataQueryParams) {
2811
+ if (Object.prototype.hasOwnProperty.call(urlComponents.oDataQueryParams, property)) {
2812
+ query.push(property + "=" + urlComponents.oDataQueryParams[property]);
2813
+ }
2814
+ }
2815
+ }
2816
+ if (Object.keys(urlComponents.otherURLQueryParams).length !== 0) {
2817
+ for (const property in urlComponents.otherURLQueryParams) {
2818
+ if (Object.prototype.hasOwnProperty.call(urlComponents.otherURLQueryParams, property)) {
2819
+ query.push(property + "=" + urlComponents.otherURLQueryParams[property]);
2820
+ }
2821
+ }
2822
+ }
2823
+ if (urlComponents.otherURLQueryOptions.length !== 0) {
2824
+ for (const str of urlComponents.otherURLQueryOptions) {
2825
+ query.push(str);
2826
+ }
2827
+ }
2828
+ return query.length > 0 ? "?" + query.join("&") : "";
2829
+ }
2830
+ /**
2831
+ * @private
2832
+ * Parses the query parameters to set the urlComponents property of the GraphRequest object
2833
+ * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query parameter
2834
+ * @returns The same GraphRequest instance that is being called with
2835
+ */
2836
+ parseQueryParameter(queryDictionaryOrString) {
2837
+ if (typeof queryDictionaryOrString === "string") {
2838
+ if (queryDictionaryOrString.charAt(0) === "?") {
2839
+ queryDictionaryOrString = queryDictionaryOrString.substring(1);
2840
+ }
2841
+ if (queryDictionaryOrString.indexOf("&") !== -1) {
2842
+ const queryParams = queryDictionaryOrString.split("&");
2843
+ for (const str of queryParams) {
2844
+ this.parseQueryParamenterString(str);
2845
+ }
2846
+ } else {
2847
+ this.parseQueryParamenterString(queryDictionaryOrString);
2848
+ }
2849
+ } else if (queryDictionaryOrString.constructor === Object) {
2850
+ for (const key in queryDictionaryOrString) {
2851
+ if (Object.prototype.hasOwnProperty.call(queryDictionaryOrString, key)) {
2852
+ this.setURLComponentsQueryParamater(key, queryDictionaryOrString[key]);
2853
+ }
2854
+ }
2855
+ }
2856
+ return this;
2857
+ }
2858
+ /**
2859
+ * @private
2860
+ * Parses the query parameter of string type to set the urlComponents property of the GraphRequest object
2861
+ * @param {string} queryParameter - the query parameters
2862
+ * returns nothing
2863
+ */
2864
+ parseQueryParamenterString(queryParameter) {
2865
+ if (this.isValidQueryKeyValuePair(queryParameter)) {
2866
+ const indexOfFirstEquals = queryParameter.indexOf("=");
2867
+ const paramKey = queryParameter.substring(0, indexOfFirstEquals);
2868
+ const paramValue = queryParameter.substring(indexOfFirstEquals + 1);
2869
+ this.setURLComponentsQueryParamater(paramKey, paramValue);
2870
+ } else {
2871
+ this.urlComponents.otherURLQueryOptions.push(queryParameter);
2872
+ }
2873
+ }
2874
+ /**
2875
+ * @private
2876
+ * Sets values into the urlComponents property of GraphRequest object.
2877
+ * @param {string} paramKey - the query parameter key
2878
+ * @param {string} paramValue - the query paramter value
2879
+ * @returns nothing
2880
+ */
2881
+ setURLComponentsQueryParamater(paramKey, paramValue) {
2882
+ if (oDataQueryNames.indexOf(paramKey) !== -1) {
2883
+ const currentValue = this.urlComponents.oDataQueryParams[paramKey];
2884
+ const isValueAppendable = currentValue && (paramKey === "$expand" || paramKey === "$select" || paramKey === "$orderby");
2885
+ this.urlComponents.oDataQueryParams[paramKey] = isValueAppendable ? currentValue + "," + paramValue : paramValue;
2886
+ } else {
2887
+ this.urlComponents.otherURLQueryParams[paramKey] = paramValue;
2888
+ }
2889
+ }
2890
+ /**
2891
+ * @private
2892
+ * Check if the query parameter string has a valid key-value structure
2893
+ * @param {string} queryString - the query parameter string. Example -> "name=value"
2894
+ * #returns true if the query string has a valid key-value structure else false
2895
+ */
2896
+ isValidQueryKeyValuePair(queryString) {
2897
+ const indexofFirstEquals = queryString.indexOf("=");
2898
+ if (indexofFirstEquals === -1) {
2899
+ return false;
2900
+ }
2901
+ const indexofOpeningParanthesis = queryString.indexOf("(");
2902
+ if (indexofOpeningParanthesis !== -1 && queryString.indexOf("(") < indexofFirstEquals) {
2903
+ return false;
2904
+ }
2905
+ return true;
2906
+ }
2907
+ /**
2908
+ * @private
2909
+ * Updates the custom headers and options for a request
2910
+ * @param {FetchOptions} options - The request options object
2911
+ * @returns Nothing
2912
+ */
2913
+ updateRequestOptions(options) {
2914
+ const optionsHeaders = Object.assign({}, options.headers);
2915
+ if (this.config.fetchOptions !== void 0) {
2916
+ const fetchOptions = Object.assign({}, this.config.fetchOptions);
2917
+ Object.assign(options, fetchOptions);
2918
+ if (typeof this.config.fetchOptions.headers !== void 0) {
2919
+ options.headers = Object.assign({}, this.config.fetchOptions.headers);
2920
+ }
2921
+ }
2922
+ Object.assign(options, this._options);
2923
+ if (options.headers !== void 0) {
2924
+ Object.assign(optionsHeaders, options.headers);
2925
+ }
2926
+ Object.assign(optionsHeaders, this._headers);
2927
+ options.headers = optionsHeaders;
2928
+ }
2929
+ /**
2930
+ * @private
2931
+ * @async
2932
+ * Adds the custom headers and options to the request and makes the HTTPClient send request call
2933
+ * @param {RequestInfo} request - The request url string or the Request object value
2934
+ * @param {FetchOptions} options - The options to make a request
2935
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
2936
+ * @returns A promise that resolves to the response content
2937
+ */
2938
+ send(request, options, callback) {
2939
+ var _a;
2940
+ return __awaiter(this, void 0, void 0, function* () {
2941
+ let rawResponse;
2942
+ const middlewareControl = new MiddlewareControl(this._middlewareOptions);
2943
+ this.updateRequestOptions(options);
2944
+ const customHosts = (_a = this.config) === null || _a === void 0 ? void 0 : _a.customHosts;
2945
+ try {
2946
+ const context = yield this.httpClient.sendRequest({
2947
+ request,
2948
+ options,
2949
+ middlewareControl,
2950
+ customHosts
2951
+ });
2952
+ rawResponse = context.response;
2953
+ const response = yield GraphResponseHandler.getResponse(rawResponse, this._responseType, callback);
2954
+ return response;
2955
+ } catch (error) {
2956
+ if (error instanceof GraphClientError) {
2957
+ throw error;
2958
+ }
2959
+ let statusCode;
2960
+ if (rawResponse) {
2961
+ statusCode = rawResponse.status;
2962
+ }
2963
+ const gError = yield GraphErrorHandler.getError(error, statusCode, callback, rawResponse);
2964
+ throw gError;
2965
+ }
2966
+ });
2967
+ }
2968
+ /**
2969
+ * @private
2970
+ * Checks if the content-type is present in the _headers property. If not present, defaults the content-type to application/json
2971
+ * @param none
2972
+ * @returns nothing
2973
+ */
2974
+ setHeaderContentType() {
2975
+ if (!this._headers) {
2976
+ this.header("Content-Type", "application/json");
2977
+ return;
2978
+ }
2979
+ const headerKeys = Object.keys(this._headers);
2980
+ for (const headerKey of headerKeys) {
2981
+ if (headerKey.toLowerCase() === "content-type") {
2982
+ return;
2983
+ }
2984
+ }
2985
+ this.header("Content-Type", "application/json");
2986
+ }
2987
+ /**
2988
+ * @public
2989
+ * Sets the custom header for a request
2990
+ * @param {string} headerKey - A header key
2991
+ * @param {string} headerValue - A header value
2992
+ * @returns The same GraphRequest instance that is being called with
2993
+ */
2994
+ header(headerKey, headerValue) {
2995
+ this._headers[headerKey] = headerValue;
2996
+ return this;
2997
+ }
2998
+ /**
2999
+ * @public
3000
+ * Sets the custom headers for a request
3001
+ * @param {KeyValuePairObjectStringNumber | HeadersInit} headers - The request headers
3002
+ * @returns The same GraphRequest instance that is being called with
3003
+ */
3004
+ headers(headers) {
3005
+ for (const key in headers) {
3006
+ if (Object.prototype.hasOwnProperty.call(headers, key)) {
3007
+ this._headers[key] = headers[key];
3008
+ }
3009
+ }
3010
+ return this;
3011
+ }
3012
+ /**
3013
+ * @public
3014
+ * Sets the option for making a request
3015
+ * @param {string} key - The key value
3016
+ * @param {any} value - The value
3017
+ * @returns The same GraphRequest instance that is being called with
3018
+ */
3019
+ option(key, value) {
3020
+ this._options[key] = value;
3021
+ return this;
3022
+ }
3023
+ /**
3024
+ * @public
3025
+ * Sets the options for making a request
3026
+ * @param {{ [key: string]: any }} options - The options key value pair
3027
+ * @returns The same GraphRequest instance that is being called with
3028
+ */
3029
+ options(options) {
3030
+ for (const key in options) {
3031
+ if (Object.prototype.hasOwnProperty.call(options, key)) {
3032
+ this._options[key] = options[key];
3033
+ }
3034
+ }
3035
+ return this;
3036
+ }
3037
+ /**
3038
+ * @public
3039
+ * Sets the middleware options for a request
3040
+ * @param {MiddlewareOptions[]} options - The array of middleware options
3041
+ * @returns The same GraphRequest instance that is being called with
3042
+ */
3043
+ middlewareOptions(options) {
3044
+ this._middlewareOptions = options;
3045
+ return this;
3046
+ }
3047
+ /**
3048
+ * @public
3049
+ * Sets the api endpoint version for a request
3050
+ * @param {string} version - The version value
3051
+ * @returns The same GraphRequest instance that is being called with
3052
+ */
3053
+ version(version) {
3054
+ this.urlComponents.version = version;
3055
+ return this;
3056
+ }
3057
+ /**
3058
+ * @public
3059
+ * Sets the api endpoint version for a request
3060
+ * @param {ResponseType} responseType - The response type value
3061
+ * @returns The same GraphRequest instance that is being called with
3062
+ */
3063
+ responseType(responseType) {
3064
+ this._responseType = responseType;
3065
+ return this;
3066
+ }
3067
+ /**
3068
+ * @public
3069
+ * To add properties for select OData Query param
3070
+ * @param {string|string[]} properties - The Properties value
3071
+ * @returns The same GraphRequest instance that is being called with, after adding the properties for $select query
3072
+ */
3073
+ /*
3074
+ * Accepts .select("displayName,birthday")
3075
+ * and .select(["displayName", "birthday"])
3076
+ * and .select("displayName", "birthday")
3077
+ *
3078
+ */
3079
+ select(properties) {
3080
+ this.addCsvQueryParameter("$select", properties, arguments);
3081
+ return this;
3082
+ }
3083
+ /**
3084
+ * @public
3085
+ * To add properties for expand OData Query param
3086
+ * @param {string|string[]} properties - The Properties value
3087
+ * @returns The same GraphRequest instance that is being called with, after adding the properties for $expand query
3088
+ */
3089
+ expand(properties) {
3090
+ this.addCsvQueryParameter("$expand", properties, arguments);
3091
+ return this;
3092
+ }
3093
+ /**
3094
+ * @public
3095
+ * To add properties for orderby OData Query param
3096
+ * @param {string|string[]} properties - The Properties value
3097
+ * @returns The same GraphRequest instance that is being called with, after adding the properties for $orderby query
3098
+ */
3099
+ orderby(properties) {
3100
+ this.addCsvQueryParameter("$orderby", properties, arguments);
3101
+ return this;
3102
+ }
3103
+ /**
3104
+ * @public
3105
+ * 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.
3106
+ * @param {string} filterStr - The filter query string
3107
+ * @returns The same GraphRequest instance that is being called with, after adding the $filter query
3108
+ */
3109
+ filter(filterStr) {
3110
+ this.urlComponents.oDataQueryParams.$filter = filterStr;
3111
+ return this;
3112
+ }
3113
+ /**
3114
+ * @public
3115
+ * 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.
3116
+ * @param {string} searchStr - The search criterion string
3117
+ * @returns The same GraphRequest instance that is being called with, after adding the $search query criteria
3118
+ */
3119
+ search(searchStr) {
3120
+ this.urlComponents.oDataQueryParams.$search = searchStr;
3121
+ return this;
3122
+ }
3123
+ /**
3124
+ * @public
3125
+ * 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.
3126
+ * @param {number} n - The number value
3127
+ * @returns The same GraphRequest instance that is being called with, after adding the number for $top query
3128
+ */
3129
+ top(n) {
3130
+ this.urlComponents.oDataQueryParams.$top = n;
3131
+ return this;
3132
+ }
3133
+ /**
3134
+ * @public
3135
+ * 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.
3136
+ * @param {number} n - The number value
3137
+ * @returns The same GraphRequest instance that is being called with, after adding the number for the $skip query
3138
+ */
3139
+ skip(n) {
3140
+ this.urlComponents.oDataQueryParams.$skip = n;
3141
+ return this;
3142
+ }
3143
+ /**
3144
+ * @public
3145
+ * 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.
3146
+ * @param {string} token - The token value
3147
+ * @returns The same GraphRequest instance that is being called with, after adding the token string for $skipToken query option
3148
+ */
3149
+ skipToken(token) {
3150
+ this.urlComponents.oDataQueryParams.$skipToken = token;
3151
+ return this;
3152
+ }
3153
+ /**
3154
+ * @public
3155
+ * 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.
3156
+ * @param {boolean} isCount - The count boolean
3157
+ * @returns The same GraphRequest instance that is being called with, after adding the boolean value for the $count query option
3158
+ */
3159
+ count(isCount = true) {
3160
+ this.urlComponents.oDataQueryParams.$count = isCount.toString();
3161
+ return this;
3162
+ }
3163
+ /**
3164
+ * @public
3165
+ * Appends query string to the urlComponent
3166
+ * @param {string|KeyValuePairObjectStringNumber} queryDictionaryOrString - The query value
3167
+ * @returns The same GraphRequest instance that is being called with, after appending the query string to the url component
3168
+ */
3169
+ /*
3170
+ * Accepts .query("displayName=xyz")
3171
+ * and .select({ name: "value" })
3172
+ */
3173
+ query(queryDictionaryOrString) {
3174
+ return this.parseQueryParameter(queryDictionaryOrString);
3175
+ }
3176
+ /**
3177
+ * @public
3178
+ * @async
3179
+ * Makes a http request with GET method
3180
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3181
+ * @returns A promise that resolves to the get response
3182
+ */
3183
+ get(callback) {
3184
+ return __awaiter(this, void 0, void 0, function* () {
3185
+ const url = this.buildFullUrl();
3186
+ const options = {
3187
+ method: RequestMethod.GET
3188
+ };
3189
+ const response = yield this.send(url, options, callback);
3190
+ return response;
3191
+ });
3192
+ }
3193
+ /**
3194
+ * @public
3195
+ * @async
3196
+ * Makes a http request with POST method
3197
+ * @param {any} content - The content that needs to be sent with the request
3198
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3199
+ * @returns A promise that resolves to the post response
3200
+ */
3201
+ post(content, callback) {
3202
+ return __awaiter(this, void 0, void 0, function* () {
3203
+ const url = this.buildFullUrl();
3204
+ const options = {
3205
+ method: RequestMethod.POST,
3206
+ body: serializeContent(content)
3207
+ };
3208
+ const className = content && content.constructor && content.constructor.name;
3209
+ if (className === "FormData") {
3210
+ options.headers = {};
3211
+ } else {
3212
+ this.setHeaderContentType();
3213
+ options.headers = this._headers;
3214
+ }
3215
+ return yield this.send(url, options, callback);
3216
+ });
3217
+ }
3218
+ /**
3219
+ * @public
3220
+ * @async
3221
+ * Alias for Post request call
3222
+ * @param {any} content - The content that needs to be sent with the request
3223
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3224
+ * @returns A promise that resolves to the post response
3225
+ */
3226
+ create(content, callback) {
3227
+ return __awaiter(this, void 0, void 0, function* () {
3228
+ return yield this.post(content, callback);
3229
+ });
3230
+ }
3231
+ /**
3232
+ * @public
3233
+ * @async
3234
+ * Makes http request with PUT method
3235
+ * @param {any} content - The content that needs to be sent with the request
3236
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3237
+ * @returns A promise that resolves to the put response
3238
+ */
3239
+ put(content, callback) {
3240
+ return __awaiter(this, void 0, void 0, function* () {
3241
+ const url = this.buildFullUrl();
3242
+ this.setHeaderContentType();
3243
+ const options = {
3244
+ method: RequestMethod.PUT,
3245
+ body: serializeContent(content)
3246
+ };
3247
+ return yield this.send(url, options, callback);
3248
+ });
3249
+ }
3250
+ /**
3251
+ * @public
3252
+ * @async
3253
+ * Makes http request with PATCH method
3254
+ * @param {any} content - The content that needs to be sent with the request
3255
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3256
+ * @returns A promise that resolves to the patch response
3257
+ */
3258
+ patch(content, callback) {
3259
+ return __awaiter(this, void 0, void 0, function* () {
3260
+ const url = this.buildFullUrl();
3261
+ this.setHeaderContentType();
3262
+ const options = {
3263
+ method: RequestMethod.PATCH,
3264
+ body: serializeContent(content)
3265
+ };
3266
+ return yield this.send(url, options, callback);
3267
+ });
3268
+ }
3269
+ /**
3270
+ * @public
3271
+ * @async
3272
+ * Alias for PATCH request
3273
+ * @param {any} content - The content that needs to be sent with the request
3274
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3275
+ * @returns A promise that resolves to the patch response
3276
+ */
3277
+ update(content, callback) {
3278
+ return __awaiter(this, void 0, void 0, function* () {
3279
+ return yield this.patch(content, callback);
3280
+ });
3281
+ }
3282
+ /**
3283
+ * @public
3284
+ * @async
3285
+ * Makes http request with DELETE method
3286
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3287
+ * @returns A promise that resolves to the delete response
3288
+ */
3289
+ delete(callback) {
3290
+ return __awaiter(this, void 0, void 0, function* () {
3291
+ const url = this.buildFullUrl();
3292
+ const options = {
3293
+ method: RequestMethod.DELETE
3294
+ };
3295
+ return yield this.send(url, options, callback);
3296
+ });
3297
+ }
3298
+ /**
3299
+ * @public
3300
+ * @async
3301
+ * Alias for delete request call
3302
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3303
+ * @returns A promise that resolves to the delete response
3304
+ */
3305
+ del(callback) {
3306
+ return __awaiter(this, void 0, void 0, function* () {
3307
+ return yield this.delete(callback);
3308
+ });
3309
+ }
3310
+ /**
3311
+ * @public
3312
+ * @async
3313
+ * Makes a http request with GET method to read response as a stream.
3314
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3315
+ * @returns A promise that resolves to the getStream response
3316
+ */
3317
+ getStream(callback) {
3318
+ return __awaiter(this, void 0, void 0, function* () {
3319
+ const url = this.buildFullUrl();
3320
+ const options = {
3321
+ method: RequestMethod.GET
3322
+ };
3323
+ this.responseType(ResponseType.STREAM);
3324
+ return yield this.send(url, options, callback);
3325
+ });
3326
+ }
3327
+ /**
3328
+ * @public
3329
+ * @async
3330
+ * Makes a http request with GET method to read response as a stream.
3331
+ * @param {any} stream - The stream instance
3332
+ * @param {GraphRequestCallback} [callback] - The callback function to be called in response with async call
3333
+ * @returns A promise that resolves to the putStream response
3334
+ */
3335
+ putStream(stream, callback) {
3336
+ return __awaiter(this, void 0, void 0, function* () {
3337
+ const url = this.buildFullUrl();
3338
+ const options = {
3339
+ method: RequestMethod.PUT,
3340
+ headers: {
3341
+ "Content-Type": "application/octet-stream"
3342
+ },
3343
+ body: stream
3344
+ };
3345
+ return yield this.send(url, options, callback);
3346
+ });
3347
+ }
3348
+ };
3349
+
3350
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/HTTPClient.js
3351
+ init_tslib_es6();
3352
+ var HTTPClient = class {
3353
+ /**
3354
+ * @public
3355
+ * @constructor
3356
+ * Creates an instance of a HTTPClient
3357
+ * @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers
3358
+ */
3359
+ constructor(...middleware) {
3360
+ if (!middleware || !middleware.length) {
3361
+ const error = new Error();
3362
+ error.name = "InvalidMiddlewareChain";
3363
+ error.message = "Please provide a default middleware chain or custom middleware chain";
3364
+ throw error;
3365
+ }
3366
+ this.setMiddleware(...middleware);
3367
+ }
3368
+ /**
3369
+ * @private
3370
+ * Processes the middleware parameter passed to set this.middleware property
3371
+ * The calling function should validate if middleware is not undefined or not empty.
3372
+ * @param {...Middleware} middleware - The middleware passed
3373
+ * @returns Nothing
3374
+ */
3375
+ setMiddleware(...middleware) {
3376
+ if (middleware.length > 1) {
3377
+ this.parseMiddleWareArray(middleware);
3378
+ } else {
3379
+ this.middleware = middleware[0];
3380
+ }
3381
+ }
3382
+ /**
3383
+ * @private
3384
+ * Processes the middleware array to construct the chain
3385
+ * and sets this.middleware property to the first middleware handler of the array
3386
+ * The calling function should validate if middleware is not undefined or not empty
3387
+ * @param {Middleware[]} middlewareArray - The array of middleware handlers
3388
+ * @returns Nothing
3389
+ */
3390
+ parseMiddleWareArray(middlewareArray) {
3391
+ middlewareArray.forEach((element, index) => {
3392
+ if (index < middlewareArray.length - 1) {
3393
+ element.setNext(middlewareArray[index + 1]);
3394
+ }
3395
+ });
3396
+ this.middleware = middlewareArray[0];
3397
+ }
3398
+ /**
3399
+ * @public
3400
+ * @async
3401
+ * To send the request through the middleware chain
3402
+ * @param {Context} context - The context of a request
3403
+ * @returns A promise that resolves to the Context
3404
+ */
3405
+ sendRequest(context) {
3406
+ return __awaiter(this, void 0, void 0, function* () {
3407
+ if (typeof context.request === "string" && context.options === void 0) {
3408
+ const error = new Error();
3409
+ error.name = "InvalidRequestOptions";
3410
+ error.message = "Unable to execute the middleware, Please provide valid options for a request";
3411
+ throw error;
3412
+ }
3413
+ yield this.middleware.execute(context);
3414
+ return context;
3415
+ });
3416
+ }
3417
+ };
3418
+
3419
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/HTTPClientFactory.js
3420
+ var isNodeEnvironment = () => {
3421
+ return typeof process === "object" && typeof __require === "function";
3422
+ };
3423
+ var HTTPClientFactory = class _HTTPClientFactory {
3424
+ /**
3425
+ * @public
3426
+ * @static
3427
+ * Creates HTTPClient with default middleware chain
3428
+ * @param {AuthenticationProvider} authProvider - The authentication provider instance
3429
+ * @returns A HTTPClient instance
3430
+ *
3431
+ * NOTE: These are the things that we need to remember while doing modifications in the below default pipeline.
3432
+ * * HTTPMessageHandler should be the last one in the middleware pipeline, because this makes the actual network call of the request
3433
+ * * TelemetryHandler should be the one prior to the last middleware in the chain, because this is the one which actually collects and appends the usage flag and placing this handler * before making the actual network call ensures that the usage of all features are recorded in the flag.
3434
+ * * 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
3435
+ * 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.
3436
+ */
3437
+ static createWithAuthenticationProvider(authProvider) {
3438
+ const authenticationHandler = new AuthenticationHandler(authProvider);
3439
+ const retryHandler = new RetryHandler(new RetryHandlerOptions());
3440
+ const telemetryHandler = new TelemetryHandler();
3441
+ const httpMessageHandler = new HTTPMessageHandler();
3442
+ authenticationHandler.setNext(retryHandler);
3443
+ if (isNodeEnvironment()) {
3444
+ const redirectHandler = new RedirectHandler(new RedirectHandlerOptions());
3445
+ retryHandler.setNext(redirectHandler);
3446
+ redirectHandler.setNext(telemetryHandler);
3447
+ } else {
3448
+ retryHandler.setNext(telemetryHandler);
3449
+ }
3450
+ telemetryHandler.setNext(httpMessageHandler);
3451
+ return _HTTPClientFactory.createWithMiddleware(authenticationHandler);
3452
+ }
3453
+ /**
3454
+ * @public
3455
+ * @static
3456
+ * Creates a middleware chain with the given one
3457
+ * @property {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers
3458
+ * @returns A HTTPClient instance
3459
+ */
3460
+ static createWithMiddleware(...middleware) {
3461
+ return new HTTPClient(...middleware);
3462
+ }
3463
+ };
3464
+
3465
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/ValidatePolyFilling.js
3466
+ var validatePolyFilling = () => {
3467
+ if (typeof Promise === "undefined" && typeof fetch === "undefined") {
3468
+ const error = new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");
3469
+ error.name = "PolyFillNotAvailable";
3470
+ throw error;
3471
+ } else if (typeof Promise === "undefined") {
3472
+ const error = new Error("Library cannot function without Promise. So, please provide polyfill for it.");
3473
+ error.name = "PolyFillNotAvailable";
3474
+ throw error;
3475
+ } else if (typeof fetch === "undefined") {
3476
+ const error = new Error("Library cannot function without fetch. So, please provide polyfill for it.");
3477
+ error.name = "PolyFillNotAvailable";
3478
+ throw error;
3479
+ }
3480
+ return true;
3481
+ };
3482
+
3483
+ // ../../node_modules/.pnpm/@microsoft+microsoft-graph-client@3.0.7_@azure+identity@4.13.0/node_modules/@microsoft/microsoft-graph-client/lib/es/src/Client.js
3484
+ var Client = class _Client {
3485
+ /**
3486
+ * @public
3487
+ * @static
3488
+ * To create a client instance with options and initializes the default middleware chain
3489
+ * @param {Options} options - The options for client instance
3490
+ * @returns The Client instance
3491
+ */
3492
+ static init(options) {
3493
+ const clientOptions = {};
3494
+ for (const i in options) {
3495
+ if (Object.prototype.hasOwnProperty.call(options, i)) {
3496
+ clientOptions[i] = i === "authProvider" ? new CustomAuthenticationProvider(options[i]) : options[i];
3497
+ }
3498
+ }
3499
+ return _Client.initWithMiddleware(clientOptions);
3500
+ }
3501
+ /**
3502
+ * @public
3503
+ * @static
3504
+ * To create a client instance with the Client Options
3505
+ * @param {ClientOptions} clientOptions - The options object for initializing the client
3506
+ * @returns The Client instance
3507
+ */
3508
+ static initWithMiddleware(clientOptions) {
3509
+ return new _Client(clientOptions);
3510
+ }
3511
+ /**
3512
+ * @private
3513
+ * @constructor
3514
+ * Creates an instance of Client
3515
+ * @param {ClientOptions} clientOptions - The options to instantiate the client object
3516
+ */
3517
+ constructor(clientOptions) {
3518
+ this.config = {
3519
+ baseUrl: GRAPH_BASE_URL,
3520
+ debugLogging: false,
3521
+ defaultVersion: GRAPH_API_VERSION
3522
+ };
3523
+ validatePolyFilling();
3524
+ for (const key in clientOptions) {
3525
+ if (Object.prototype.hasOwnProperty.call(clientOptions, key)) {
3526
+ this.config[key] = clientOptions[key];
3527
+ }
3528
+ }
3529
+ let httpClient;
3530
+ if (clientOptions.authProvider !== void 0 && clientOptions.middleware !== void 0) {
3531
+ const error = new Error();
3532
+ error.name = "AmbiguityInInitialization";
3533
+ error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both";
3534
+ throw error;
3535
+ } else if (clientOptions.authProvider !== void 0) {
3536
+ httpClient = HTTPClientFactory.createWithAuthenticationProvider(clientOptions.authProvider);
3537
+ } else if (clientOptions.middleware !== void 0) {
3538
+ httpClient = new HTTPClient(...[].concat(clientOptions.middleware));
3539
+ } else {
3540
+ const error = new Error();
3541
+ error.name = "InvalidMiddlewareChain";
3542
+ error.message = "Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain";
3543
+ throw error;
3544
+ }
3545
+ this.httpClient = httpClient;
3546
+ }
3547
+ /**
3548
+ * @public
3549
+ * Entry point to make requests
3550
+ * @param {string} path - The path string value
3551
+ * @returns The graph request instance
3552
+ */
3553
+ api(path) {
3554
+ return new GraphRequest(this.httpClient, this.config, path);
3555
+ }
3556
+ };
3557
+
1
3558
  // src/index.ts
2
- import { ClientSecretCredential } from "@azure/identity";
3
- import { Client } from "@microsoft/microsoft-graph-client";
4
- import {
5
- TokenCredentialAuthenticationProvider
6
- } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials";
3559
+ var import_azureTokenCredentials = __toESM(require_azureTokenCredentials(), 1);
7
3560
  import {
8
3561
  ActivityTypes,
9
3562
  CloudAdapter,
@@ -95,6 +3648,17 @@ function convertChildToAdaptive(child) {
95
3648
  return convertSectionToElements(child);
96
3649
  case "fields":
97
3650
  return { elements: [convertFieldsToElement(child)], actions: [] };
3651
+ case "link":
3652
+ return {
3653
+ elements: [
3654
+ {
3655
+ type: "TextBlock",
3656
+ text: `[${convertEmoji(child.label)}](${child.url})`,
3657
+ wrap: true
3658
+ }
3659
+ ],
3660
+ actions: []
3661
+ };
98
3662
  default:
99
3663
  return { elements: [], actions: [] };
100
3664
  }
@@ -375,7 +3939,7 @@ var TeamsAdapter = class {
375
3939
  config.appId,
376
3940
  config.appPassword
377
3941
  );
378
- const authProvider = new TokenCredentialAuthenticationProvider(
3942
+ const authProvider = new import_azureTokenCredentials.TokenCredentialAuthenticationProvider(
379
3943
  credential,
380
3944
  {
381
3945
  scopes: ["https://graph.microsoft.com/.default"]
@@ -997,7 +4561,7 @@ var TeamsAdapter = class {
997
4561
  "removeReaction"
998
4562
  );
999
4563
  }
1000
- async startTyping(threadId) {
4564
+ async startTyping(threadId, _status) {
1001
4565
  const { conversationId, serviceUrl } = this.decodeThreadId(threadId);
1002
4566
  const conversationReference = {
1003
4567
  channelId: "msteams",