@microsoft/1ds-core-js 3.2.10 → 4.0.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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/bundle/es5/ms.core-4.0.0.gbl.js +6221 -0
  3. package/bundle/es5/ms.core-4.0.0.gbl.js.map +1 -0
  4. package/bundle/es5/ms.core-4.0.0.gbl.min.js +7 -0
  5. package/bundle/es5/ms.core-4.0.0.gbl.min.js.map +1 -0
  6. package/bundle/es5/ms.core-4.0.0.integrity.json +46 -0
  7. package/bundle/es5/ms.core-4.0.0.js +6225 -0
  8. package/bundle/es5/ms.core-4.0.0.js.map +1 -0
  9. package/bundle/es5/ms.core-4.0.0.min.js +7 -0
  10. package/bundle/es5/ms.core-4.0.0.min.js.map +1 -0
  11. package/bundle/es5/ms.core.gbl.js +6221 -0
  12. package/bundle/es5/ms.core.gbl.js.map +1 -0
  13. package/bundle/es5/ms.core.gbl.min.js +7 -0
  14. package/bundle/es5/ms.core.gbl.min.js.map +1 -0
  15. package/bundle/es5/ms.core.integrity.json +46 -0
  16. package/bundle/es5/ms.core.js +6225 -0
  17. package/bundle/es5/ms.core.js.map +1 -0
  18. package/bundle/es5/ms.core.min.js +7 -0
  19. package/bundle/es5/ms.core.min.js.map +1 -0
  20. package/{bundle → dist/es5}/ms.core.js +3798 -2954
  21. package/dist/es5/ms.core.js.map +1 -0
  22. package/dist/es5/ms.core.min.js +7 -0
  23. package/dist/es5/ms.core.min.js.map +1 -0
  24. package/dist-es5/AppInsightsCore.js +91 -0
  25. package/dist-es5/AppInsightsCore.js.map +1 -0
  26. package/{dist-esm/src → dist-es5}/BaseCore.js +18 -11
  27. package/dist-es5/BaseCore.js.map +1 -0
  28. package/{dist-esm/src → dist-es5}/DataModels.js +1 -1
  29. package/{dist-esm/src → dist-es5}/Enums.js +3 -26
  30. package/dist-es5/Enums.js.map +1 -0
  31. package/{dist-esm/src → dist-es5}/Index.js +9 -14
  32. package/dist-es5/Index.js.map +1 -0
  33. package/{dist-esm/src → dist-es5}/InternalConstants.js +1 -3
  34. package/{dist-esm/src → dist-es5}/InternalConstants.js.map +1 -1
  35. package/{dist-esm/src → dist-es5}/Utils.js +19 -144
  36. package/dist-es5/Utils.js.map +1 -0
  37. package/{dist-esm/src → dist-es5}/ValueSanitizer.js +39 -3
  38. package/dist-es5/ValueSanitizer.js.map +1 -0
  39. package/package.json +18 -10
  40. package/tsconfig.json +5 -3
  41. package/types/1ds-core-js.d.ts +1106 -0
  42. package/types/1ds-core-js.namespaced.d.ts +1102 -0
  43. package/bundle/ms.core-3.2.10.gbl.js +0 -5357
  44. package/bundle/ms.core-3.2.10.gbl.js.map +0 -1
  45. package/bundle/ms.core-3.2.10.gbl.min.js +0 -7
  46. package/bundle/ms.core-3.2.10.gbl.min.js.map +0 -1
  47. package/bundle/ms.core-3.2.10.integrity.json +0 -46
  48. package/bundle/ms.core-3.2.10.js +0 -5360
  49. package/bundle/ms.core-3.2.10.js.map +0 -1
  50. package/bundle/ms.core-3.2.10.min.js +0 -7
  51. package/bundle/ms.core-3.2.10.min.js.map +0 -1
  52. package/bundle/ms.core.gbl.js +0 -5357
  53. package/bundle/ms.core.gbl.js.map +0 -1
  54. package/bundle/ms.core.gbl.min.js +0 -7
  55. package/bundle/ms.core.gbl.min.js.map +0 -1
  56. package/bundle/ms.core.integrity.json +0 -46
  57. package/bundle/ms.core.js.map +0 -1
  58. package/bundle/ms.core.min.js +0 -7
  59. package/bundle/ms.core.min.js.map +0 -1
  60. package/dist/ms.core.js +0 -1305
  61. package/dist/ms.core.js.map +0 -1
  62. package/dist/ms.core.min.js +0 -7
  63. package/dist/ms.core.min.js.map +0 -1
  64. package/dist-esm/src/AppInsightsCore.d.ts +0 -15
  65. package/dist-esm/src/AppInsightsCore.js +0 -114
  66. package/dist-esm/src/AppInsightsCore.js.map +0 -1
  67. package/dist-esm/src/BaseCore.d.ts +0 -13
  68. package/dist-esm/src/BaseCore.js.map +0 -1
  69. package/dist-esm/src/DataModels.d.ts +0 -273
  70. package/dist-esm/src/ESPromise.d.ts +0 -110
  71. package/dist-esm/src/ESPromise.js +0 -286
  72. package/dist-esm/src/ESPromise.js.map +0 -1
  73. package/dist-esm/src/ESPromiseScheduler.d.ts +0 -36
  74. package/dist-esm/src/ESPromiseScheduler.js +0 -274
  75. package/dist-esm/src/ESPromiseScheduler.js.map +0 -1
  76. package/dist-esm/src/Enums.d.ts +0 -356
  77. package/dist-esm/src/Enums.js.map +0 -1
  78. package/dist-esm/src/Index.d.ts +0 -19
  79. package/dist-esm/src/Index.js.map +0 -1
  80. package/dist-esm/src/InternalConstants.d.ts +0 -6
  81. package/dist-esm/src/Utils.d.ts +0 -190
  82. package/dist-esm/src/Utils.js.map +0 -1
  83. package/dist-esm/src/ValueSanitizer.d.ts +0 -40
  84. package/dist-esm/src/ValueSanitizer.js.map +0 -1
  85. package/src/AppInsightsCore.ts +0 -135
  86. package/src/BaseCore.ts +0 -72
  87. package/src/DataModels.ts +0 -297
  88. package/src/ESPromise.ts +0 -365
  89. package/src/ESPromiseScheduler.ts +0 -328
  90. package/src/Enums.ts +0 -386
  91. package/src/Index.ts +0 -81
  92. package/src/InternalConstants.ts +0 -16
  93. package/src/Utils.ts +0 -565
  94. package/src/ValueSanitizer.ts +0 -285
  95. /package/{dist-esm/src → dist-es5}/DataModels.js.map +0 -0
package/dist/ms.core.js DELETED
@@ -1,1305 +0,0 @@
1
- /*!
2
- * 1DS JS SDK Core, 3.2.10
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@microsoft/applicationinsights-shims'), require('@microsoft/applicationinsights-core-js'), require('@microsoft/dynamicproto-js')) :
8
- typeof define === 'function' && define.amd ? define(['exports', '@microsoft/applicationinsights-shims', '@microsoft/applicationinsights-core-js', '@microsoft/dynamicproto-js'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.oneDS = global.oneDS || {}, global.applicationinsightsShims, global.applicationinsightsCoreJs, global.dynamicProto));
10
- })(this, (function (exports, applicationinsightsShims, applicationinsightsCoreJs, dynamicProto) { 'use strict';
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
13
-
14
- var dynamicProto__default = /*#__PURE__*/_interopDefaultLegacy(dynamicProto);
15
-
16
- var ValueKind = applicationinsightsCoreJs.createEnumStyle({
17
- NotSet: 0 ,
18
- Pii_DistinguishedName: 1 ,
19
- Pii_GenericData: 2 ,
20
- Pii_IPV4Address: 3 ,
21
- Pii_IPv6Address: 4 ,
22
- Pii_MailSubject: 5 ,
23
- Pii_PhoneNumber: 6 ,
24
- Pii_QueryString: 7 ,
25
- Pii_SipAddress: 8 ,
26
- Pii_SmtpAddress: 9 ,
27
- Pii_Identity: 10 ,
28
- Pii_Uri: 11 ,
29
- Pii_Fqdn: 12 ,
30
- Pii_IPV4AddressLegacy: 13 ,
31
- CustomerContent_GenericContent: 32
32
- });
33
- var EventLatency = applicationinsightsCoreJs.createEnumStyle({
34
- Normal: 1 ,
35
- CostDeferred: 2 ,
36
- RealTime: 3 ,
37
- Immediate: 4
38
- });
39
- var EventPropertyType = applicationinsightsCoreJs.createEnumStyle({
40
- Unspecified: 0 ,
41
- String: 1 ,
42
- Int32: 2 ,
43
- UInt32: 3 ,
44
- Int64: 4 ,
45
- UInt64: 5 ,
46
- Double: 6 ,
47
- Bool: 7 ,
48
- Guid: 8 ,
49
- DateTime: 9
50
- });
51
- var EventPersistence = applicationinsightsCoreJs.createEnumStyle({
52
- Normal: 1 ,
53
- Critical: 2
54
- });
55
- var TraceLevel = applicationinsightsCoreJs.createEnumStyle({
56
- NONE: 0 ,
57
- ERROR: 1 ,
58
- WARNING: 2 ,
59
- INFORMATION: 3
60
- });
61
- var _ExtendedInternalMessageId = applicationinsightsCoreJs.objFreeze(applicationinsightsShims.__assignFn(applicationinsightsShims.__assignFn({}, applicationinsightsCoreJs._InternalMessageId), applicationinsightsCoreJs.createEnumStyle({
62
- AuthHandShakeError: 501 ,
63
- AuthRedirectFail: 502 ,
64
- BrowserCannotReadLocalStorage: 503 ,
65
- BrowserCannotWriteLocalStorage: 504 ,
66
- BrowserDoesNotSupportLocalStorage: 505 ,
67
- CannotParseBiBlobValue: 506 ,
68
- CannotParseDataAttribute: 507 ,
69
- CVPluginNotAvailable: 508 ,
70
- DroppedEvent: 509 ,
71
- ErrorParsingAISessionCookie: 510 ,
72
- ErrorProvidedChannels: 511 ,
73
- FailedToGetCookies: 512 ,
74
- FailedToInitializeCorrelationVector: 513 ,
75
- FailedToInitializeSDK: 514 ,
76
- InvalidContentBlob: 515 ,
77
- InvalidCorrelationValue: 516 ,
78
- SessionRenewalDateIsZero: 517 ,
79
- SendPostOnCompleteFailure: 518 ,
80
- PostResponseHandler: 519 ,
81
- SDKNotInitialized: 520
82
- })));
83
-
84
- var STR_EMPTY = "";
85
- var STR_DEFAULT_ENDPOINT_URL = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
86
- var STR_VERSION = "version";
87
- var STR_PROPERTIES = "properties";
88
-
89
- var _a;
90
- var Version = '3.2.10';
91
- var FullVersionString = "1DS-Web-JS-" + Version;
92
- var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
93
- var strWithCredentials = "withCredentials";
94
- var strTimeout = "timeout";
95
- var _fieldTypeEventPropMap = (_a = {},
96
- _a[0 ] = 0 ,
97
- _a[2 ] = 6 ,
98
- _a[1 ] = 1 ,
99
- _a[3 ] = 7 ,
100
- _a[4096 | 2 ] = 6 ,
101
- _a[4096 | 1 ] = 1 ,
102
- _a[4096 | 3 ] = 7 ,
103
- _a);
104
- var uInt8ArraySupported = null;
105
- var isDocumentObjectAvailable = Boolean(applicationinsightsCoreJs.getDocument());
106
- var isWindowObjectAvailable = Boolean(applicationinsightsCoreJs.getWindow());
107
- function isValueAssigned(value) {
108
- return !(value === STR_EMPTY || applicationinsightsCoreJs.isNullOrUndefined(value));
109
- }
110
- function getTenantId(apiKey) {
111
- if (apiKey) {
112
- var indexTenantId = apiKey.indexOf("-");
113
- if (indexTenantId > -1) {
114
- return apiKey.substring(0, indexTenantId);
115
- }
116
- }
117
- return STR_EMPTY;
118
- }
119
- function isUint8ArrayAvailable() {
120
- if (uInt8ArraySupported === null) {
121
- uInt8ArraySupported = !applicationinsightsCoreJs.isUndefined(Uint8Array) && !isSafariOrFirefox() && !applicationinsightsCoreJs.isReactNative();
122
- }
123
- return uInt8ArraySupported;
124
- }
125
- function isLatency(value) {
126
- if (value && applicationinsightsCoreJs.isNumber(value) && value >= 1 && value <= 4 ) {
127
- return true;
128
- }
129
- return false;
130
- }
131
- function sanitizeProperty(name, property, stringifyObjects) {
132
- if ((!property && !isValueAssigned(property)) || typeof name !== "string") {
133
- return null;
134
- }
135
- var propType = typeof property;
136
- if (propType === "string" || propType === "number" || propType === "boolean" || applicationinsightsCoreJs.isArray(property)) {
137
- property = { value: property };
138
- }
139
- else if (propType === "object" && !applicationinsightsShims.ObjHasOwnProperty.call(property, "value")) {
140
- property = { value: stringifyObjects ? JSON.stringify(property) : property };
141
- }
142
- else if (applicationinsightsCoreJs.isNullOrUndefined(property.value)
143
- || property.value === STR_EMPTY || (!applicationinsightsCoreJs.isString(property.value)
144
- && !applicationinsightsCoreJs.isNumber(property.value) && !applicationinsightsCoreJs.isBoolean(property.value)
145
- && !applicationinsightsCoreJs.isArray(property.value))) {
146
- return null;
147
- }
148
- if (applicationinsightsCoreJs.isArray(property.value) &&
149
- !isArrayValid(property.value)) {
150
- return null;
151
- }
152
- if (!applicationinsightsCoreJs.isNullOrUndefined(property.kind)) {
153
- if (applicationinsightsCoreJs.isArray(property.value) || !isValueKind(property.kind)) {
154
- return null;
155
- }
156
- property.value = property.value.toString();
157
- }
158
- return property;
159
- }
160
- function getCommonSchemaMetaData(value, kind, type) {
161
- var encodedTypeValue = -1;
162
- if (!applicationinsightsCoreJs.isUndefined(value)) {
163
- if (kind > 0) {
164
- if (kind === 32) {
165
- encodedTypeValue = (1 << 13);
166
- }
167
- else if (kind <= 13) {
168
- encodedTypeValue = (kind << 5);
169
- }
170
- }
171
- if (isDataType(type)) {
172
- if (encodedTypeValue === -1) {
173
- encodedTypeValue = 0;
174
- }
175
- encodedTypeValue |= type;
176
- }
177
- else {
178
- var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;
179
- if (encodedTypeValue !== -1 && propType !== -1) {
180
- encodedTypeValue |= propType;
181
- }
182
- else if (propType === 6 ) {
183
- encodedTypeValue = propType;
184
- }
185
- }
186
- }
187
- return encodedTypeValue;
188
- }
189
- function disableCookies() {
190
- applicationinsightsCoreJs.safeGetCookieMgr(null).setEnabled(false);
191
- }
192
- function setCookie(name, value, days) {
193
- if (applicationinsightsCoreJs.areCookiesSupported(null)) {
194
- applicationinsightsCoreJs.safeGetCookieMgr(null).set(name, value, days * 86400, null, "/");
195
- }
196
- }
197
- function deleteCookie(name) {
198
- if (applicationinsightsCoreJs.areCookiesSupported(null)) {
199
- applicationinsightsCoreJs.safeGetCookieMgr(null).del(name);
200
- }
201
- }
202
- function getCookie(name) {
203
- if (applicationinsightsCoreJs.areCookiesSupported(null)) {
204
- return getCookieValue(applicationinsightsCoreJs.safeGetCookieMgr(null), name);
205
- }
206
- return STR_EMPTY;
207
- }
208
- function getCookieValue(cookieMgr, name, decode) {
209
- if (decode === void 0) { decode = true; }
210
- var cookieValue;
211
- if (cookieMgr) {
212
- cookieValue = cookieMgr.get(name);
213
- if (decode && cookieValue && decodeURIComponent) {
214
- cookieValue = decodeURIComponent(cookieValue);
215
- }
216
- }
217
- return cookieValue || STR_EMPTY;
218
- }
219
- function createGuid(style) {
220
- if (style === void 0) { style = "D" ; }
221
- var theGuid = applicationinsightsCoreJs.newGuid();
222
- if (style === "B" ) {
223
- theGuid = "{" + theGuid + "}";
224
- }
225
- else if (style === "P" ) {
226
- theGuid = "(" + theGuid + ")";
227
- }
228
- else if (style === "N" ) {
229
- theGuid = theGuid.replace(/-/g, STR_EMPTY);
230
- }
231
- return theGuid;
232
- }
233
- function extend(obj, obj2, obj3, obj4, obj5) {
234
- var extended = {};
235
- var deep = false;
236
- var i = 0;
237
- var length = arguments.length;
238
- var objProto = Object[applicationinsightsShims.strShimPrototype];
239
- var theArgs = arguments;
240
- if (objProto.toString.call(theArgs[0]) === "[object Boolean]") {
241
- deep = theArgs[0];
242
- i++;
243
- }
244
- for (; i < length; i++) {
245
- var obj = theArgs[i];
246
- applicationinsightsCoreJs.objForEachKey(obj, function (prop, value) {
247
- if (deep && value && applicationinsightsCoreJs.isObject(value)) {
248
- if (applicationinsightsCoreJs.isArray(value)) {
249
- extended[prop] = extended[prop] || [];
250
- applicationinsightsCoreJs.arrForEach(value, function (arrayValue, arrayIndex) {
251
- if (arrayValue && applicationinsightsCoreJs.isObject(arrayValue)) {
252
- extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);
253
- }
254
- else {
255
- extended[prop][arrayIndex] = arrayValue;
256
- }
257
- });
258
- }
259
- else {
260
- extended[prop] = extend(true, extended[prop], value);
261
- }
262
- }
263
- else {
264
- extended[prop] = value;
265
- }
266
- });
267
- }
268
- return extended;
269
- }
270
- var getTime = applicationinsightsCoreJs.perfNow;
271
- function isValueKind(value) {
272
- if (value === 0 || ((value > 0 && value <= 13 ) || value === 32 )) {
273
- return true;
274
- }
275
- return false;
276
- }
277
- function isDataType(value) {
278
- if (value >= 0 && value <= 9) {
279
- return true;
280
- }
281
- return false;
282
- }
283
- function isSafariOrFirefox() {
284
- var nav = applicationinsightsCoreJs.getNavigator();
285
- if (!applicationinsightsCoreJs.isUndefined(nav) && nav.userAgent) {
286
- var ua = nav.userAgent.toLowerCase();
287
- if ((ua.indexOf("safari") >= 0 || ua.indexOf("firefox") >= 0) && ua.indexOf("chrome") < 0) {
288
- return true;
289
- }
290
- }
291
- return false;
292
- }
293
- function isArrayValid(value) {
294
- return value.length > 0;
295
- }
296
- function setProcessTelemetryTimings(event, identifier) {
297
- var evt = event;
298
- evt.timings = evt.timings || {};
299
- evt.timings.processTelemetryStart = evt.timings.processTelemetryStart || {};
300
- evt.timings.processTelemetryStart[identifier] = getTime();
301
- }
302
- function getFieldValueType(value) {
303
- var theType = 0 ;
304
- if (value !== null && value !== undefined) {
305
- var objType = typeof value;
306
- if (objType === "string") {
307
- theType = 1 ;
308
- }
309
- else if (objType === "number") {
310
- theType = 2 ;
311
- }
312
- else if (objType === "boolean") {
313
- theType = 3 ;
314
- }
315
- else if (objType === applicationinsightsShims.strShimObject) {
316
- theType = 4 ;
317
- if (applicationinsightsCoreJs.isArray(value)) {
318
- theType = 4096 ;
319
- if (value.length > 0) {
320
- theType |= getFieldValueType(value[0]);
321
- }
322
- }
323
- else if (applicationinsightsShims.ObjHasOwnProperty.call(value, "value")) {
324
- theType = 8192 | getFieldValueType(value.value);
325
- }
326
- }
327
- }
328
- return theType;
329
- }
330
- var Utils = {
331
- Version: Version,
332
- FullVersionString: FullVersionString,
333
- strUndefined: applicationinsightsCoreJs.strUndefined,
334
- strObject: applicationinsightsCoreJs.strObject,
335
- Undefined: applicationinsightsCoreJs.strUndefined,
336
- arrForEach: applicationinsightsCoreJs.arrForEach,
337
- arrIndexOf: applicationinsightsCoreJs.arrIndexOf,
338
- arrMap: applicationinsightsCoreJs.arrMap,
339
- arrReduce: applicationinsightsCoreJs.arrReduce,
340
- objKeys: applicationinsightsCoreJs.objKeys,
341
- toISOString: applicationinsightsCoreJs.toISOString,
342
- isReactNative: applicationinsightsCoreJs.isReactNative,
343
- isString: applicationinsightsCoreJs.isString,
344
- isNumber: applicationinsightsCoreJs.isNumber,
345
- isBoolean: applicationinsightsCoreJs.isBoolean,
346
- isFunction: applicationinsightsCoreJs.isFunction,
347
- isArray: applicationinsightsCoreJs.isArray,
348
- isObject: applicationinsightsCoreJs.isObject,
349
- strTrim: applicationinsightsCoreJs.strTrim,
350
- isDocumentObjectAvailable: isDocumentObjectAvailable,
351
- isWindowObjectAvailable: isWindowObjectAvailable,
352
- isValueAssigned: isValueAssigned,
353
- getTenantId: getTenantId,
354
- isBeaconsSupported: applicationinsightsCoreJs.isBeaconsSupported,
355
- isUint8ArrayAvailable: isUint8ArrayAvailable,
356
- isLatency: isLatency,
357
- sanitizeProperty: sanitizeProperty,
358
- getISOString: applicationinsightsCoreJs.toISOString,
359
- useXDomainRequest: applicationinsightsCoreJs.useXDomainRequest,
360
- getCommonSchemaMetaData: getCommonSchemaMetaData,
361
- cookieAvailable: applicationinsightsCoreJs.areCookiesSupported,
362
- disallowsSameSiteNone: applicationinsightsCoreJs.uaDisallowsSameSiteNone,
363
- setCookie: setCookie,
364
- deleteCookie: deleteCookie,
365
- getCookie: getCookie,
366
- createGuid: createGuid,
367
- extend: extend,
368
- getTime: getTime,
369
- isValueKind: isValueKind,
370
- isArrayValid: isArrayValid,
371
- objDefineAccessors: applicationinsightsCoreJs.objDefineAccessors,
372
- addPageUnloadEventListener: applicationinsightsCoreJs.addPageUnloadEventListener,
373
- setProcessTelemetryTimings: setProcessTelemetryTimings,
374
- addEventHandler: applicationinsightsCoreJs.addEventHandler,
375
- getFieldValueType: getFieldValueType,
376
- strEndsWith: applicationinsightsCoreJs.strEndsWith,
377
- objForEachKey: applicationinsightsCoreJs.objForEachKey
378
- };
379
- var CoreUtils = {
380
- _canUseCookies: undefined,
381
- isTypeof: applicationinsightsCoreJs.isTypeof,
382
- isUndefined: applicationinsightsCoreJs.isUndefined,
383
- isNullOrUndefined: applicationinsightsCoreJs.isNullOrUndefined,
384
- hasOwnProperty: applicationinsightsCoreJs.hasOwnProperty,
385
- isFunction: applicationinsightsCoreJs.isFunction,
386
- isObject: applicationinsightsCoreJs.isObject,
387
- isDate: applicationinsightsCoreJs.isDate,
388
- isArray: applicationinsightsCoreJs.isArray,
389
- isError: applicationinsightsCoreJs.isError,
390
- isString: applicationinsightsCoreJs.isString,
391
- isNumber: applicationinsightsCoreJs.isNumber,
392
- isBoolean: applicationinsightsCoreJs.isBoolean,
393
- toISOString: applicationinsightsCoreJs.toISOString,
394
- arrForEach: applicationinsightsCoreJs.arrForEach,
395
- arrIndexOf: applicationinsightsCoreJs.arrIndexOf,
396
- arrMap: applicationinsightsCoreJs.arrMap,
397
- arrReduce: applicationinsightsCoreJs.arrReduce,
398
- strTrim: applicationinsightsCoreJs.strTrim,
399
- objCreate: applicationinsightsShims.objCreateFn,
400
- objKeys: applicationinsightsCoreJs.objKeys,
401
- objDefineAccessors: applicationinsightsCoreJs.objDefineAccessors,
402
- addEventHandler: applicationinsightsCoreJs.addEventHandler,
403
- dateNow: applicationinsightsCoreJs.dateNow,
404
- isIE: applicationinsightsCoreJs.isIE,
405
- disableCookies: disableCookies,
406
- newGuid: applicationinsightsCoreJs.newGuid,
407
- perfNow: applicationinsightsCoreJs.perfNow,
408
- newId: applicationinsightsCoreJs.newId,
409
- randomValue: applicationinsightsCoreJs.randomValue,
410
- random32: applicationinsightsCoreJs.random32,
411
- mwcRandomSeed: applicationinsightsCoreJs.mwcRandomSeed,
412
- mwcRandom32: applicationinsightsCoreJs.mwcRandom32,
413
- generateW3CId: applicationinsightsCoreJs.generateW3CId
414
- };
415
- function isChromium() {
416
- return !!applicationinsightsCoreJs.getGlobalInst("chrome");
417
- }
418
- function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {
419
- if (disabled === void 0) { disabled = false; }
420
- if (isSync === void 0) { isSync = false; }
421
- function _wrapSetXhrProp(xhr, prop, value) {
422
- try {
423
- xhr[prop] = value;
424
- }
425
- catch (e) {
426
- }
427
- }
428
- var xhr = new XMLHttpRequest();
429
- if (disabled) {
430
- _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
431
- }
432
- if (withCredentials) {
433
- _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
434
- }
435
- xhr.open(method, urlString, !isSync);
436
- if (withCredentials) {
437
- _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
438
- }
439
- if (!isSync && timeout) {
440
- _wrapSetXhrProp(xhr, strTimeout, timeout);
441
- }
442
- return xhr;
443
- }
444
-
445
- var AppInsightsCore = /** @class */ (function (_super) {
446
- applicationinsightsShims.__extendsFn(AppInsightsCore, _super);
447
- function AppInsightsCore() {
448
- var _this = _super.call(this) || this;
449
- _this.pluginVersionStringArr = [];
450
- dynamicProto__default(AppInsightsCore, _this, function (_self, _base) {
451
- if (!_self.logger || !_self.logger.queue) {
452
- _self.logger = new applicationinsightsCoreJs.DiagnosticLogger({ loggingLevelConsole: 1 });
453
- }
454
- _self.initialize = function (config, extensions, logger, notificationManager) {
455
- applicationinsightsCoreJs.doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
456
- var _pluginVersionStringArr = _self.pluginVersionStringArr;
457
- if (config) {
458
- if (!config.endpointUrl) {
459
- config.endpointUrl = STR_DEFAULT_ENDPOINT_URL;
460
- }
461
- var propertyStorageOverride = config.propertyStorageOverride;
462
- if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {
463
- applicationinsightsCoreJs.throwError("Invalid property storage override passed.");
464
- }
465
- if (config.channels) {
466
- applicationinsightsCoreJs.arrForEach(config.channels, function (channels) {
467
- if (channels) {
468
- applicationinsightsCoreJs.arrForEach(channels, function (channel) {
469
- if (channel.identifier && channel.version) {
470
- var ver = channel.identifier + "=" + channel.version;
471
- _pluginVersionStringArr.push(ver);
472
- }
473
- });
474
- }
475
- });
476
- }
477
- }
478
- _self.getWParam = function () {
479
- return (typeof document !== "undefined" || !!config.enableWParam) ? 0 : -1;
480
- };
481
- if (extensions) {
482
- applicationinsightsCoreJs.arrForEach(extensions, function (ext) {
483
- if (ext && ext.identifier && ext.version) {
484
- var ver = ext.identifier + "=" + ext.version;
485
- _pluginVersionStringArr.push(ver);
486
- }
487
- });
488
- }
489
- _self.pluginVersionString = _pluginVersionStringArr.join(";");
490
- _self.pluginVersionStringArr = _pluginVersionStringArr;
491
- try {
492
- _base.initialize(config, extensions, logger, notificationManager);
493
- _self.pollInternalLogs("InternalLog");
494
- }
495
- catch (e) {
496
- var logger_1 = _self.logger;
497
- var message = applicationinsightsCoreJs.dumpObj(e);
498
- if (message.indexOf("channels") !== -1) {
499
- message += "\n - Channels must be provided through config.channels only!";
500
- }
501
- applicationinsightsCoreJs._throwInternal(logger_1, 1 , 514 , "SDK Initialization Failed - no telemetry will be sent: " + message);
502
- }
503
- }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
504
- };
505
- _self.track = function (item) {
506
- applicationinsightsCoreJs.doPerf(_self, function () { return "AppInsightsCore.track"; }, function () {
507
- var telemetryItem = item;
508
- if (telemetryItem) {
509
- telemetryItem.timings = telemetryItem.timings || {};
510
- telemetryItem.timings.trackStart = getTime();
511
- if (!isLatency(telemetryItem.latency)) {
512
- telemetryItem.latency = 1 ;
513
- }
514
- var itemExt = telemetryItem.ext = telemetryItem.ext || {};
515
- itemExt.sdk = itemExt.sdk || {};
516
- itemExt.sdk.ver = FullVersionString;
517
- var baseData = telemetryItem.baseData = telemetryItem.baseData || {};
518
- baseData[STR_PROPERTIES] = baseData[STR_PROPERTIES] || {};
519
- var itemProperties = baseData[STR_PROPERTIES];
520
- itemProperties[STR_VERSION] = itemProperties[STR_VERSION] || _self.pluginVersionString || STR_EMPTY;
521
- }
522
- _base.track(telemetryItem);
523
- }, function () { return ({ item: item }); }, !(item.sync));
524
- };
525
- });
526
- return _this;
527
- }
528
- AppInsightsCore.__ieDyn=1;
529
- return AppInsightsCore;
530
- }(applicationinsightsCoreJs.AppInsightsCore));
531
-
532
- var BaseCore = /** @class */ (function (_super) {
533
- applicationinsightsShims.__extendsFn(BaseCore, _super);
534
- function BaseCore() {
535
- var _this = _super.call(this) || this;
536
- dynamicProto__default(BaseCore, _this, function (_self, _base) {
537
- _self.initialize = function (config, extensions, logger, notificationManager) {
538
- if (config && !config.endpointUrl) {
539
- config.endpointUrl = STR_DEFAULT_ENDPOINT_URL;
540
- }
541
- _self.getWParam = function () {
542
- return (isDocumentObjectAvailable || !!config.enableWParam) ? 0 : -1;
543
- };
544
- try {
545
- _base.initialize(config, extensions, logger, notificationManager);
546
- }
547
- catch (e) {
548
- applicationinsightsCoreJs._throwInternal(_self.logger, 1 , 514 , "Initialization Failed: " + applicationinsightsCoreJs.dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
549
- }
550
- };
551
- _self.track = function (item) {
552
- var telemetryItem = item;
553
- if (telemetryItem) {
554
- var ext = telemetryItem.ext = telemetryItem.ext || {};
555
- ext.sdk = ext.sdk || {};
556
- ext.sdk.ver = FullVersionString;
557
- }
558
- _base.track(telemetryItem);
559
- };
560
- });
561
- return _this;
562
- }
563
- BaseCore.__ieDyn=1;
564
- return BaseCore;
565
- }(applicationinsightsCoreJs.BaseCore));
566
-
567
- var _isFunction = applicationinsightsCoreJs.isFunction;
568
- function _createPromiseAllOnResolvedFunction(values, index, resolvedCallback) {
569
- return function (value) {
570
- values[index] = value;
571
- resolvedCallback();
572
- };
573
- }
574
- var ESPromise = /** @class */ (function () {
575
- function ESPromise(resolverFunc) {
576
- var _state = 0 ;
577
- var _settledValue = null;
578
- var _queue = [];
579
- dynamicProto__default(ESPromise, this, function (_this) {
580
- _this.then = function (onResolved, onRejected) {
581
- return new ESPromise(function (resolve, reject) {
582
- _enqueue(onResolved, onRejected, resolve, reject);
583
- });
584
- };
585
- _this["catch"] = function (onRejected) {
586
- return _this.then(null, onRejected);
587
- };
588
- });
589
- function _enqueue(onResolved, onRejected, resolve, reject) {
590
- _queue.push(function () {
591
- var value;
592
- try {
593
- if (_state === 1 ) {
594
- value = _isFunction(onResolved) ? onResolved(_settledValue) : _settledValue;
595
- }
596
- else {
597
- value = _isFunction(onRejected) ? onRejected(_settledValue) : _settledValue;
598
- }
599
- if (value instanceof ESPromise) {
600
- value.then(resolve, reject);
601
- }
602
- else if (_state === 2 && !_isFunction(onRejected)) {
603
- reject(value);
604
- }
605
- else {
606
- resolve(value);
607
- }
608
- }
609
- catch (error) {
610
- reject(error);
611
- return;
612
- }
613
- });
614
- if (_state !== 0 ) {
615
- _processQueue();
616
- }
617
- }
618
- function _processQueue() {
619
- if (_queue.length > 0) {
620
- var pending_1 = _queue.slice();
621
- _queue = [];
622
- setTimeout(function () {
623
- for (var i = 0, len = pending_1.length; i < len; ++i) {
624
- try {
625
- pending_1[i]();
626
- }
627
- catch (e) {
628
- }
629
- }
630
- }, 0);
631
- }
632
- }
633
- function _resolve(value) {
634
- if (_state === 0 ) {
635
- _settledValue = value;
636
- _state = 1 ;
637
- _processQueue();
638
- }
639
- }
640
- function _reject(reason) {
641
- if (_state === 0 ) {
642
- _settledValue = reason;
643
- _state = 2 ;
644
- _processQueue();
645
- }
646
- }
647
- (function _initialize() {
648
- if (!_isFunction(resolverFunc)) {
649
- throw new TypeError("ESPromise: resolvedFunc argument is not a Function");
650
- }
651
- try {
652
- resolverFunc(_resolve, _reject);
653
- }
654
- catch (error) {
655
- _reject(error);
656
- }
657
- })();
658
- }
659
- ESPromise.resolve = function (value) {
660
- if (value instanceof ESPromise) {
661
- return value;
662
- }
663
- else if (value && _isFunction(value.then)) {
664
- return new ESPromise(function (resolve, reject) {
665
- try {
666
- value.then(resolve, reject);
667
- }
668
- catch (error) {
669
- reject(error);
670
- }
671
- });
672
- }
673
- return new ESPromise(function (resolve) {
674
- resolve(value);
675
- });
676
- };
677
- ESPromise.reject = function (reason) {
678
- return new ESPromise(function (resolve, reject) {
679
- reject(reason);
680
- });
681
- };
682
- ESPromise.all = function (iterable) {
683
- if (!iterable || !iterable.length) {
684
- return;
685
- }
686
- return new ESPromise(function (resolve, reject) {
687
- try {
688
- var values_1 = [];
689
- var pending_2 = 0;
690
- for (var lp = 0; lp < iterable.length; lp++) {
691
- var item = iterable[lp];
692
- if (item && _isFunction(item.then)) {
693
- pending_2++;
694
- item.then(_createPromiseAllOnResolvedFunction(values_1, lp, function () {
695
- if (--pending_2 === 0) {
696
- resolve(values_1);
697
- }
698
- }), reject);
699
- }
700
- else {
701
- values_1[lp] = item;
702
- }
703
- }
704
- if (pending_2 === 0) {
705
- setTimeout(function () {
706
- resolve(values_1);
707
- }, 0);
708
- }
709
- }
710
- catch (error) {
711
- reject(error);
712
- }
713
- });
714
- };
715
- ESPromise.race = function (iterable) {
716
- return new ESPromise(function (resolve, reject) {
717
- if (!iterable || !iterable.length) {
718
- return;
719
- }
720
- try {
721
- var _loop_1 = function (lp) {
722
- var item = iterable[lp];
723
- if (item && _isFunction(item.then)) {
724
- item.then(resolve, reject);
725
- }
726
- else {
727
- setTimeout(function () {
728
- resolve(item);
729
- }, 0);
730
- }
731
- };
732
- for (var lp = 0; lp < iterable.length; lp++) {
733
- _loop_1(lp);
734
- }
735
- }
736
- catch (error) {
737
- reject(error);
738
- }
739
- });
740
- };
741
- return ESPromise;
742
- }());
743
-
744
- var LazyRejectPeriod = 600000;
745
- var _schedulerId = 0;
746
- var _running = [];
747
- var _waiting = [];
748
- var _timedOut = [];
749
- function _getTime() {
750
- return new Date().getTime();
751
- }
752
- var ESPromiseScheduler = /** @class */ (function () {
753
- function ESPromiseScheduler(name, diagLog) {
754
- var _promiseId = 0;
755
- var _scheduledName = (name || "<unnamed>") + "." + _schedulerId;
756
- _schedulerId++;
757
- dynamicProto__default(ESPromiseScheduler, this, function (_this) {
758
- var _lastEvent = null;
759
- var _eventCount = 0;
760
- _this.scheduleEvent = function (startEventAction, eventName, timeout) {
761
- var uniqueId = _scheduledName + "." + _eventCount;
762
- _eventCount++;
763
- if (eventName) {
764
- uniqueId += "-(" + eventName + ")";
765
- }
766
- var uniqueEventId = uniqueId + "{" + _promiseId + "}";
767
- _promiseId++;
768
- var newScheduledEvent = {
769
- evt: null,
770
- tm: _getTime(),
771
- id: uniqueEventId,
772
- isRunning: false,
773
- isAborted: false
774
- };
775
- if (!_lastEvent) {
776
- newScheduledEvent.evt = _startWaitingEvent(newScheduledEvent);
777
- }
778
- else {
779
- newScheduledEvent.evt = _waitForPreviousEvent(newScheduledEvent, _lastEvent);
780
- }
781
- _lastEvent = newScheduledEvent;
782
- _lastEvent.evt._schId = uniqueEventId;
783
- return newScheduledEvent.evt;
784
- function _abortAndRemoveOldEvents(eventQueue) {
785
- var now = _getTime();
786
- var expired = now - LazyRejectPeriod;
787
- var len = eventQueue.length;
788
- var lp = 0;
789
- while (lp < len) {
790
- var evt = eventQueue[lp];
791
- if (evt && evt.tm < expired) {
792
- var message = null;
793
- if (evt.abort) {
794
- message = "Aborting [" + evt.id + "] due to Excessive runtime (" + (now - evt.tm) + " ms)";
795
- evt.abort(message);
796
- }
797
- else {
798
- message = "Removing [" + evt.id + "] due to Excessive runtime (" + (now - evt.tm) + " ms)";
799
- }
800
- _warnLog(message);
801
- eventQueue.splice(lp, 1);
802
- len--;
803
- }
804
- else {
805
- lp++;
806
- }
807
- }
808
- }
809
- function _cleanup(eventId, completed) {
810
- var toQueue = false;
811
- var removed = _removeQueuedEvent(_running, eventId);
812
- if (!removed) {
813
- removed = _removeQueuedEvent(_timedOut, eventId);
814
- toQueue = true;
815
- }
816
- if (removed) {
817
- if (removed.to) {
818
- clearTimeout(removed.to);
819
- removed.to = null;
820
- }
821
- var tm = _getTime() - removed.tm;
822
- if (completed) {
823
- if (!toQueue) {
824
- _debugLog("Promise [" + eventId + "] Complete -- " + tm + " ms");
825
- }
826
- else {
827
- _warnLog("Timed out event [" + eventId + "] finally complete -- " + tm + " ms");
828
- }
829
- }
830
- else {
831
- _timedOut.push(removed);
832
- _warnLog("Event [" + eventId + "] Timed out and removed -- " + tm + " ms");
833
- }
834
- }
835
- else {
836
- _debugLog("Failed to remove [" + eventId + "] from running queue");
837
- }
838
- if (_lastEvent && _lastEvent.id === eventId) {
839
- _lastEvent = null;
840
- }
841
- _abortAndRemoveOldEvents(_running);
842
- _abortAndRemoveOldEvents(_waiting);
843
- _abortAndRemoveOldEvents(_timedOut);
844
- }
845
- function _removeScheduledEvent(eventId, callback) {
846
- return function (value) {
847
- _cleanup(eventId, true);
848
- callback && callback(value);
849
- return value;
850
- };
851
- }
852
- function _waitForFinalResult(eventId, startResult, schEventResolve, schEventReject) {
853
- startResult.then(function (value) {
854
- if (value instanceof ESPromise) {
855
- _debugLog("Event [" + eventId + "] returned a promise -- waiting");
856
- _waitForFinalResult(eventId, value, schEventResolve, schEventReject);
857
- return value;
858
- }
859
- else {
860
- return _removeScheduledEvent(eventId, schEventResolve)(value);
861
- }
862
- }, _removeScheduledEvent(eventId, schEventReject));
863
- }
864
- function _createScheduledEvent(eventDetails, startEvent) {
865
- var eventId = eventDetails.id;
866
- return new ESPromise(function (schEventResolve, schEventReject) {
867
- _debugLog("Event [" + eventId + "] Starting -- waited for " + (eventDetails.wTm || "--") + " ms");
868
- eventDetails.isRunning = true;
869
- eventDetails.abort = function (message) {
870
- eventDetails.abort = null;
871
- eventDetails.isAborted = true;
872
- _cleanup(eventId, false);
873
- schEventReject(new Error(message));
874
- };
875
- var startResult = startEvent(eventId);
876
- if (startResult instanceof ESPromise) {
877
- if (timeout) {
878
- eventDetails.to = setTimeout(function () {
879
- _cleanup(eventId, false);
880
- schEventReject(new Error("Timed out after [" + timeout + "] ms"));
881
- }, timeout);
882
- }
883
- _waitForFinalResult(eventId, startResult, function (theResult) {
884
- _debugLog("Event [" + eventId + "] Resolving after " + (_getTime() - eventDetails.tm) + " ms");
885
- schEventResolve(theResult);
886
- }, schEventReject);
887
- }
888
- else {
889
- _debugLog("Promise [" + eventId + "] Auto completed as the start action did not return a promise");
890
- schEventResolve();
891
- }
892
- });
893
- }
894
- function _startWaitingEvent(eventDetails) {
895
- var now = _getTime();
896
- eventDetails.wTm = now - eventDetails.tm;
897
- eventDetails.tm = now;
898
- if (eventDetails.isAborted) {
899
- return ESPromise.reject(new Error("[" + uniqueId + "] was aborted"));
900
- }
901
- _running.push(eventDetails);
902
- return _createScheduledEvent(eventDetails, startEventAction);
903
- }
904
- function _waitForPreviousEvent(eventDetails, waitForEvent) {
905
- var waitEvent = new ESPromise(function (waitResolve, waitReject) {
906
- var runTime = _getTime() - waitForEvent.tm;
907
- var prevId = waitForEvent.id;
908
- _debugLog("[" + uniqueId + "] is waiting for [" + prevId + ":" + runTime + " ms] to complete before starting -- [" + _waiting.length + "] waiting and [" + _running.length + "] running");
909
- eventDetails.abort = function (message) {
910
- eventDetails.abort = null;
911
- _removeQueuedEvent(_waiting, uniqueId);
912
- eventDetails.isAborted = true;
913
- waitReject(new Error(message));
914
- };
915
- waitForEvent.evt.then(function (value) {
916
- _removeQueuedEvent(_waiting, uniqueId);
917
- _startWaitingEvent(eventDetails).then(waitResolve, waitReject);
918
- }, function (reason) {
919
- _removeQueuedEvent(_waiting, uniqueId);
920
- _startWaitingEvent(eventDetails).then(waitResolve, waitReject);
921
- });
922
- });
923
- _waiting.push(eventDetails);
924
- return waitEvent;
925
- }
926
- };
927
- function _removeQueuedEvent(queue, eventId) {
928
- for (var lp = 0; lp < queue.length; lp++) {
929
- if (queue[lp].id === eventId) {
930
- return queue.splice(lp, 1)[0];
931
- }
932
- }
933
- return null;
934
- }
935
- });
936
- function _debugLog(message) {
937
- var global = applicationinsightsCoreJs.getGlobal();
938
- if (global && global["QUnit"]) {
939
- console && console.log("ESPromiseScheduler[" + _scheduledName + "] " + message);
940
- }
941
- }
942
- function _warnLog(message) {
943
- applicationinsightsCoreJs._warnToConsole(diagLog, "ESPromiseScheduler[" + _scheduledName + "] " + message);
944
- }
945
- }
946
- ESPromiseScheduler.incomplete = function () {
947
- return _running;
948
- };
949
- ESPromiseScheduler.waitingToStart = function () {
950
- return _waiting;
951
- };
952
- return ESPromiseScheduler;
953
- }());
954
-
955
- var ValueSanitizer = /** @class */ (function () {
956
- function ValueSanitizer(fieldSanitizerProvider) {
957
- var _self = this;
958
- var _sanitizerMap = {};
959
- var _sanitizers = [];
960
- var _fieldSanitizers = [];
961
- if (fieldSanitizerProvider) {
962
- _fieldSanitizers.push(fieldSanitizerProvider);
963
- }
964
- function _getFieldSanitizer(path, name) {
965
- var result;
966
- var fieldLookup = _sanitizerMap[path];
967
- if (fieldLookup) {
968
- result = fieldLookup[name];
969
- }
970
- if (!result && result !== null) {
971
- if (applicationinsightsCoreJs.isString(path) && applicationinsightsCoreJs.isString(name)) {
972
- if (_fieldSanitizers.length > 0) {
973
- for (var lp = 0; lp < _fieldSanitizers.length; lp++) {
974
- if (_fieldSanitizers[lp].handleField(path, name)) {
975
- result = {
976
- canHandle: true,
977
- fieldHandler: _fieldSanitizers[lp]
978
- };
979
- break;
980
- }
981
- }
982
- }
983
- else if (_sanitizers.length === 0) {
984
- result = {
985
- canHandle: true
986
- };
987
- }
988
- }
989
- if (!result && result !== null) {
990
- result = null;
991
- for (var lp = 0; lp < _sanitizers.length; lp++) {
992
- if (_sanitizers[lp].handleField(path, name)) {
993
- result = {
994
- canHandle: true,
995
- handler: _sanitizers[lp],
996
- fieldHandler: null
997
- };
998
- break;
999
- }
1000
- }
1001
- }
1002
- if (!fieldLookup) {
1003
- fieldLookup = _sanitizerMap[path] = {};
1004
- }
1005
- fieldLookup[name] = result;
1006
- }
1007
- return result;
1008
- }
1009
- _self.addSanitizer = function (newSanitizer) {
1010
- if (newSanitizer) {
1011
- _sanitizers.push(newSanitizer);
1012
- _sanitizerMap = {};
1013
- }
1014
- };
1015
- _self.addFieldSanitizer = function (fieldSanitizer) {
1016
- if (fieldSanitizer) {
1017
- _fieldSanitizers.push(fieldSanitizer);
1018
- _sanitizerMap = {};
1019
- }
1020
- };
1021
- _self.handleField = function (path, name) {
1022
- var mapValue = _getFieldSanitizer(path, name);
1023
- return mapValue ? mapValue.canHandle : false;
1024
- };
1025
- _self.value = function (path, name, value, stringifyObjects) {
1026
- var mapValue = _getFieldSanitizer(path, name);
1027
- if (mapValue && mapValue.canHandle) {
1028
- if (!mapValue || !mapValue.canHandle) {
1029
- return null;
1030
- }
1031
- if (mapValue.handler) {
1032
- return mapValue.handler.value(path, name, value, stringifyObjects);
1033
- }
1034
- if (!applicationinsightsCoreJs.isString(name) || applicationinsightsCoreJs.isNullOrUndefined(value) || value === STR_EMPTY) {
1035
- return null;
1036
- }
1037
- var property = null;
1038
- var fieldType = getFieldValueType(value);
1039
- if ((fieldType & 8192 ) === 8192 ) {
1040
- var subType = fieldType & ~8192 ;
1041
- property = value;
1042
- if (!isValueAssigned(property.value) ||
1043
- (subType !== 1 &&
1044
- subType !== 2 &&
1045
- subType !== 3 &&
1046
- (subType & 4096 ) !== 4096 )) {
1047
- return null;
1048
- }
1049
- }
1050
- else if (fieldType === 1 ||
1051
- fieldType === 2 ||
1052
- fieldType === 3 ||
1053
- (fieldType & 4096 ) === 4096 ) {
1054
- property = _convertToProperty(path, name, value);
1055
- }
1056
- else if (fieldType === 4 ) {
1057
- property = _convertToProperty(path, name, !!stringifyObjects ? JSON.stringify(value) : value);
1058
- }
1059
- if (property) {
1060
- return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);
1061
- }
1062
- }
1063
- return null;
1064
- };
1065
- _self.property = function (path, name, property, stringifyObjects) {
1066
- var mapValue = _getFieldSanitizer(path, name);
1067
- if (!mapValue || !mapValue.canHandle) {
1068
- return null;
1069
- }
1070
- if (!applicationinsightsCoreJs.isString(name) || applicationinsightsCoreJs.isNullOrUndefined(property) || !isValueAssigned(property.value)) {
1071
- return null;
1072
- }
1073
- var fieldType = getFieldValueType(property.value);
1074
- if (fieldType === 0 ) {
1075
- return null;
1076
- }
1077
- return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);
1078
- };
1079
- function _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects) {
1080
- if (mapValue.handler) {
1081
- return mapValue.handler.property(path, name, property, stringifyObjects);
1082
- }
1083
- if (!applicationinsightsCoreJs.isNullOrUndefined(property.kind)) {
1084
- if ((fieldType & 4096 ) === 4096 || !isValueKind(property.kind)) {
1085
- return null;
1086
- }
1087
- property.value = property.value.toString();
1088
- }
1089
- return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);
1090
- }
1091
- function _convertToProperty(path, name, value) {
1092
- if (isValueAssigned(value)) {
1093
- return { value: value };
1094
- }
1095
- return null;
1096
- }
1097
- function _callFieldSanitizer(fieldProvider, path, name, theType, property) {
1098
- if (property && fieldProvider) {
1099
- var sanitizer = fieldProvider.getSanitizer(path, name, theType, property.kind, property.propertyType);
1100
- if (sanitizer) {
1101
- if (theType === 4 ) {
1102
- var newValue_1 = {};
1103
- var propValue = property.value;
1104
- applicationinsightsCoreJs.objForEachKey(propValue, function (propKey, theValue) {
1105
- var newPath = path + "." + name;
1106
- if (isValueAssigned(theValue)) {
1107
- var newProp = _convertToProperty(newPath, propKey, theValue);
1108
- newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);
1109
- if (newProp) {
1110
- newValue_1[propKey] = newProp.value;
1111
- }
1112
- }
1113
- });
1114
- property.value = newValue_1;
1115
- }
1116
- else {
1117
- var details = {
1118
- path: path,
1119
- name: name,
1120
- type: theType,
1121
- prop: property,
1122
- sanitizer: _self
1123
- };
1124
- property = sanitizer.call(_self, details);
1125
- }
1126
- }
1127
- }
1128
- return property;
1129
- }
1130
- }
1131
- ValueSanitizer.getFieldType = getFieldValueType;
1132
- return ValueSanitizer;
1133
- }());
1134
-
1135
- exports.BaseTelemetryPlugin = applicationinsightsCoreJs.BaseTelemetryPlugin;
1136
- exports.DiagnosticLogger = applicationinsightsCoreJs.DiagnosticLogger;
1137
- exports.EventHelper = applicationinsightsCoreJs.EventHelper;
1138
- exports.EventsDiscardedReason = applicationinsightsCoreJs.EventsDiscardedReason;
1139
- exports.InternalAppInsightsCore = applicationinsightsCoreJs.AppInsightsCore;
1140
- exports.InternalBaseCore = applicationinsightsCoreJs.BaseCore;
1141
- exports.LoggingSeverity = applicationinsightsCoreJs.LoggingSeverity;
1142
- exports.MinChannelPriorty = applicationinsightsCoreJs.MinChannelPriorty;
1143
- exports.NotificationManager = applicationinsightsCoreJs.NotificationManager;
1144
- exports.PerfEvent = applicationinsightsCoreJs.PerfEvent;
1145
- exports.PerfManager = applicationinsightsCoreJs.PerfManager;
1146
- exports.ProcessTelemetryContext = applicationinsightsCoreJs.ProcessTelemetryContext;
1147
- exports.Undefined = applicationinsightsCoreJs.strUndefined;
1148
- exports._InternalLogMessage = applicationinsightsCoreJs._InternalLogMessage;
1149
- exports._InternalMessageId = applicationinsightsCoreJs._InternalMessageId;
1150
- exports.__getRegisteredEvents = applicationinsightsCoreJs.__getRegisteredEvents;
1151
- exports._logInternalMessage = applicationinsightsCoreJs._logInternalMessage;
1152
- exports._throwInternal = applicationinsightsCoreJs._throwInternal;
1153
- exports._warnToConsole = applicationinsightsCoreJs._warnToConsole;
1154
- exports.addEventHandler = applicationinsightsCoreJs.addEventHandler;
1155
- exports.addEventListeners = applicationinsightsCoreJs.addEventListeners;
1156
- exports.addPageHideEventListener = applicationinsightsCoreJs.addPageHideEventListener;
1157
- exports.addPageShowEventListener = applicationinsightsCoreJs.addPageShowEventListener;
1158
- exports.addPageUnloadEventListener = applicationinsightsCoreJs.addPageUnloadEventListener;
1159
- exports.areCookiesSupported = applicationinsightsCoreJs.areCookiesSupported;
1160
- exports.arrForEach = applicationinsightsCoreJs.arrForEach;
1161
- exports.arrIndexOf = applicationinsightsCoreJs.arrIndexOf;
1162
- exports.arrMap = applicationinsightsCoreJs.arrMap;
1163
- exports.arrReduce = applicationinsightsCoreJs.arrReduce;
1164
- exports.attachEvent = applicationinsightsCoreJs.attachEvent;
1165
- exports.cookieAvailable = applicationinsightsCoreJs.areCookiesSupported;
1166
- exports.createCookieMgr = applicationinsightsCoreJs.createCookieMgr;
1167
- exports.createEnumStyle = applicationinsightsCoreJs.createEnumStyle;
1168
- exports.createProcessTelemetryContext = applicationinsightsCoreJs.createProcessTelemetryContext;
1169
- exports.createTraceParent = applicationinsightsCoreJs.createTraceParent;
1170
- exports.createUniqueNamespace = applicationinsightsCoreJs.createUniqueNamespace;
1171
- exports.createUnloadHandlerContainer = applicationinsightsCoreJs.createUnloadHandlerContainer;
1172
- exports.dateNow = applicationinsightsCoreJs.dateNow;
1173
- exports.detachEvent = applicationinsightsCoreJs.detachEvent;
1174
- exports.disallowsSameSiteNone = applicationinsightsCoreJs.uaDisallowsSameSiteNone;
1175
- exports.doPerf = applicationinsightsCoreJs.doPerf;
1176
- exports.dumpObj = applicationinsightsCoreJs.dumpObj;
1177
- exports.eventOff = applicationinsightsCoreJs.eventOff;
1178
- exports.eventOn = applicationinsightsCoreJs.eventOn;
1179
- exports.findW3cTraceParent = applicationinsightsCoreJs.findW3cTraceParent;
1180
- exports.formatTraceParent = applicationinsightsCoreJs.formatTraceParent;
1181
- exports.generateW3CId = applicationinsightsCoreJs.generateW3CId;
1182
- exports.getConsole = applicationinsightsCoreJs.getConsole;
1183
- exports.getCrypto = applicationinsightsCoreJs.getCrypto;
1184
- exports.getDocument = applicationinsightsCoreJs.getDocument;
1185
- exports.getExceptionName = applicationinsightsCoreJs.getExceptionName;
1186
- exports.getGlobal = applicationinsightsCoreJs.getGlobal;
1187
- exports.getGlobalInst = applicationinsightsCoreJs.getGlobalInst;
1188
- exports.getHistory = applicationinsightsCoreJs.getHistory;
1189
- exports.getIEVersion = applicationinsightsCoreJs.getIEVersion;
1190
- exports.getISOString = applicationinsightsCoreJs.toISOString;
1191
- exports.getJSON = applicationinsightsCoreJs.getJSON;
1192
- exports.getLocation = applicationinsightsCoreJs.getLocation;
1193
- exports.getMsCrypto = applicationinsightsCoreJs.getMsCrypto;
1194
- exports.getNavigator = applicationinsightsCoreJs.getNavigator;
1195
- exports.getPerformance = applicationinsightsCoreJs.getPerformance;
1196
- exports.getSetValue = applicationinsightsCoreJs.getSetValue;
1197
- exports.getWindow = applicationinsightsCoreJs.getWindow;
1198
- exports.hasDocument = applicationinsightsCoreJs.hasDocument;
1199
- exports.hasHistory = applicationinsightsCoreJs.hasHistory;
1200
- exports.hasJSON = applicationinsightsCoreJs.hasJSON;
1201
- exports.hasNavigator = applicationinsightsCoreJs.hasNavigator;
1202
- exports.hasOwnProperty = applicationinsightsCoreJs.hasOwnProperty;
1203
- exports.hasWindow = applicationinsightsCoreJs.hasWindow;
1204
- exports.isArray = applicationinsightsCoreJs.isArray;
1205
- exports.isBeaconsSupported = applicationinsightsCoreJs.isBeaconsSupported;
1206
- exports.isBoolean = applicationinsightsCoreJs.isBoolean;
1207
- exports.isDate = applicationinsightsCoreJs.isDate;
1208
- exports.isError = applicationinsightsCoreJs.isError;
1209
- exports.isFetchSupported = applicationinsightsCoreJs.isFetchSupported;
1210
- exports.isFunction = applicationinsightsCoreJs.isFunction;
1211
- exports.isIE = applicationinsightsCoreJs.isIE;
1212
- exports.isNotTruthy = applicationinsightsCoreJs.isNotTruthy;
1213
- exports.isNullOrUndefined = applicationinsightsCoreJs.isNullOrUndefined;
1214
- exports.isNumber = applicationinsightsCoreJs.isNumber;
1215
- exports.isObject = applicationinsightsCoreJs.isObject;
1216
- exports.isReactNative = applicationinsightsCoreJs.isReactNative;
1217
- exports.isSampledFlag = applicationinsightsCoreJs.isSampledFlag;
1218
- exports.isString = applicationinsightsCoreJs.isString;
1219
- exports.isTruthy = applicationinsightsCoreJs.isTruthy;
1220
- exports.isTypeof = applicationinsightsCoreJs.isTypeof;
1221
- exports.isUndefined = applicationinsightsCoreJs.isUndefined;
1222
- exports.isValidSpanId = applicationinsightsCoreJs.isValidSpanId;
1223
- exports.isValidTraceId = applicationinsightsCoreJs.isValidTraceId;
1224
- exports.isValidTraceParent = applicationinsightsCoreJs.isValidTraceParent;
1225
- exports.isXhrSupported = applicationinsightsCoreJs.isXhrSupported;
1226
- exports.mergeEvtNamespace = applicationinsightsCoreJs.mergeEvtNamespace;
1227
- exports.newGuid = applicationinsightsCoreJs.newGuid;
1228
- exports.newId = applicationinsightsCoreJs.newId;
1229
- exports.normalizeJsName = applicationinsightsCoreJs.normalizeJsName;
1230
- exports.objCreate = applicationinsightsCoreJs.objCreate;
1231
- exports.objDefineAccessors = applicationinsightsCoreJs.objDefineAccessors;
1232
- exports.objForEachKey = applicationinsightsCoreJs.objForEachKey;
1233
- exports.objFreeze = applicationinsightsCoreJs.objFreeze;
1234
- exports.objKeys = applicationinsightsCoreJs.objKeys;
1235
- exports.objSeal = applicationinsightsCoreJs.objSeal;
1236
- exports.optimizeObject = applicationinsightsCoreJs.optimizeObject;
1237
- exports.parseTraceParent = applicationinsightsCoreJs.parseTraceParent;
1238
- exports.perfNow = applicationinsightsCoreJs.perfNow;
1239
- exports.proxyAssign = applicationinsightsCoreJs.proxyAssign;
1240
- exports.proxyFunctionAs = applicationinsightsCoreJs.proxyFunctionAs;
1241
- exports.proxyFunctions = applicationinsightsCoreJs.proxyFunctions;
1242
- exports.random32 = applicationinsightsCoreJs.random32;
1243
- exports.randomValue = applicationinsightsCoreJs.randomValue;
1244
- exports.removeEventHandler = applicationinsightsCoreJs.removeEventHandler;
1245
- exports.removeEventListeners = applicationinsightsCoreJs.removeEventListeners;
1246
- exports.removePageHideEventListener = applicationinsightsCoreJs.removePageHideEventListener;
1247
- exports.removePageShowEventListener = applicationinsightsCoreJs.removePageShowEventListener;
1248
- exports.removePageUnloadEventListener = applicationinsightsCoreJs.removePageUnloadEventListener;
1249
- exports.safeGetCookieMgr = applicationinsightsCoreJs.safeGetCookieMgr;
1250
- exports.safeGetLogger = applicationinsightsCoreJs.safeGetLogger;
1251
- exports.setEnableEnvMocks = applicationinsightsCoreJs.setEnableEnvMocks;
1252
- exports.setValue = applicationinsightsCoreJs.setValue;
1253
- exports.strContains = applicationinsightsCoreJs.strContains;
1254
- exports.strEndsWith = applicationinsightsCoreJs.strEndsWith;
1255
- exports.strFunction = applicationinsightsCoreJs.strFunction;
1256
- exports.strObject = applicationinsightsCoreJs.strObject;
1257
- exports.strPrototype = applicationinsightsCoreJs.strPrototype;
1258
- exports.strStartsWith = applicationinsightsCoreJs.strStartsWith;
1259
- exports.strTrim = applicationinsightsCoreJs.strTrim;
1260
- exports.strUndefined = applicationinsightsCoreJs.strUndefined;
1261
- exports.throwError = applicationinsightsCoreJs.throwError;
1262
- exports.toISOString = applicationinsightsCoreJs.toISOString;
1263
- exports.useXDomainRequest = applicationinsightsCoreJs.useXDomainRequest;
1264
- exports.AppInsightsCore = AppInsightsCore;
1265
- exports.BaseCore = BaseCore;
1266
- exports.CoreUtils = CoreUtils;
1267
- exports.ESPromise = ESPromise;
1268
- exports.ESPromiseScheduler = ESPromiseScheduler;
1269
- exports.EventLatency = EventLatency;
1270
- exports.EventPersistence = EventPersistence;
1271
- exports.EventPropertyType = EventPropertyType;
1272
- exports.FullVersionString = FullVersionString;
1273
- exports.TraceLevel = TraceLevel;
1274
- exports.Utils = Utils;
1275
- exports.ValueKind = ValueKind;
1276
- exports.ValueSanitizer = ValueSanitizer;
1277
- exports.Version = Version;
1278
- exports._ExtendedInternalMessageId = _ExtendedInternalMessageId;
1279
- exports.createGuid = createGuid;
1280
- exports.deleteCookie = deleteCookie;
1281
- exports.disableCookies = disableCookies;
1282
- exports.extend = extend;
1283
- exports.getCommonSchemaMetaData = getCommonSchemaMetaData;
1284
- exports.getCookie = getCookie;
1285
- exports.getCookieValue = getCookieValue;
1286
- exports.getFieldValueType = getFieldValueType;
1287
- exports.getTenantId = getTenantId;
1288
- exports.getTime = getTime;
1289
- exports.isArrayValid = isArrayValid;
1290
- exports.isChromium = isChromium;
1291
- exports.isDocumentObjectAvailable = isDocumentObjectAvailable;
1292
- exports.isLatency = isLatency;
1293
- exports.isUint8ArrayAvailable = isUint8ArrayAvailable;
1294
- exports.isValueAssigned = isValueAssigned;
1295
- exports.isValueKind = isValueKind;
1296
- exports.isWindowObjectAvailable = isWindowObjectAvailable;
1297
- exports.openXhr = openXhr;
1298
- exports.sanitizeProperty = sanitizeProperty;
1299
- exports.setCookie = setCookie;
1300
- exports.setProcessTelemetryTimings = setProcessTelemetryTimings;
1301
-
1302
- (function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
1303
-
1304
- }));
1305
- //# sourceMappingURL=ms.core.js.map