@microsoft/applicationinsights-channel-js 2.8.0-nightly.2204-04 → 2.8.0-nightly.2204-07

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.
Files changed (30) hide show
  1. package/browser/applicationinsights-channel-js.integrity.json +9 -9
  2. package/browser/applicationinsights-channel-js.js +346 -328
  3. package/browser/applicationinsights-channel-js.js.map +1 -1
  4. package/browser/applicationinsights-channel-js.min.js +2 -2
  5. package/browser/applicationinsights-channel-js.min.js.map +1 -1
  6. package/dist/applicationinsights-channel-js.d.ts +1 -1
  7. package/dist/applicationinsights-channel-js.js +346 -328
  8. package/dist/applicationinsights-channel-js.js.map +1 -1
  9. package/dist/applicationinsights-channel-js.min.js +2 -2
  10. package/dist/applicationinsights-channel-js.min.js.map +1 -1
  11. package/dist/applicationinsights-channel-js.rollup.d.ts +1 -1
  12. package/dist-esm/EnvelopeCreator.js +5 -5
  13. package/dist-esm/EnvelopeCreator.js.map +1 -1
  14. package/dist-esm/Interfaces.js +1 -1
  15. package/dist-esm/Offline.js +1 -1
  16. package/dist-esm/SendBuffer.js +7 -7
  17. package/dist-esm/SendBuffer.js.map +1 -1
  18. package/dist-esm/Sender.js +24 -24
  19. package/dist-esm/Sender.js.map +1 -1
  20. package/dist-esm/Serializer.js +10 -10
  21. package/dist-esm/Serializer.js.map +1 -1
  22. package/dist-esm/TelemetryProcessors/Sample.js +1 -1
  23. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  24. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  25. package/dist-esm/applicationinsights-channel-js.js +1 -1
  26. package/package.json +3 -3
  27. package/src/EnvelopeCreator.ts +7 -7
  28. package/src/SendBuffer.ts +14 -14
  29. package/src/Sender.ts +36 -36
  30. package/src/Serializer.ts +13 -13
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Channel, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Channel, 2.8.0-nightly.2204-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -98,247 +98,6 @@
98
98
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
99
99
  }
100
100
 
101
- /*!
102
- * Microsoft Dynamic Proto Utility, 1.1.4
103
- * Copyright (c) Microsoft and contributors. All rights reserved.
104
- */
105
- var Constructor = 'constructor';
106
- var Prototype = 'prototype';
107
- var strFunction = 'function';
108
- var DynInstFuncTable = '_dynInstFuncs';
109
- var DynProxyTag = '_isDynProxy';
110
- var DynClassName = '_dynClass';
111
- var DynClassNamePrefix = '_dynCls$';
112
- var DynInstChkTag = '_dynInstChk';
113
- var DynAllowInstChkTag = DynInstChkTag;
114
- var DynProtoDefaultOptions = '_dfOpts';
115
- var UnknownValue = '_unknown_';
116
- var str__Proto$1 = "__proto__";
117
- var strUseBaseInst = 'useBaseInst';
118
- var strSetInstFuncs = 'setInstFuncs';
119
- var Obj = Object;
120
- var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
121
- var _dynamicNames = 0;
122
- function _hasOwnProperty(obj, prop) {
123
- return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
124
- }
125
- function _isObjectOrArrayPrototype(target) {
126
- return target && (target === Obj[Prototype] || target === Array[Prototype]);
127
- }
128
- function _isObjectArrayOrFunctionPrototype(target) {
129
- return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
130
- }
131
- function _getObjProto$1(target) {
132
- if (target) {
133
- if (_objGetPrototypeOf$1) {
134
- return _objGetPrototypeOf$1(target);
135
- }
136
- var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
137
- if (newProto) {
138
- return newProto;
139
- }
140
- }
141
- return null;
142
- }
143
- function _forEachProp(target, func) {
144
- var props = [];
145
- var getOwnProps = Obj["getOwnPropertyNames"];
146
- if (getOwnProps) {
147
- props = getOwnProps(target);
148
- }
149
- else {
150
- for (var name_1 in target) {
151
- if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
152
- props.push(name_1);
153
- }
154
- }
155
- }
156
- if (props && props.length > 0) {
157
- for (var lp = 0; lp < props.length; lp++) {
158
- func(props[lp]);
159
- }
160
- }
161
- }
162
- function _isDynamicCandidate(target, funcName, skipOwn) {
163
- return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
164
- }
165
- function _throwTypeError(message) {
166
- throw new TypeError("DynamicProto: " + message);
167
- }
168
- function _getInstanceFuncs(thisTarget) {
169
- var instFuncs = {};
170
- _forEachProp(thisTarget, function (name) {
171
- if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
172
- instFuncs[name] = thisTarget[name];
173
- }
174
- });
175
- return instFuncs;
176
- }
177
- function _hasVisited(values, value) {
178
- for (var lp = values.length - 1; lp >= 0; lp--) {
179
- if (values[lp] === value) {
180
- return true;
181
- }
182
- }
183
- return false;
184
- }
185
- function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
186
- function _instFuncProxy(target, funcHost, funcName) {
187
- var theFunc = funcHost[funcName];
188
- if (theFunc[DynProxyTag] && useBaseInst) {
189
- var instFuncTable = target[DynInstFuncTable] || {};
190
- if (instFuncTable[DynAllowInstChkTag] !== false) {
191
- theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
192
- }
193
- }
194
- return function () {
195
- return theFunc.apply(target, arguments);
196
- };
197
- }
198
- var baseFuncs = {};
199
- _forEachProp(instFuncs, function (name) {
200
- baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
201
- });
202
- var baseProto = _getObjProto$1(classProto);
203
- var visited = [];
204
- while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
205
- _forEachProp(baseProto, function (name) {
206
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
207
- baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
208
- }
209
- });
210
- visited.push(baseProto);
211
- baseProto = _getObjProto$1(baseProto);
212
- }
213
- return baseFuncs;
214
- }
215
- function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
216
- var instFunc = null;
217
- if (target && _hasOwnProperty(proto, DynClassName)) {
218
- var instFuncTable = target[DynInstFuncTable] || {};
219
- instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
220
- if (!instFunc) {
221
- _throwTypeError("Missing [" + funcName + "] " + strFunction);
222
- }
223
- if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
224
- var canAddInst = !_hasOwnProperty(target, funcName);
225
- var objProto = _getObjProto$1(target);
226
- var visited = [];
227
- while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
228
- var protoFunc = objProto[funcName];
229
- if (protoFunc) {
230
- canAddInst = (protoFunc === currentDynProtoProxy);
231
- break;
232
- }
233
- visited.push(objProto);
234
- objProto = _getObjProto$1(objProto);
235
- }
236
- try {
237
- if (canAddInst) {
238
- target[funcName] = instFunc;
239
- }
240
- instFunc[DynInstChkTag] = 1;
241
- }
242
- catch (e) {
243
- instFuncTable[DynAllowInstChkTag] = false;
244
- }
245
- }
246
- }
247
- return instFunc;
248
- }
249
- function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
250
- var protoFunc = proto[funcName];
251
- if (protoFunc === currentDynProtoProxy) {
252
- protoFunc = _getObjProto$1(proto)[funcName];
253
- }
254
- if (typeof protoFunc !== strFunction) {
255
- _throwTypeError("[" + funcName + "] is not a " + strFunction);
256
- }
257
- return protoFunc;
258
- }
259
- function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
260
- function _createDynamicPrototype(proto, funcName) {
261
- var dynProtoProxy = function () {
262
- var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
263
- return instFunc.apply(this, arguments);
264
- };
265
- dynProtoProxy[DynProxyTag] = 1;
266
- return dynProtoProxy;
267
- }
268
- if (!_isObjectOrArrayPrototype(proto)) {
269
- var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
270
- var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
271
- if (instFuncTable[DynAllowInstChkTag] !== false) {
272
- instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
273
- }
274
- _forEachProp(target, function (name) {
275
- if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
276
- instFuncs_1[name] = target[name];
277
- delete target[name];
278
- if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
279
- proto[name] = _createDynamicPrototype(proto, name);
280
- }
281
- }
282
- });
283
- }
284
- }
285
- function _checkPrototype(classProto, thisTarget) {
286
- if (_objGetPrototypeOf$1) {
287
- var visited = [];
288
- var thisProto = _getObjProto$1(thisTarget);
289
- while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
290
- if (thisProto === classProto) {
291
- return true;
292
- }
293
- visited.push(thisProto);
294
- thisProto = _getObjProto$1(thisProto);
295
- }
296
- }
297
- return false;
298
- }
299
- function _getObjName(target, unknownValue) {
300
- if (_hasOwnProperty(target, Prototype)) {
301
- return target.name || unknownValue || UnknownValue;
302
- }
303
- return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
304
- }
305
- function dynamicProto(theClass, target, delegateFunc, options) {
306
- if (!_hasOwnProperty(theClass, Prototype)) {
307
- _throwTypeError("theClass is an invalid class definition.");
308
- }
309
- var classProto = theClass[Prototype];
310
- if (!_checkPrototype(classProto, target)) {
311
- _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
312
- }
313
- var className = null;
314
- if (_hasOwnProperty(classProto, DynClassName)) {
315
- className = classProto[DynClassName];
316
- }
317
- else {
318
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
319
- _dynamicNames++;
320
- classProto[DynClassName] = className;
321
- }
322
- var perfOptions = dynamicProto[DynProtoDefaultOptions];
323
- var useBaseInst = !!perfOptions[strUseBaseInst];
324
- if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
325
- useBaseInst = !!options[strUseBaseInst];
326
- }
327
- var instFuncs = _getInstanceFuncs(target);
328
- var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
329
- delegateFunc(target, baseFuncs);
330
- var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
331
- if (setInstanceFunc && options) {
332
- setInstanceFunc = !!options[strSetInstFuncs];
333
- }
334
- _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
335
- }
336
- var perfDefaults = {
337
- setInstFuncs: true,
338
- useBaseInst: true
339
- };
340
- dynamicProto[DynProtoDefaultOptions] = perfDefaults;
341
-
342
101
  var strEmpty$1 = "";
343
102
  var strSetNextPlugin = "setNextPlugin";
344
103
  var strIsInitialized = "isInitialized";
@@ -353,7 +112,7 @@
353
112
  var strMap = "map";
354
113
  var cStrTrim = "trim";
355
114
  var strToString = "toString";
356
- var str__Proto = "__proto__";
115
+ var str__Proto$1 = "__proto__";
357
116
  var strConstructor = "constructor";
358
117
  var _objDefineProperty$1 = ObjDefineProperty;
359
118
  var _objFreeze = ObjClass.freeze;
@@ -369,13 +128,13 @@
369
128
  var rCamelCase = /-([a-z])/g;
370
129
  var rNormalizeInvalid = /([^\w\d_$])/g;
371
130
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
372
- var _objGetPrototypeOf = Object["getPrototypeOf"];
373
- function _getObjProto(target) {
131
+ var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
132
+ function _getObjProto$1(target) {
374
133
  if (target) {
375
- if (_objGetPrototypeOf) {
376
- return _objGetPrototypeOf(target);
134
+ if (_objGetPrototypeOf$1) {
135
+ return _objGetPrototypeOf$1(target);
377
136
  }
378
- var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
137
+ var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
379
138
  if (newProto) {
380
139
  return newProto;
381
140
  }
@@ -441,7 +200,7 @@
441
200
  function isPlainObject(value) {
442
201
  var result = false;
443
202
  if (value && typeof value === "object") {
444
- var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
203
+ var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
445
204
  if (!proto) {
446
205
  result = true;
447
206
  }
@@ -596,6 +355,16 @@
596
355
  function _doNothing(value) {
597
356
  return value;
598
357
  }
358
+ function deepFreeze(obj) {
359
+ if (_objFreeze) {
360
+ objForEachKey(obj, function (name, value) {
361
+ if (isArray(value) || isObject(value)) {
362
+ _objFreeze(value);
363
+ }
364
+ });
365
+ }
366
+ return objFreeze(obj);
367
+ }
599
368
  var objFreeze = _objFreeze || _doNothing;
600
369
  function dateNow() {
601
370
  var dt = Date;
@@ -621,9 +390,6 @@
621
390
  function isTruthy(value) {
622
391
  return !!value;
623
392
  }
624
- function throwError(message) {
625
- throw new Error(message);
626
- }
627
393
  function _createProxyFunction(source, funcName) {
628
394
  var srcFunc = null;
629
395
  var src = null;
@@ -644,9 +410,8 @@
644
410
  };
645
411
  }
646
412
  function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
647
- if (overwriteTarget === void 0) { overwriteTarget = true; }
648
413
  if (target && name && source) {
649
- if (overwriteTarget || isUndefined(target[name])) {
414
+ if (overwriteTarget !== false || isUndefined(target[name])) {
650
415
  target[name] = _createProxyFunction(source, theFunc);
651
416
  }
652
417
  }
@@ -664,17 +429,6 @@
664
429
  return class_1;
665
430
  }());
666
431
  }
667
- function createEnumStyle(values) {
668
- var enumClass = {};
669
- objForEachKey(values, function (field, value) {
670
- enumClass[field] = value;
671
- if (!isUndefined(enumClass[value])) {
672
- throwError("[" + value + "] exists for " + field);
673
- }
674
- enumClass[value] = field;
675
- });
676
- return objFreeze(enumClass);
677
- }
678
432
  function optimizeObject(theObject) {
679
433
  if (theObject && ObjAssign) {
680
434
  theObject = ObjClass(ObjAssign({}, theObject));
@@ -726,6 +480,264 @@
726
480
  return extended;
727
481
  }
728
482
 
483
+ function createEnumStyle(values) {
484
+ var enumClass = {};
485
+ objForEachKey(values, function (field, value) {
486
+ enumClass[field] = value;
487
+ enumClass[value] = field;
488
+ });
489
+ return deepFreeze(enumClass);
490
+ }
491
+ function createValueMap(values) {
492
+ var mapClass = {};
493
+ objForEachKey(values, function (field, value) {
494
+ mapClass[field] = value[1];
495
+ mapClass[value[0]] = value[1];
496
+ });
497
+ return deepFreeze(mapClass);
498
+ }
499
+
500
+ /*!
501
+ * Microsoft Dynamic Proto Utility, 1.1.4
502
+ * Copyright (c) Microsoft and contributors. All rights reserved.
503
+ */
504
+ var Constructor = 'constructor';
505
+ var Prototype = 'prototype';
506
+ var strFunction = 'function';
507
+ var DynInstFuncTable = '_dynInstFuncs';
508
+ var DynProxyTag = '_isDynProxy';
509
+ var DynClassName = '_dynClass';
510
+ var DynClassNamePrefix = '_dynCls$';
511
+ var DynInstChkTag = '_dynInstChk';
512
+ var DynAllowInstChkTag = DynInstChkTag;
513
+ var DynProtoDefaultOptions = '_dfOpts';
514
+ var UnknownValue = '_unknown_';
515
+ var str__Proto = "__proto__";
516
+ var strUseBaseInst = 'useBaseInst';
517
+ var strSetInstFuncs = 'setInstFuncs';
518
+ var Obj = Object;
519
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
520
+ var _dynamicNames = 0;
521
+ function _hasOwnProperty(obj, prop) {
522
+ return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
523
+ }
524
+ function _isObjectOrArrayPrototype(target) {
525
+ return target && (target === Obj[Prototype] || target === Array[Prototype]);
526
+ }
527
+ function _isObjectArrayOrFunctionPrototype(target) {
528
+ return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
529
+ }
530
+ function _getObjProto(target) {
531
+ if (target) {
532
+ if (_objGetPrototypeOf) {
533
+ return _objGetPrototypeOf(target);
534
+ }
535
+ var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
536
+ if (newProto) {
537
+ return newProto;
538
+ }
539
+ }
540
+ return null;
541
+ }
542
+ function _forEachProp(target, func) {
543
+ var props = [];
544
+ var getOwnProps = Obj["getOwnPropertyNames"];
545
+ if (getOwnProps) {
546
+ props = getOwnProps(target);
547
+ }
548
+ else {
549
+ for (var name_1 in target) {
550
+ if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
551
+ props.push(name_1);
552
+ }
553
+ }
554
+ }
555
+ if (props && props.length > 0) {
556
+ for (var lp = 0; lp < props.length; lp++) {
557
+ func(props[lp]);
558
+ }
559
+ }
560
+ }
561
+ function _isDynamicCandidate(target, funcName, skipOwn) {
562
+ return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
563
+ }
564
+ function _throwTypeError(message) {
565
+ throw new TypeError("DynamicProto: " + message);
566
+ }
567
+ function _getInstanceFuncs(thisTarget) {
568
+ var instFuncs = {};
569
+ _forEachProp(thisTarget, function (name) {
570
+ if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
571
+ instFuncs[name] = thisTarget[name];
572
+ }
573
+ });
574
+ return instFuncs;
575
+ }
576
+ function _hasVisited(values, value) {
577
+ for (var lp = values.length - 1; lp >= 0; lp--) {
578
+ if (values[lp] === value) {
579
+ return true;
580
+ }
581
+ }
582
+ return false;
583
+ }
584
+ function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
585
+ function _instFuncProxy(target, funcHost, funcName) {
586
+ var theFunc = funcHost[funcName];
587
+ if (theFunc[DynProxyTag] && useBaseInst) {
588
+ var instFuncTable = target[DynInstFuncTable] || {};
589
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
590
+ theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
591
+ }
592
+ }
593
+ return function () {
594
+ return theFunc.apply(target, arguments);
595
+ };
596
+ }
597
+ var baseFuncs = {};
598
+ _forEachProp(instFuncs, function (name) {
599
+ baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
600
+ });
601
+ var baseProto = _getObjProto(classProto);
602
+ var visited = [];
603
+ while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
604
+ _forEachProp(baseProto, function (name) {
605
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
606
+ baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
607
+ }
608
+ });
609
+ visited.push(baseProto);
610
+ baseProto = _getObjProto(baseProto);
611
+ }
612
+ return baseFuncs;
613
+ }
614
+ function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
615
+ var instFunc = null;
616
+ if (target && _hasOwnProperty(proto, DynClassName)) {
617
+ var instFuncTable = target[DynInstFuncTable] || {};
618
+ instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
619
+ if (!instFunc) {
620
+ _throwTypeError("Missing [" + funcName + "] " + strFunction);
621
+ }
622
+ if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
623
+ var canAddInst = !_hasOwnProperty(target, funcName);
624
+ var objProto = _getObjProto(target);
625
+ var visited = [];
626
+ while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
627
+ var protoFunc = objProto[funcName];
628
+ if (protoFunc) {
629
+ canAddInst = (protoFunc === currentDynProtoProxy);
630
+ break;
631
+ }
632
+ visited.push(objProto);
633
+ objProto = _getObjProto(objProto);
634
+ }
635
+ try {
636
+ if (canAddInst) {
637
+ target[funcName] = instFunc;
638
+ }
639
+ instFunc[DynInstChkTag] = 1;
640
+ }
641
+ catch (e) {
642
+ instFuncTable[DynAllowInstChkTag] = false;
643
+ }
644
+ }
645
+ }
646
+ return instFunc;
647
+ }
648
+ function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
649
+ var protoFunc = proto[funcName];
650
+ if (protoFunc === currentDynProtoProxy) {
651
+ protoFunc = _getObjProto(proto)[funcName];
652
+ }
653
+ if (typeof protoFunc !== strFunction) {
654
+ _throwTypeError("[" + funcName + "] is not a " + strFunction);
655
+ }
656
+ return protoFunc;
657
+ }
658
+ function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
659
+ function _createDynamicPrototype(proto, funcName) {
660
+ var dynProtoProxy = function () {
661
+ var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
662
+ return instFunc.apply(this, arguments);
663
+ };
664
+ dynProtoProxy[DynProxyTag] = 1;
665
+ return dynProtoProxy;
666
+ }
667
+ if (!_isObjectOrArrayPrototype(proto)) {
668
+ var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
669
+ var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
670
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
671
+ instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
672
+ }
673
+ _forEachProp(target, function (name) {
674
+ if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
675
+ instFuncs_1[name] = target[name];
676
+ delete target[name];
677
+ if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
678
+ proto[name] = _createDynamicPrototype(proto, name);
679
+ }
680
+ }
681
+ });
682
+ }
683
+ }
684
+ function _checkPrototype(classProto, thisTarget) {
685
+ if (_objGetPrototypeOf) {
686
+ var visited = [];
687
+ var thisProto = _getObjProto(thisTarget);
688
+ while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
689
+ if (thisProto === classProto) {
690
+ return true;
691
+ }
692
+ visited.push(thisProto);
693
+ thisProto = _getObjProto(thisProto);
694
+ }
695
+ }
696
+ return false;
697
+ }
698
+ function _getObjName(target, unknownValue) {
699
+ if (_hasOwnProperty(target, Prototype)) {
700
+ return target.name || unknownValue || UnknownValue;
701
+ }
702
+ return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
703
+ }
704
+ function dynamicProto(theClass, target, delegateFunc, options) {
705
+ if (!_hasOwnProperty(theClass, Prototype)) {
706
+ _throwTypeError("theClass is an invalid class definition.");
707
+ }
708
+ var classProto = theClass[Prototype];
709
+ if (!_checkPrototype(classProto, target)) {
710
+ _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
711
+ }
712
+ var className = null;
713
+ if (_hasOwnProperty(classProto, DynClassName)) {
714
+ className = classProto[DynClassName];
715
+ }
716
+ else {
717
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
718
+ _dynamicNames++;
719
+ classProto[DynClassName] = className;
720
+ }
721
+ var perfOptions = dynamicProto[DynProtoDefaultOptions];
722
+ var useBaseInst = !!perfOptions[strUseBaseInst];
723
+ if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
724
+ useBaseInst = !!options[strUseBaseInst];
725
+ }
726
+ var instFuncs = _getInstanceFuncs(target);
727
+ var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
728
+ delegateFunc(target, baseFuncs);
729
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
730
+ if (setInstanceFunc && options) {
731
+ setInstanceFunc = !!options[strSetInstFuncs];
732
+ }
733
+ _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
734
+ }
735
+ var perfDefaults = {
736
+ setInstFuncs: true,
737
+ useBaseInst: true
738
+ };
739
+ dynamicProto[DynProtoDefaultOptions] = perfDefaults;
740
+
729
741
  var strWindow = "window";
730
742
  var strDocument = "document";
731
743
  var strDocumentMode = "documentMode";
@@ -1069,10 +1081,16 @@
1069
1081
  }
1070
1082
  return DiagnosticLogger;
1071
1083
  }());
1084
+ function _getLogger(logger) {
1085
+ return (logger || new DiagnosticLogger());
1086
+ }
1072
1087
  function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1073
1088
  if (isUserAct === void 0) { isUserAct = false; }
1074
1089
  (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1075
1090
  }
1091
+ function _warnToConsole(logger, message) {
1092
+ _getLogger(logger).warnToConsole(message);
1093
+ }
1076
1094
 
1077
1095
  var strExecutionContextKey = "ctx";
1078
1096
  var PerfEvent = /** @class */ (function () {
@@ -1255,7 +1273,7 @@
1255
1273
  }
1256
1274
 
1257
1275
  var _objDefineProperty = ObjDefineProperty;
1258
- var version = "2.8.0-nightly.2204-04";
1276
+ var version = "2.8.0-nightly.2204-07";
1259
1277
  var instanceName = "." + newId(6);
1260
1278
  var _dataUid = 0;
1261
1279
  function _createAccessor(target, prop, value) {
@@ -2107,17 +2125,17 @@
2107
2125
  InMemoryStorageBufferFull: 105
2108
2126
  });
2109
2127
 
2110
- var RequestHeaders = {
2111
- requestContextHeader: "Request-Context",
2112
- requestContextTargetKey: "appId",
2113
- requestContextAppIdFormat: "appId=cid-v1:",
2114
- requestIdHeader: "Request-Id",
2115
- traceParentHeader: "traceparent",
2116
- traceStateHeader: "tracestate",
2117
- sdkContextHeader: "Sdk-Context",
2118
- sdkContextHeaderAppIdRequest: "appId",
2119
- requestContextHeaderLowerCase: "request-context"
2120
- };
2128
+ var RequestHeaders = createValueMap({
2129
+ requestContextHeader: [0 , "Request-Context"],
2130
+ requestContextTargetKey: [1 , "appId"],
2131
+ requestContextAppIdFormat: [2 , "appId=cid-v1:"],
2132
+ requestIdHeader: [3 , "Request-Id"],
2133
+ traceParentHeader: [4 , "traceparent"],
2134
+ traceStateHeader: [5 , "tracestate"],
2135
+ sdkContextHeader: [6 , "Sdk-Context"],
2136
+ sdkContextHeaderAppIdRequest: [7 , "appId"],
2137
+ requestContextHeaderLowerCase: [8 , "request-context"]
2138
+ });
2121
2139
 
2122
2140
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
2123
2141
  var origLength = key.length;
@@ -2139,7 +2157,7 @@
2139
2157
  name = strTrim(name.toString());
2140
2158
  if (name.length > 150 ) {
2141
2159
  nameTrunc = name.substring(0, 150 );
2142
- _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2160
+ _throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2143
2161
  }
2144
2162
  }
2145
2163
  return nameTrunc || name;
@@ -2152,20 +2170,20 @@
2152
2170
  value = strTrim(value);
2153
2171
  if (value.toString().length > maxLength) {
2154
2172
  valueTrunc = value.toString().substring(0, maxLength);
2155
- _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2173
+ _throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2156
2174
  }
2157
2175
  }
2158
2176
  return valueTrunc || value;
2159
2177
  }
2160
2178
  function dataSanitizeUrl(logger, url) {
2161
- return dataSanitizeInput(logger, url, 2048 , _InternalMessageId.UrlTooLong);
2179
+ return dataSanitizeInput(logger, url, 2048 , 66 );
2162
2180
  }
2163
2181
  function dataSanitizeMessage(logger, message) {
2164
2182
  var messageTrunc;
2165
2183
  if (message) {
2166
2184
  if (message.length > 32768 ) {
2167
2185
  messageTrunc = message.substring(0, 32768 );
2168
- _throwInternal(logger, 2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
2186
+ _throwInternal(logger, 2 , 56 , "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
2169
2187
  }
2170
2188
  }
2171
2189
  return messageTrunc || message;
@@ -2176,7 +2194,7 @@
2176
2194
  var value = "" + exception;
2177
2195
  if (value.length > 32768 ) {
2178
2196
  exceptionTrunc = value.substring(0, 32768 );
2179
- _throwInternal(logger, 2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
2197
+ _throwInternal(logger, 2 , 52 , "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
2180
2198
  }
2181
2199
  }
2182
2200
  return exceptionTrunc || exception;
@@ -2190,7 +2208,7 @@
2190
2208
  value = getJSON().stringify(value);
2191
2209
  }
2192
2210
  catch (e) {
2193
- _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2211
+ _throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
2194
2212
  }
2195
2213
  }
2196
2214
  value = dataSanitizeString(logger, value, 8192 );
@@ -2213,7 +2231,7 @@
2213
2231
  return measurements;
2214
2232
  }
2215
2233
  function dataSanitizeId(logger, id) {
2216
- return id ? dataSanitizeInput(logger, id, 128 , _InternalMessageId.IdTooLong).toString() : id;
2234
+ return id ? dataSanitizeInput(logger, id, 128 , 69 ).toString() : id;
2217
2235
  }
2218
2236
  function dataSanitizeInput(logger, input, maxLength, _msgId) {
2219
2237
  var inputTrunc;
@@ -2271,11 +2289,11 @@
2271
2289
  if (isNullOrUndefined(getGlobal())) {
2272
2290
  return null;
2273
2291
  }
2274
- var uid = new Date;
2292
+ var uid = (new Date).toString();
2275
2293
  var storage = getGlobalInst(storageType === StorageType.LocalStorage ? "localStorage" : "sessionStorage");
2276
- storage.setItem(uid.toString(), uid.toString());
2277
- var fail = storage.getItem(uid.toString()) !== uid.toString();
2278
- storage.removeItem(uid.toString());
2294
+ storage.setItem(uid, uid);
2295
+ var fail = storage.getItem(uid) !== uid;
2296
+ storage.removeItem(uid);
2279
2297
  if (!fail) {
2280
2298
  return storage;
2281
2299
  }
@@ -2304,7 +2322,7 @@
2304
2322
  }
2305
2323
  catch (e) {
2306
2324
  _canUseSessionStorage = false;
2307
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2325
+ _throwInternal(logger, 2 , 2 , "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2308
2326
  }
2309
2327
  }
2310
2328
  return null;
@@ -2318,7 +2336,7 @@
2318
2336
  }
2319
2337
  catch (e) {
2320
2338
  _canUseSessionStorage = false;
2321
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2339
+ _throwInternal(logger, 2 , 4 , "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2322
2340
  }
2323
2341
  }
2324
2342
  return false;
@@ -3198,7 +3216,7 @@
3198
3216
  _self.enqueue = function (payload) {
3199
3217
  if (_self.count() >= config.eventsLimitInMem()) {
3200
3218
  if (!_bufferFullMessageSent) {
3201
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InMemoryStorageBufferFull, "Maximum in-memory buffer size reached: " + _self.count(), true);
3219
+ _throwInternal(logger, 2 , 105 , "Maximum in-memory buffer size reached: " + _self.count(), true);
3202
3220
  _bufferFullMessageSent = true;
3203
3221
  }
3204
3222
  return;
@@ -3270,7 +3288,7 @@
3270
3288
  _self.enqueue = function (payload) {
3271
3289
  if (_self.count() >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
3272
3290
  if (!_bufferFullMessageSent) {
3273
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, "Maximum buffer size reached: " + _self.count(), true);
3291
+ _throwInternal(logger, 2 , 67 , "Maximum buffer size reached: " + _self.count(), true);
3274
3292
  _bufferFullMessageSent = true;
3275
3293
  }
3276
3294
  return;
@@ -3290,7 +3308,7 @@
3290
3308
  if (sentElements instanceof Array && payload instanceof Array) {
3291
3309
  sentElements = sentElements.concat(payload);
3292
3310
  if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
3293
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, "Sent buffer reached its maximum size: " + sentElements.length, true);
3311
+ _throwInternal(logger, 1 , 67 , "Sent buffer reached its maximum size: " + sentElements.length, true);
3294
3312
  sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
3295
3313
  }
3296
3314
  _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
@@ -3326,7 +3344,7 @@
3326
3344
  }
3327
3345
  }
3328
3346
  catch (e) {
3329
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
3347
+ _throwInternal(logger, 1 , 42 , " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
3330
3348
  }
3331
3349
  return [];
3332
3350
  }
@@ -3339,7 +3357,7 @@
3339
3357
  }
3340
3358
  catch (e) {
3341
3359
  utlSetSessionStorage(logger, prefixedKey, JSON.stringify([]));
3342
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
3360
+ _throwInternal(logger, 2 , 41 , " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
3343
3361
  }
3344
3362
  }
3345
3363
  });
@@ -3456,11 +3474,11 @@
3456
3474
  }
3457
3475
  function EnvelopeCreatorInit(logger, telemetryItem) {
3458
3476
  if (isNullOrUndefined(telemetryItem[strBaseData])) {
3459
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, "telemetryItem.baseData cannot be null.");
3477
+ _throwInternal(logger, 1 , 46 , "telemetryItem.baseData cannot be null.");
3460
3478
  }
3461
3479
  }
3462
3480
  var EnvelopeCreator = {
3463
- Version: "2.8.0-nightly.2204-04"
3481
+ Version: "2.8.0-nightly.2204-07"
3464
3482
  };
3465
3483
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
3466
3484
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -3472,7 +3490,7 @@
3472
3490
  }
3473
3491
  var bd = telemetryItem[strBaseData];
3474
3492
  if (isNullOrUndefined(bd)) {
3475
- logger.warnToConsole("Invalid input for dependency data");
3493
+ _warnToConsole(logger, "Invalid input for dependency data");
3476
3494
  return null;
3477
3495
  }
3478
3496
  var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : "GET";
@@ -3619,18 +3637,18 @@
3619
3637
  return getJSON().stringify(output);
3620
3638
  }
3621
3639
  catch (e) {
3622
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
3640
+ _throwInternal(logger, 1 , 48 , (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
3623
3641
  }
3624
3642
  };
3625
3643
  function _serializeObject(source, name) {
3626
3644
  var circularReferenceCheck = "__aiCircularRefCheck";
3627
3645
  var output = {};
3628
3646
  if (!source) {
3629
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, "cannot serialize object because it is null or undefined", { name: name }, true);
3647
+ _throwInternal(logger, 1 , 48 , "cannot serialize object because it is null or undefined", { name: name }, true);
3630
3648
  return output;
3631
3649
  }
3632
3650
  if (source[circularReferenceCheck]) {
3633
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, "Circular reference detected while serializing object", { name: name }, true);
3651
+ _throwInternal(logger, 2 , 50 , "Circular reference detected while serializing object", { name: name }, true);
3634
3652
  return output;
3635
3653
  }
3636
3654
  if (!source.aiDataContract) {
@@ -3647,13 +3665,13 @@
3647
3665
  output = _serializeArray(source, name);
3648
3666
  }
3649
3667
  else {
3650
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
3668
+ _throwInternal(logger, 2 , 49 , "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
3651
3669
  try {
3652
3670
  getJSON().stringify(source);
3653
3671
  output = source;
3654
3672
  }
3655
3673
  catch (e) {
3656
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
3674
+ _throwInternal(logger, 1 , 48 , (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
3657
3675
  }
3658
3676
  }
3659
3677
  return output;
@@ -3666,7 +3684,7 @@
3666
3684
  var isPresent = source[field] !== undefined;
3667
3685
  var isObj = isObject(source[field]) && source[field] !== null;
3668
3686
  if (isRequired && !isPresent && !isArray) {
3669
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
3687
+ _throwInternal(logger, 1 , 24 , "Missing required field specification. The field is required but not present on source", { field: field, name: name });
3670
3688
  }
3671
3689
  else if (!isHidden) {
3672
3690
  var value = void 0;
@@ -3693,7 +3711,7 @@
3693
3711
  var output;
3694
3712
  if (!!sources) {
3695
3713
  if (!isArray(sources)) {
3696
- logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
3714
+ _throwInternal(logger, 1 , 54 , "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
3697
3715
  }
3698
3716
  else {
3699
3717
  output = [];
@@ -3744,7 +3762,7 @@
3744
3762
  }
3745
3763
  else {
3746
3764
  output[field] = "invalid field: " + name + " is of unknown type.";
3747
- logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
3765
+ _throwInternal(logger, 1 , output[field], null, true);
3748
3766
  }
3749
3767
  });
3750
3768
  }
@@ -3995,7 +4013,7 @@
3995
4013
  _self.triggerSend(isAsync, null, sendReason || 1 );
3996
4014
  }
3997
4015
  catch (e) {
3998
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
4016
+ _throwInternal(_self.diagLog(), 1 , 22 , "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
3999
4017
  }
4000
4018
  }
4001
4019
  };
@@ -4006,7 +4024,7 @@
4006
4024
  _self.triggerSend(true, _doUnloadSend, 2 );
4007
4025
  }
4008
4026
  catch (e) {
4009
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
4027
+ _throwInternal(_self.diagLog(), 1 , 20 , "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
4010
4028
  }
4011
4029
  }
4012
4030
  else {
@@ -4019,7 +4037,7 @@
4019
4037
  };
4020
4038
  _self.initialize = function (config, core, extensions, pluginChain) {
4021
4039
  if (_self.isInitialized()) {
4022
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender is already initialized");
4040
+ _throwInternal(_self.diagLog(), 1 , 28 , "Sender is already initialized");
4023
4041
  }
4024
4042
  _base.initialize(config, core, extensions, pluginChain);
4025
4043
  var ctx = _self._getTelCtx();
@@ -4041,7 +4059,7 @@
4041
4059
  ? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
4042
4060
  _self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
4043
4061
  if (!_validateInstrumentationKey(config)) {
4044
- _throwInternal(diagLog, LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
4062
+ _throwInternal(diagLog, 1 , 100 , "Invalid Instrumentation key " + config.instrumentationKey);
4045
4063
  }
4046
4064
  if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
4047
4065
  arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
@@ -4087,22 +4105,22 @@
4087
4105
  return;
4088
4106
  }
4089
4107
  if (!telemetryItem) {
4090
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
4108
+ _throwInternal(itemCtx.diagLog(), 1 , 7 , "Cannot send empty telemetry");
4091
4109
  return;
4092
4110
  }
4093
4111
  if (telemetryItem.baseData && !telemetryItem.baseType) {
4094
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
4112
+ _throwInternal(itemCtx.diagLog(), 1 , 70 , "Cannot send telemetry without baseData and baseType");
4095
4113
  return;
4096
4114
  }
4097
4115
  if (!telemetryItem.baseType) {
4098
4116
  telemetryItem.baseType = "EventData";
4099
4117
  }
4100
4118
  if (!_self._sender) {
4101
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
4119
+ _throwInternal(itemCtx.diagLog(), 1 , 28 , "Sender was not initialized");
4102
4120
  return;
4103
4121
  }
4104
4122
  if (!_isSampledIn(telemetryItem)) {
4105
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
4123
+ _throwInternal(itemCtx.diagLog(), 2 , 33 , "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
4106
4124
  return;
4107
4125
  }
4108
4126
  else {
@@ -4112,7 +4130,7 @@
4112
4130
  var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
4113
4131
  var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
4114
4132
  if (!aiEnvelope_1) {
4115
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
4133
+ _throwInternal(itemCtx.diagLog(), 1 , 47 , "Unable to create an AppInsights envelope");
4116
4134
  return;
4117
4135
  }
4118
4136
  var doNotSendItem_1 = false;
@@ -4121,11 +4139,11 @@
4121
4139
  try {
4122
4140
  if (callBack && callBack(aiEnvelope_1) === false) {
4123
4141
  doNotSendItem_1 = true;
4124
- itemCtx.diagLog().warnToConsole("Telemetry processor check returns false");
4142
+ _warnToConsole(itemCtx.diagLog(), "Telemetry processor check returns false");
4125
4143
  }
4126
4144
  }
4127
4145
  catch (e) {
4128
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
4146
+ _throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
4129
4147
  }
4130
4148
  });
4131
4149
  delete telemetryItem.tags[ProcessLegacy];
@@ -4143,7 +4161,7 @@
4143
4161
  _setupTimer();
4144
4162
  }
4145
4163
  catch (e) {
4146
- _throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
4164
+ _throwInternal(itemCtx.diagLog(), 2 , 12 , "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
4147
4165
  }
4148
4166
  _self.processNext(telemetryItem, itemCtx);
4149
4167
  };
@@ -4178,7 +4196,7 @@
4178
4196
  catch (e) {
4179
4197
  var ieVer = getIEVersion();
4180
4198
  if (!ieVer || ieVer > 9) {
4181
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
4199
+ _throwInternal(_self.diagLog(), 1 , 40 , "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
4182
4200
  }
4183
4201
  }
4184
4202
  }
@@ -4189,7 +4207,7 @@
4189
4207
  _initDefaults();
4190
4208
  };
4191
4209
  _self._onError = function (payload, message, event) {
4192
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
4210
+ _throwInternal(_self.diagLog(), 2 , 26 , "Failed to send telemetry.", { message: message });
4193
4211
  _self._buffer.clearSent(payload);
4194
4212
  };
4195
4213
  _self._onPartialSuccess = function (payload, results) {
@@ -4214,7 +4232,7 @@
4214
4232
  }
4215
4233
  if (retry.length > 0) {
4216
4234
  _resendPayload(retry);
4217
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
4235
+ _throwInternal(_self.diagLog(), 2 , 40 , "Partial success. " +
4218
4236
  "Delivered: " + payload.length + ", Failed: " + failed.length +
4219
4237
  ". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
4220
4238
  }
@@ -4259,7 +4277,7 @@
4259
4277
  }
4260
4278
  if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
4261
4279
  _resendPayload(payload);
4262
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
4280
+ _throwInternal(_self.diagLog(), 2 , 40 , ". " +
4263
4281
  "Response code " + status + ". Will retry to send " + payload.length + " items.");
4264
4282
  }
4265
4283
  else {
@@ -4270,7 +4288,7 @@
4270
4288
  if (!_self._senderConfig.isRetryDisabled()) {
4271
4289
  var offlineBackOffMultiplier = 10;
4272
4290
  _resendPayload(payload, offlineBackOffMultiplier);
4273
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
4291
+ _throwInternal(_self.diagLog(), 2 , 40 , ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
4274
4292
  }
4275
4293
  }
4276
4294
  else {
@@ -4338,7 +4356,7 @@
4338
4356
  }
4339
4357
  if (droppedPayload.length > 0) {
4340
4358
  _fallbackSender && _fallbackSender(droppedPayload, true);
4341
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
4359
+ _throwInternal(_self.diagLog(), 2 , 40 , ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
4342
4360
  }
4343
4361
  }
4344
4362
  }
@@ -4379,7 +4397,7 @@
4379
4397
  }
4380
4398
  else {
4381
4399
  _fallbackSender && _fallbackSender(payload, true);
4382
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
4400
+ _throwInternal(_self.diagLog(), 2 , 40 , ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
4383
4401
  }
4384
4402
  }
4385
4403
  }
@@ -4470,7 +4488,7 @@
4470
4488
  }
4471
4489
  }
4472
4490
  catch (e) {
4473
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
4491
+ _throwInternal(_self.diagLog(), 1 , 43 , "Cannot parse the response. " + getExceptionName(e), {
4474
4492
  response: response
4475
4493
  });
4476
4494
  }
@@ -4541,7 +4559,7 @@
4541
4559
  xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
4542
4560
  var hostingProtocol = _window && _window.location && _window.location.protocol || "";
4543
4561
  if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
4544
- _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
4562
+ _throwInternal(_self.diagLog(), 2 , 40 , ". " +
4545
4563
  "Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
4546
4564
  buffer.clear();
4547
4565
  return;
@@ -4572,7 +4590,7 @@
4572
4590
  manager.eventsSendRequest(sendRequest, isAsync);
4573
4591
  }
4574
4592
  catch (e) {
4575
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
4593
+ _throwInternal(_self.diagLog(), 1 , 74 , "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
4576
4594
  }
4577
4595
  }
4578
4596
  }