@microsoft/applicationinsights-common 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.
- package/browser/applicationinsights-common.integrity.json +9 -9
- package/browser/applicationinsights-common.js +566 -504
- package/browser/applicationinsights-common.js.map +1 -1
- package/browser/applicationinsights-common.min.js +2 -2
- package/browser/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.api.json +1206 -399
- package/dist/applicationinsights-common.api.md +105 -28
- package/dist/applicationinsights-common.d.ts +169 -31
- package/dist/applicationinsights-common.js +566 -504
- package/dist/applicationinsights-common.js.map +1 -1
- package/dist/applicationinsights-common.min.js +2 -2
- package/dist/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.rollup.d.ts +169 -31
- package/dist-esm/ConnectionStringParser.js +1 -1
- package/dist-esm/Constants.js +1 -1
- package/dist-esm/DomHelperFuncs.js +1 -1
- package/dist-esm/Enums.js +1 -1
- package/dist-esm/HelperFuncs.js +1 -1
- package/dist-esm/Interfaces/ConnectionString.js +1 -1
- package/dist-esm/Interfaces/Context/IApplication.js +1 -1
- package/dist-esm/Interfaces/Context/IDevice.js +1 -1
- package/dist-esm/Interfaces/Context/IInternal.js +1 -1
- package/dist-esm/Interfaces/Context/ILocation.js +1 -1
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
- package/dist-esm/Interfaces/Context/ISample.js +1 -1
- package/dist-esm/Interfaces/Context/ISession.js +1 -1
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
- package/dist-esm/Interfaces/Context/IUser.js +1 -1
- package/dist-esm/Interfaces/Context/IWeb.js +1 -1
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
- package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
- package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
- package/dist-esm/Interfaces/Contracts/IData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
- package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js +9 -10
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js.map +1 -1
- package/dist-esm/Interfaces/IAppInsights.js +1 -1
- package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
- package/dist-esm/Interfaces/IConfig.js +1 -1
- package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
- package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
- package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
- package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
- package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPartC.js +1 -1
- package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
- package/dist-esm/Interfaces/IRequestContext.js +1 -1
- package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
- package/dist-esm/Interfaces/ITraceParent.js +8 -0
- package/dist-esm/Interfaces/ITraceParent.js.map +1 -0
- package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
- package/dist-esm/Interfaces/PartAExtensions.js +1 -1
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
- package/dist-esm/RequestResponseHeaders.js +13 -12
- package/dist-esm/RequestResponseHeaders.js.map +1 -1
- package/dist-esm/StorageHelperFuncs.js +12 -12
- package/dist-esm/StorageHelperFuncs.js.map +1 -1
- package/dist-esm/Telemetry/Common/Data.js +1 -1
- package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
- package/dist-esm/Telemetry/Common/DataSanitizer.js +9 -9
- package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
- package/dist-esm/Telemetry/Common/Envelope.js +1 -1
- package/dist-esm/Telemetry/Event.js +1 -1
- package/dist-esm/Telemetry/Exception.js +1 -1
- package/dist-esm/Telemetry/Metric.js +1 -1
- package/dist-esm/Telemetry/PageView.js +1 -1
- package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
- package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
- package/dist-esm/Telemetry/Trace.js +1 -1
- package/dist-esm/TelemetryItemCreator.js +42 -32
- package/dist-esm/TelemetryItemCreator.js.map +1 -1
- package/dist-esm/UrlHelperFuncs.js +1 -1
- package/dist-esm/Util.js +2 -2
- package/dist-esm/Util.js.map +1 -1
- package/dist-esm/W3cTraceParent.js +192 -0
- package/dist-esm/W3cTraceParent.js.map +1 -0
- package/dist-esm/applicationinsights-common.js +3 -2
- package/dist-esm/applicationinsights-common.js.map +1 -1
- package/package.json +2 -2
- package/src/Enums.ts +2 -3
- package/src/Interfaces/Contracts/SeverityLevel.ts +15 -2
- package/src/Interfaces/IConfig.ts +2 -9
- package/src/Interfaces/ITraceParent.ts +38 -0
- package/src/RequestResponseHeaders.ts +38 -2
- package/src/StorageHelperFuncs.ts +11 -11
- package/src/Telemetry/Common/DataSanitizer.ts +10 -10
- package/src/Telemetry/PageViewPerformance.ts +1 -1
- package/src/TelemetryItemCreator.ts +56 -44
- package/src/Util.ts +3 -3
- package/src/W3cTraceParent.ts +219 -0
- package/src/applicationinsights-common.ts +8 -3
- package/types/Enums.d.ts +2 -9
- package/types/Interfaces/Contracts/SeverityLevel.d.ts +6 -1
- package/types/Interfaces/IConfig.d.ts +3 -9
- package/types/Interfaces/ITraceParent.d.ts +32 -0
- package/types/RequestResponseHeaders.d.ts +31 -1
- package/types/Telemetry/Common/DataSanitizer.d.ts +3 -3
- package/types/TelemetryItemCreator.d.ts +15 -5
- package/types/W3cTraceParent.d.ts +59 -0
- package/types/applicationinsights-common.d.ts +5 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Common, 2.8.0-nightly.2204-
|
|
2
|
+
* Application Insights JavaScript SDK - Common, 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 = "__proto__";
|
|
117
|
-
var strUseBaseInst = 'useBaseInst';
|
|
118
|
-
var strSetInstFuncs = 'setInstFuncs';
|
|
119
|
-
var Obj = Object;
|
|
120
|
-
var _objGetPrototypeOf = 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(target) {
|
|
132
|
-
if (target) {
|
|
133
|
-
if (_objGetPrototypeOf) {
|
|
134
|
-
return _objGetPrototypeOf(target);
|
|
135
|
-
}
|
|
136
|
-
var newProto = target[str__Proto] || 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(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)) {
|
|
207
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
visited.push(baseProto);
|
|
211
|
-
baseProto = _getObjProto(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(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(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(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) {
|
|
287
|
-
var visited = [];
|
|
288
|
-
var thisProto = _getObjProto(thisTarget);
|
|
289
|
-
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
290
|
-
if (thisProto === classProto) {
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
visited.push(thisProto);
|
|
294
|
-
thisProto = _getObjProto(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 && !!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
|
|
|
344
103
|
var strToISOString = "toISOString";
|
|
@@ -547,133 +306,390 @@
|
|
|
547
306
|
while (lp < len && !(lp in arr)) {
|
|
548
307
|
lp++;
|
|
549
308
|
}
|
|
550
|
-
value = arr[lp++];
|
|
551
|
-
}
|
|
552
|
-
while (lp < len) {
|
|
553
|
-
if (lp in arr) {
|
|
554
|
-
value = callbackfn(value, arr[lp], lp, arr);
|
|
309
|
+
value = arr[lp++];
|
|
310
|
+
}
|
|
311
|
+
while (lp < len) {
|
|
312
|
+
if (lp in arr) {
|
|
313
|
+
value = callbackfn(value, arr[lp], lp, arr);
|
|
314
|
+
}
|
|
315
|
+
lp++;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return value;
|
|
319
|
+
}
|
|
320
|
+
function strTrim(str) {
|
|
321
|
+
if (str) {
|
|
322
|
+
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
323
|
+
}
|
|
324
|
+
return str;
|
|
325
|
+
}
|
|
326
|
+
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
327
|
+
var _objKeysDontEnums = [
|
|
328
|
+
"toString",
|
|
329
|
+
"toLocaleString",
|
|
330
|
+
"valueOf",
|
|
331
|
+
"hasOwnProperty",
|
|
332
|
+
"isPrototypeOf",
|
|
333
|
+
"propertyIsEnumerable",
|
|
334
|
+
"constructor"
|
|
335
|
+
];
|
|
336
|
+
function objKeys(obj) {
|
|
337
|
+
var objType = typeof obj;
|
|
338
|
+
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
339
|
+
throwTypeError("objKeys called on non-object");
|
|
340
|
+
}
|
|
341
|
+
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
342
|
+
return _objKeys(obj);
|
|
343
|
+
}
|
|
344
|
+
var result = [];
|
|
345
|
+
for (var prop in obj) {
|
|
346
|
+
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
347
|
+
result.push(prop);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (_objKeysHasDontEnumBug) {
|
|
351
|
+
var dontEnumsLength = _objKeysDontEnums.length;
|
|
352
|
+
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
353
|
+
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
354
|
+
result.push(_objKeysDontEnums[lp]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
361
|
+
if (_objDefineProperty$1) {
|
|
362
|
+
try {
|
|
363
|
+
var descriptor = {
|
|
364
|
+
enumerable: true,
|
|
365
|
+
configurable: true
|
|
366
|
+
};
|
|
367
|
+
if (getProp) {
|
|
368
|
+
descriptor.get = getProp;
|
|
369
|
+
}
|
|
370
|
+
if (setProp) {
|
|
371
|
+
descriptor.set = setProp;
|
|
372
|
+
}
|
|
373
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
catch (e) {
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
function _doNothing(value) {
|
|
382
|
+
return value;
|
|
383
|
+
}
|
|
384
|
+
function deepFreeze(obj) {
|
|
385
|
+
if (_objFreeze) {
|
|
386
|
+
objForEachKey(obj, function (name, value) {
|
|
387
|
+
if (isArray(value) || isObject(value)) {
|
|
388
|
+
_objFreeze(value);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
return objFreeze(obj);
|
|
393
|
+
}
|
|
394
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
395
|
+
function dateNow() {
|
|
396
|
+
var dt = Date;
|
|
397
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
398
|
+
}
|
|
399
|
+
function getExceptionName(object) {
|
|
400
|
+
if (isError(object)) {
|
|
401
|
+
return object.name;
|
|
402
|
+
}
|
|
403
|
+
return strEmpty$1;
|
|
404
|
+
}
|
|
405
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
406
|
+
var theValue = value;
|
|
407
|
+
if (target) {
|
|
408
|
+
theValue = target[field];
|
|
409
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
410
|
+
theValue = value;
|
|
411
|
+
target[field] = theValue;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return theValue;
|
|
415
|
+
}
|
|
416
|
+
function isTruthy(value) {
|
|
417
|
+
return !!value;
|
|
418
|
+
}
|
|
419
|
+
function throwError(message) {
|
|
420
|
+
throw new Error(message);
|
|
421
|
+
}
|
|
422
|
+
function createClassFromInterface(defaults) {
|
|
423
|
+
return /** @class */ (function () {
|
|
424
|
+
function class_1() {
|
|
425
|
+
var _this_1 = this;
|
|
426
|
+
if (defaults) {
|
|
427
|
+
objForEachKey(defaults, function (field, value) {
|
|
428
|
+
_this_1[field] = value;
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return class_1;
|
|
433
|
+
}());
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function createEnumStyle(values) {
|
|
437
|
+
var enumClass = {};
|
|
438
|
+
objForEachKey(values, function (field, value) {
|
|
439
|
+
enumClass[field] = value;
|
|
440
|
+
enumClass[value] = field;
|
|
441
|
+
});
|
|
442
|
+
return deepFreeze(enumClass);
|
|
443
|
+
}
|
|
444
|
+
function createValueMap(values) {
|
|
445
|
+
var mapClass = {};
|
|
446
|
+
objForEachKey(values, function (field, value) {
|
|
447
|
+
mapClass[field] = value[1];
|
|
448
|
+
mapClass[value[0]] = value[1];
|
|
449
|
+
});
|
|
450
|
+
return deepFreeze(mapClass);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/*!
|
|
454
|
+
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
455
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
456
|
+
*/
|
|
457
|
+
var Constructor = 'constructor';
|
|
458
|
+
var Prototype = 'prototype';
|
|
459
|
+
var strFunction = 'function';
|
|
460
|
+
var DynInstFuncTable = '_dynInstFuncs';
|
|
461
|
+
var DynProxyTag = '_isDynProxy';
|
|
462
|
+
var DynClassName = '_dynClass';
|
|
463
|
+
var DynClassNamePrefix = '_dynCls$';
|
|
464
|
+
var DynInstChkTag = '_dynInstChk';
|
|
465
|
+
var DynAllowInstChkTag = DynInstChkTag;
|
|
466
|
+
var DynProtoDefaultOptions = '_dfOpts';
|
|
467
|
+
var UnknownValue = '_unknown_';
|
|
468
|
+
var str__Proto = "__proto__";
|
|
469
|
+
var strUseBaseInst = 'useBaseInst';
|
|
470
|
+
var strSetInstFuncs = 'setInstFuncs';
|
|
471
|
+
var Obj = Object;
|
|
472
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
473
|
+
var _dynamicNames = 0;
|
|
474
|
+
function _hasOwnProperty(obj, prop) {
|
|
475
|
+
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
476
|
+
}
|
|
477
|
+
function _isObjectOrArrayPrototype(target) {
|
|
478
|
+
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
479
|
+
}
|
|
480
|
+
function _isObjectArrayOrFunctionPrototype(target) {
|
|
481
|
+
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
482
|
+
}
|
|
483
|
+
function _getObjProto(target) {
|
|
484
|
+
if (target) {
|
|
485
|
+
if (_objGetPrototypeOf) {
|
|
486
|
+
return _objGetPrototypeOf(target);
|
|
487
|
+
}
|
|
488
|
+
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
489
|
+
if (newProto) {
|
|
490
|
+
return newProto;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
function _forEachProp(target, func) {
|
|
496
|
+
var props = [];
|
|
497
|
+
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
498
|
+
if (getOwnProps) {
|
|
499
|
+
props = getOwnProps(target);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
for (var name_1 in target) {
|
|
503
|
+
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
504
|
+
props.push(name_1);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (props && props.length > 0) {
|
|
509
|
+
for (var lp = 0; lp < props.length; lp++) {
|
|
510
|
+
func(props[lp]);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
515
|
+
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
516
|
+
}
|
|
517
|
+
function _throwTypeError(message) {
|
|
518
|
+
throw new TypeError("DynamicProto: " + message);
|
|
519
|
+
}
|
|
520
|
+
function _getInstanceFuncs(thisTarget) {
|
|
521
|
+
var instFuncs = {};
|
|
522
|
+
_forEachProp(thisTarget, function (name) {
|
|
523
|
+
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
524
|
+
instFuncs[name] = thisTarget[name];
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
return instFuncs;
|
|
528
|
+
}
|
|
529
|
+
function _hasVisited(values, value) {
|
|
530
|
+
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
531
|
+
if (values[lp] === value) {
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
538
|
+
function _instFuncProxy(target, funcHost, funcName) {
|
|
539
|
+
var theFunc = funcHost[funcName];
|
|
540
|
+
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
541
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
542
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
543
|
+
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return function () {
|
|
547
|
+
return theFunc.apply(target, arguments);
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
var baseFuncs = {};
|
|
551
|
+
_forEachProp(instFuncs, function (name) {
|
|
552
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
553
|
+
});
|
|
554
|
+
var baseProto = _getObjProto(classProto);
|
|
555
|
+
var visited = [];
|
|
556
|
+
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
557
|
+
_forEachProp(baseProto, function (name) {
|
|
558
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
559
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
visited.push(baseProto);
|
|
563
|
+
baseProto = _getObjProto(baseProto);
|
|
564
|
+
}
|
|
565
|
+
return baseFuncs;
|
|
566
|
+
}
|
|
567
|
+
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
568
|
+
var instFunc = null;
|
|
569
|
+
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
570
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
571
|
+
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
572
|
+
if (!instFunc) {
|
|
573
|
+
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
574
|
+
}
|
|
575
|
+
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
576
|
+
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
577
|
+
var objProto = _getObjProto(target);
|
|
578
|
+
var visited = [];
|
|
579
|
+
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
580
|
+
var protoFunc = objProto[funcName];
|
|
581
|
+
if (protoFunc) {
|
|
582
|
+
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
visited.push(objProto);
|
|
586
|
+
objProto = _getObjProto(objProto);
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
if (canAddInst) {
|
|
590
|
+
target[funcName] = instFunc;
|
|
591
|
+
}
|
|
592
|
+
instFunc[DynInstChkTag] = 1;
|
|
593
|
+
}
|
|
594
|
+
catch (e) {
|
|
595
|
+
instFuncTable[DynAllowInstChkTag] = false;
|
|
555
596
|
}
|
|
556
|
-
lp++;
|
|
557
597
|
}
|
|
558
598
|
}
|
|
559
|
-
return
|
|
599
|
+
return instFunc;
|
|
560
600
|
}
|
|
561
|
-
function
|
|
562
|
-
|
|
563
|
-
|
|
601
|
+
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
602
|
+
var protoFunc = proto[funcName];
|
|
603
|
+
if (protoFunc === currentDynProtoProxy) {
|
|
604
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
564
605
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
568
|
-
var _objKeysDontEnums = [
|
|
569
|
-
"toString",
|
|
570
|
-
"toLocaleString",
|
|
571
|
-
"valueOf",
|
|
572
|
-
"hasOwnProperty",
|
|
573
|
-
"isPrototypeOf",
|
|
574
|
-
"propertyIsEnumerable",
|
|
575
|
-
"constructor"
|
|
576
|
-
];
|
|
577
|
-
function objKeys(obj) {
|
|
578
|
-
var objType = typeof obj;
|
|
579
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
580
|
-
throwTypeError("objKeys called on non-object");
|
|
606
|
+
if (typeof protoFunc !== strFunction) {
|
|
607
|
+
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
581
608
|
}
|
|
582
|
-
|
|
583
|
-
|
|
609
|
+
return protoFunc;
|
|
610
|
+
}
|
|
611
|
+
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
612
|
+
function _createDynamicPrototype(proto, funcName) {
|
|
613
|
+
var dynProtoProxy = function () {
|
|
614
|
+
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
615
|
+
return instFunc.apply(this, arguments);
|
|
616
|
+
};
|
|
617
|
+
dynProtoProxy[DynProxyTag] = 1;
|
|
618
|
+
return dynProtoProxy;
|
|
584
619
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
620
|
+
if (!_isObjectOrArrayPrototype(proto)) {
|
|
621
|
+
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
622
|
+
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
623
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
624
|
+
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
589
625
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
626
|
+
_forEachProp(target, function (name) {
|
|
627
|
+
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
628
|
+
instFuncs_1[name] = target[name];
|
|
629
|
+
delete target[name];
|
|
630
|
+
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
631
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
632
|
+
}
|
|
596
633
|
}
|
|
597
|
-
}
|
|
634
|
+
});
|
|
598
635
|
}
|
|
599
|
-
return result;
|
|
600
636
|
}
|
|
601
|
-
function
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if (getProp) {
|
|
609
|
-
descriptor.get = getProp;
|
|
610
|
-
}
|
|
611
|
-
if (setProp) {
|
|
612
|
-
descriptor.set = setProp;
|
|
637
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
638
|
+
if (_objGetPrototypeOf) {
|
|
639
|
+
var visited = [];
|
|
640
|
+
var thisProto = _getObjProto(thisTarget);
|
|
641
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
642
|
+
if (thisProto === classProto) {
|
|
643
|
+
return true;
|
|
613
644
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
617
|
-
catch (e) {
|
|
645
|
+
visited.push(thisProto);
|
|
646
|
+
thisProto = _getObjProto(thisProto);
|
|
618
647
|
}
|
|
619
648
|
}
|
|
620
649
|
return false;
|
|
621
650
|
}
|
|
622
|
-
function
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
626
|
-
function dateNow() {
|
|
627
|
-
var dt = Date;
|
|
628
|
-
return dt.now ? dt.now() : new dt().getTime();
|
|
629
|
-
}
|
|
630
|
-
function getExceptionName(object) {
|
|
631
|
-
if (isError(object)) {
|
|
632
|
-
return object.name;
|
|
651
|
+
function _getObjName(target, unknownValue) {
|
|
652
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
653
|
+
return target.name || unknownValue || UnknownValue;
|
|
633
654
|
}
|
|
634
|
-
return
|
|
655
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
635
656
|
}
|
|
636
|
-
function
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
theValue = target[field];
|
|
640
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
641
|
-
theValue = value;
|
|
642
|
-
target[field] = theValue;
|
|
643
|
-
}
|
|
657
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
658
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
659
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
644
660
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
throwError("[" + value + "] exists for " + field);
|
|
672
|
-
}
|
|
673
|
-
enumClass[value] = field;
|
|
674
|
-
});
|
|
675
|
-
return objFreeze(enumClass);
|
|
661
|
+
var classProto = theClass[Prototype];
|
|
662
|
+
if (!_checkPrototype(classProto, target)) {
|
|
663
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
664
|
+
}
|
|
665
|
+
var className = null;
|
|
666
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
667
|
+
className = classProto[DynClassName];
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
671
|
+
_dynamicNames++;
|
|
672
|
+
classProto[DynClassName] = className;
|
|
673
|
+
}
|
|
674
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
675
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
676
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
677
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
678
|
+
}
|
|
679
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
680
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
681
|
+
delegateFunc(target, baseFuncs);
|
|
682
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
683
|
+
if (setInstanceFunc && options) {
|
|
684
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
685
|
+
}
|
|
686
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
676
687
|
}
|
|
688
|
+
var perfDefaults = {
|
|
689
|
+
setInstFuncs: true,
|
|
690
|
+
useBaseInst: true
|
|
691
|
+
};
|
|
692
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
677
693
|
|
|
678
694
|
var strWindow = "window";
|
|
679
695
|
var strDocument = "document";
|
|
@@ -1062,7 +1078,7 @@
|
|
|
1062
1078
|
}
|
|
1063
1079
|
|
|
1064
1080
|
var _objDefineProperty = ObjDefineProperty;
|
|
1065
|
-
var version = "2.8.0-nightly.2204-
|
|
1081
|
+
var version = "2.8.0-nightly.2204-07";
|
|
1066
1082
|
var instanceName = "." + newId(6);
|
|
1067
1083
|
var _dataUid = 0;
|
|
1068
1084
|
function _createAccessor(target, prop, value) {
|
|
@@ -1585,107 +1601,18 @@
|
|
|
1585
1601
|
return _legacyCookieMgr(null, logger).del(name);
|
|
1586
1602
|
}
|
|
1587
1603
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1599
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1600
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
1601
|
-
ClientPerformanceMathError: 8 ,
|
|
1602
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
1603
|
-
ErrorPVCalc: 10 ,
|
|
1604
|
-
ExceptionWhileLoggingError: 11 ,
|
|
1605
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
1606
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
1607
|
-
FailedMonitorAjaxDur: 14 ,
|
|
1608
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
1609
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
1610
|
-
FailedMonitorAjaxSend: 17 ,
|
|
1611
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1612
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1613
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
1614
|
-
FailedToReportDataLoss: 21 ,
|
|
1615
|
-
FlushFailed: 22 ,
|
|
1616
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
1617
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
1618
|
-
NavigationTimingNotSupported: 25 ,
|
|
1619
|
-
OnError: 26 ,
|
|
1620
|
-
SessionRenewalDateIsZero: 27 ,
|
|
1621
|
-
SenderNotInitialized: 28 ,
|
|
1622
|
-
StartTrackEventFailed: 29 ,
|
|
1623
|
-
StopTrackEventFailed: 30 ,
|
|
1624
|
-
StartTrackFailed: 31 ,
|
|
1625
|
-
StopTrackFailed: 32 ,
|
|
1626
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
1627
|
-
TrackEventFailed: 34 ,
|
|
1628
|
-
TrackExceptionFailed: 35 ,
|
|
1629
|
-
TrackMetricFailed: 36 ,
|
|
1630
|
-
TrackPVFailed: 37 ,
|
|
1631
|
-
TrackPVFailedCalc: 38 ,
|
|
1632
|
-
TrackTraceFailed: 39 ,
|
|
1633
|
-
TransmissionFailed: 40 ,
|
|
1634
|
-
FailedToSetStorageBuffer: 41 ,
|
|
1635
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
1636
|
-
InvalidBackendResponse: 43 ,
|
|
1637
|
-
FailedToFixDepricatedValues: 44 ,
|
|
1638
|
-
InvalidDurationValue: 45 ,
|
|
1639
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
1640
|
-
CreateEnvelopeError: 47 ,
|
|
1641
|
-
CannotSerializeObject: 48 ,
|
|
1642
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
1643
|
-
CircularReferenceDetected: 50 ,
|
|
1644
|
-
ClearAuthContextFailed: 51 ,
|
|
1645
|
-
ExceptionTruncated: 52 ,
|
|
1646
|
-
IllegalCharsInName: 53 ,
|
|
1647
|
-
ItemNotInArray: 54 ,
|
|
1648
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
1649
|
-
MessageTruncated: 56 ,
|
|
1650
|
-
NameTooLong: 57 ,
|
|
1651
|
-
SampleRateOutOfRange: 58 ,
|
|
1652
|
-
SetAuthContextFailed: 59 ,
|
|
1653
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
1654
|
-
StringValueTooLong: 61 ,
|
|
1655
|
-
StartCalledMoreThanOnce: 62 ,
|
|
1656
|
-
StopCalledWithoutStart: 63 ,
|
|
1657
|
-
TelemetryInitializerFailed: 64 ,
|
|
1658
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
1659
|
-
UrlTooLong: 66 ,
|
|
1660
|
-
SessionStorageBufferFull: 67 ,
|
|
1661
|
-
CannotAccessCookie: 68 ,
|
|
1662
|
-
IdTooLong: 69 ,
|
|
1663
|
-
InvalidEvent: 70 ,
|
|
1664
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1665
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
1666
|
-
PluginException: 73 ,
|
|
1667
|
-
NotificationException: 74 ,
|
|
1668
|
-
SnippetScriptLoadFailure: 99 ,
|
|
1669
|
-
InvalidInstrumentationKey: 100 ,
|
|
1670
|
-
CannotParseAiBlobValue: 101 ,
|
|
1671
|
-
InvalidContentBlob: 102 ,
|
|
1672
|
-
TrackPageActionEventFailed: 103 ,
|
|
1673
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1674
|
-
InMemoryStorageBufferFull: 105
|
|
1604
|
+
var RequestHeaders = createValueMap({
|
|
1605
|
+
requestContextHeader: [0 , "Request-Context"],
|
|
1606
|
+
requestContextTargetKey: [1 , "appId"],
|
|
1607
|
+
requestContextAppIdFormat: [2 , "appId=cid-v1:"],
|
|
1608
|
+
requestIdHeader: [3 , "Request-Id"],
|
|
1609
|
+
traceParentHeader: [4 , "traceparent"],
|
|
1610
|
+
traceStateHeader: [5 , "tracestate"],
|
|
1611
|
+
sdkContextHeader: [6 , "Sdk-Context"],
|
|
1612
|
+
sdkContextHeaderAppIdRequest: [7 , "appId"],
|
|
1613
|
+
requestContextHeaderLowerCase: [8 , "request-context"]
|
|
1675
1614
|
});
|
|
1676
1615
|
|
|
1677
|
-
var RequestHeaders = {
|
|
1678
|
-
requestContextHeader: "Request-Context",
|
|
1679
|
-
requestContextTargetKey: "appId",
|
|
1680
|
-
requestContextAppIdFormat: "appId=cid-v1:",
|
|
1681
|
-
requestIdHeader: "Request-Id",
|
|
1682
|
-
traceParentHeader: "traceparent",
|
|
1683
|
-
traceStateHeader: "tracestate",
|
|
1684
|
-
sdkContextHeader: "Sdk-Context",
|
|
1685
|
-
sdkContextHeaderAppIdRequest: "appId",
|
|
1686
|
-
requestContextHeaderLowerCase: "request-context"
|
|
1687
|
-
};
|
|
1688
|
-
|
|
1689
1616
|
function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
|
|
1690
1617
|
var origLength = key.length;
|
|
1691
1618
|
var field = dataSanitizeKey(logger, key);
|
|
@@ -1706,7 +1633,7 @@
|
|
|
1706
1633
|
name = strTrim(name.toString());
|
|
1707
1634
|
if (name.length > 150 ) {
|
|
1708
1635
|
nameTrunc = name.substring(0, 150 );
|
|
1709
|
-
_throwInternal(logger, 2 ,
|
|
1636
|
+
_throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
1710
1637
|
}
|
|
1711
1638
|
}
|
|
1712
1639
|
return nameTrunc || name;
|
|
@@ -1719,20 +1646,20 @@
|
|
|
1719
1646
|
value = strTrim(value);
|
|
1720
1647
|
if (value.toString().length > maxLength) {
|
|
1721
1648
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
1722
|
-
_throwInternal(logger, 2 ,
|
|
1649
|
+
_throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
1723
1650
|
}
|
|
1724
1651
|
}
|
|
1725
1652
|
return valueTrunc || value;
|
|
1726
1653
|
}
|
|
1727
1654
|
function dataSanitizeUrl(logger, url) {
|
|
1728
|
-
return dataSanitizeInput(logger, url, 2048 ,
|
|
1655
|
+
return dataSanitizeInput(logger, url, 2048 , 66 );
|
|
1729
1656
|
}
|
|
1730
1657
|
function dataSanitizeMessage(logger, message) {
|
|
1731
1658
|
var messageTrunc;
|
|
1732
1659
|
if (message) {
|
|
1733
1660
|
if (message.length > 32768 ) {
|
|
1734
1661
|
messageTrunc = message.substring(0, 32768 );
|
|
1735
|
-
_throwInternal(logger, 2 ,
|
|
1662
|
+
_throwInternal(logger, 2 , 56 , "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
1736
1663
|
}
|
|
1737
1664
|
}
|
|
1738
1665
|
return messageTrunc || message;
|
|
@@ -1743,7 +1670,7 @@
|
|
|
1743
1670
|
var value = "" + exception;
|
|
1744
1671
|
if (value.length > 32768 ) {
|
|
1745
1672
|
exceptionTrunc = value.substring(0, 32768 );
|
|
1746
|
-
_throwInternal(logger, 2 ,
|
|
1673
|
+
_throwInternal(logger, 2 , 52 , "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
1747
1674
|
}
|
|
1748
1675
|
}
|
|
1749
1676
|
return exceptionTrunc || exception;
|
|
@@ -1757,7 +1684,7 @@
|
|
|
1757
1684
|
value = getJSON().stringify(value);
|
|
1758
1685
|
}
|
|
1759
1686
|
catch (e) {
|
|
1760
|
-
_throwInternal(logger, 2 ,
|
|
1687
|
+
_throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
|
|
1761
1688
|
}
|
|
1762
1689
|
}
|
|
1763
1690
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -1780,7 +1707,7 @@
|
|
|
1780
1707
|
return measurements;
|
|
1781
1708
|
}
|
|
1782
1709
|
function dataSanitizeId(logger, id) {
|
|
1783
|
-
return id ? dataSanitizeInput(logger, id, 128 ,
|
|
1710
|
+
return id ? dataSanitizeInput(logger, id, 128 , 69 ).toString() : id;
|
|
1784
1711
|
}
|
|
1785
1712
|
function dataSanitizeInput(logger, input, maxLength, _msgId) {
|
|
1786
1713
|
var inputTrunc;
|
|
@@ -1903,11 +1830,11 @@
|
|
|
1903
1830
|
if (isNullOrUndefined(getGlobal())) {
|
|
1904
1831
|
return null;
|
|
1905
1832
|
}
|
|
1906
|
-
var uid = new Date;
|
|
1833
|
+
var uid = (new Date).toString();
|
|
1907
1834
|
var storage = getGlobalInst(storageType === StorageType.LocalStorage ? "localStorage" : "sessionStorage");
|
|
1908
|
-
storage.setItem(uid
|
|
1909
|
-
var fail = storage.getItem(uid
|
|
1910
|
-
storage.removeItem(uid
|
|
1835
|
+
storage.setItem(uid, uid);
|
|
1836
|
+
var fail = storage.getItem(uid) !== uid;
|
|
1837
|
+
storage.removeItem(uid);
|
|
1911
1838
|
if (!fail) {
|
|
1912
1839
|
return storage;
|
|
1913
1840
|
}
|
|
@@ -1944,7 +1871,7 @@
|
|
|
1944
1871
|
}
|
|
1945
1872
|
catch (e) {
|
|
1946
1873
|
_canUseLocalStorage = false;
|
|
1947
|
-
_throwInternal(logger, 2 ,
|
|
1874
|
+
_throwInternal(logger, 2 , 1 , "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1948
1875
|
}
|
|
1949
1876
|
}
|
|
1950
1877
|
return null;
|
|
@@ -1958,7 +1885,7 @@
|
|
|
1958
1885
|
}
|
|
1959
1886
|
catch (e) {
|
|
1960
1887
|
_canUseLocalStorage = false;
|
|
1961
|
-
_throwInternal(logger, 2 ,
|
|
1888
|
+
_throwInternal(logger, 2 , 3 , "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1962
1889
|
}
|
|
1963
1890
|
}
|
|
1964
1891
|
return false;
|
|
@@ -1972,7 +1899,7 @@
|
|
|
1972
1899
|
}
|
|
1973
1900
|
catch (e) {
|
|
1974
1901
|
_canUseLocalStorage = false;
|
|
1975
|
-
_throwInternal(logger, 2 ,
|
|
1902
|
+
_throwInternal(logger, 2 , 5 , "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1976
1903
|
}
|
|
1977
1904
|
}
|
|
1978
1905
|
return false;
|
|
@@ -2000,7 +1927,7 @@
|
|
|
2000
1927
|
}
|
|
2001
1928
|
catch (e) {
|
|
2002
1929
|
_canUseSessionStorage = false;
|
|
2003
|
-
_throwInternal(logger, 2 ,
|
|
1930
|
+
_throwInternal(logger, 2 , 2 , "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2004
1931
|
}
|
|
2005
1932
|
}
|
|
2006
1933
|
return null;
|
|
@@ -2014,7 +1941,7 @@
|
|
|
2014
1941
|
}
|
|
2015
1942
|
catch (e) {
|
|
2016
1943
|
_canUseSessionStorage = false;
|
|
2017
|
-
_throwInternal(logger, 2 ,
|
|
1944
|
+
_throwInternal(logger, 2 , 4 , "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2018
1945
|
}
|
|
2019
1946
|
}
|
|
2020
1947
|
return false;
|
|
@@ -2028,7 +1955,7 @@
|
|
|
2028
1955
|
}
|
|
2029
1956
|
catch (e) {
|
|
2030
1957
|
_canUseSessionStorage = false;
|
|
2031
|
-
_throwInternal(logger, 2 ,
|
|
1958
|
+
_throwInternal(logger, 2 , 6 , "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2032
1959
|
}
|
|
2033
1960
|
}
|
|
2034
1961
|
return false;
|
|
@@ -2210,7 +2137,7 @@
|
|
|
2210
2137
|
},
|
|
2211
2138
|
getCorrelationContext: function (responseHeader) {
|
|
2212
2139
|
if (responseHeader) {
|
|
2213
|
-
var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders
|
|
2140
|
+
var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders[1 ]);
|
|
2214
2141
|
if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {
|
|
2215
2142
|
return correlationId;
|
|
2216
2143
|
}
|
|
@@ -2992,14 +2919,13 @@
|
|
|
2992
2919
|
return Data;
|
|
2993
2920
|
}());
|
|
2994
2921
|
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
})(exports.SeverityLevel || (exports.SeverityLevel = {}));
|
|
2922
|
+
var SeverityLevel = createEnumStyle({
|
|
2923
|
+
Verbose: 0 ,
|
|
2924
|
+
Information: 1 ,
|
|
2925
|
+
Warning: 2 ,
|
|
2926
|
+
Error: 3 ,
|
|
2927
|
+
Critical: 4
|
|
2928
|
+
});
|
|
3003
2929
|
|
|
3004
2930
|
var ConfigurationManager = /** @class */ (function () {
|
|
3005
2931
|
function ConfigurationManager() {
|
|
@@ -3098,38 +3024,39 @@
|
|
|
3098
3024
|
internalSdkSrc: _aiInternal("sdkSrc")
|
|
3099
3025
|
})));
|
|
3100
3026
|
|
|
3027
|
+
function createTelemetryItem(item, baseType, envelopeName, logger, customProperties, systemProperties) {
|
|
3028
|
+
envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;
|
|
3029
|
+
if (isNullOrUndefined(item) ||
|
|
3030
|
+
isNullOrUndefined(baseType) ||
|
|
3031
|
+
isNullOrUndefined(envelopeName)) {
|
|
3032
|
+
throwError("Input doesn't contain all required fields");
|
|
3033
|
+
}
|
|
3034
|
+
var iKey = "";
|
|
3035
|
+
if (item[strIkey]) {
|
|
3036
|
+
iKey = item[strIkey];
|
|
3037
|
+
delete item[strIkey];
|
|
3038
|
+
}
|
|
3039
|
+
var telemetryItem = {
|
|
3040
|
+
name: envelopeName,
|
|
3041
|
+
time: toISOString(new Date()),
|
|
3042
|
+
iKey: iKey,
|
|
3043
|
+
ext: systemProperties ? systemProperties : {},
|
|
3044
|
+
tags: [],
|
|
3045
|
+
data: {},
|
|
3046
|
+
baseType: baseType,
|
|
3047
|
+
baseData: item
|
|
3048
|
+
};
|
|
3049
|
+
if (!isNullOrUndefined(customProperties)) {
|
|
3050
|
+
objForEachKey(customProperties, function (prop, value) {
|
|
3051
|
+
telemetryItem.data[prop] = value;
|
|
3052
|
+
});
|
|
3053
|
+
}
|
|
3054
|
+
return telemetryItem;
|
|
3055
|
+
}
|
|
3101
3056
|
var TelemetryItemCreator = /** @class */ (function () {
|
|
3102
3057
|
function TelemetryItemCreator() {
|
|
3103
3058
|
}
|
|
3104
|
-
TelemetryItemCreator.create =
|
|
3105
|
-
envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;
|
|
3106
|
-
if (isNullOrUndefined(item) ||
|
|
3107
|
-
isNullOrUndefined(baseType) ||
|
|
3108
|
-
isNullOrUndefined(envelopeName)) {
|
|
3109
|
-
throw Error("Input doesn't contain all required fields");
|
|
3110
|
-
}
|
|
3111
|
-
var iKey = "";
|
|
3112
|
-
if (item[strIkey]) {
|
|
3113
|
-
iKey = item[strIkey];
|
|
3114
|
-
delete item[strIkey];
|
|
3115
|
-
}
|
|
3116
|
-
var telemetryItem = {
|
|
3117
|
-
name: envelopeName,
|
|
3118
|
-
time: toISOString(new Date()),
|
|
3119
|
-
iKey: iKey,
|
|
3120
|
-
ext: systemProperties ? systemProperties : {},
|
|
3121
|
-
tags: [],
|
|
3122
|
-
data: {},
|
|
3123
|
-
baseType: baseType,
|
|
3124
|
-
baseData: item
|
|
3125
|
-
};
|
|
3126
|
-
if (!isNullOrUndefined(customProperties)) {
|
|
3127
|
-
objForEachKey(customProperties, function (prop, value) {
|
|
3128
|
-
telemetryItem.data[prop] = value;
|
|
3129
|
-
});
|
|
3130
|
-
}
|
|
3131
|
-
return telemetryItem;
|
|
3132
|
-
};
|
|
3059
|
+
TelemetryItemCreator.create = createTelemetryItem;
|
|
3133
3060
|
return TelemetryItemCreator;
|
|
3134
3061
|
}());
|
|
3135
3062
|
|
|
@@ -3145,6 +3072,131 @@
|
|
|
3145
3072
|
};
|
|
3146
3073
|
var CtxTagKeys = new ContextTagKeys();
|
|
3147
3074
|
|
|
3075
|
+
var TRACE_PARENT_REGEX = /^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(-[^\s]*)?$/;
|
|
3076
|
+
var DEFAULT_VERSION = "00";
|
|
3077
|
+
var INVALID_VERSION = "ff";
|
|
3078
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
3079
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
3080
|
+
var SAMPLED_FLAG = 0x01;
|
|
3081
|
+
function _isValid(value, len, invalidValue) {
|
|
3082
|
+
if (value && value.length === len && value !== invalidValue) {
|
|
3083
|
+
return !!value.match(/^[\da-f]*$/);
|
|
3084
|
+
}
|
|
3085
|
+
return false;
|
|
3086
|
+
}
|
|
3087
|
+
function _formatValue(value, len, defValue) {
|
|
3088
|
+
if (_isValid(value, len)) {
|
|
3089
|
+
return value;
|
|
3090
|
+
}
|
|
3091
|
+
return defValue;
|
|
3092
|
+
}
|
|
3093
|
+
function _formatFlags(value) {
|
|
3094
|
+
if (isNaN(value) || value < 0 || value > 255) {
|
|
3095
|
+
value = 0x01;
|
|
3096
|
+
}
|
|
3097
|
+
var result = value.toString(16);
|
|
3098
|
+
while (result.length < 2) {
|
|
3099
|
+
result = "0" + result;
|
|
3100
|
+
}
|
|
3101
|
+
return result;
|
|
3102
|
+
}
|
|
3103
|
+
function _getTraceParentValue(values) {
|
|
3104
|
+
if (values) {
|
|
3105
|
+
for (var i = 0; i < values.length; i++) {
|
|
3106
|
+
var value = values[i];
|
|
3107
|
+
if (value.name) {
|
|
3108
|
+
if (value.name === "traceparent") {
|
|
3109
|
+
return value;
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
return {};
|
|
3115
|
+
}
|
|
3116
|
+
function createTraceParent(traceId, spanId, flags, version) {
|
|
3117
|
+
return {
|
|
3118
|
+
version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,
|
|
3119
|
+
traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),
|
|
3120
|
+
spanId: isValidSpanId(spanId) ? spanId : generateW3CId().substr(0, 16),
|
|
3121
|
+
traceFlags: flags >= 0 && flags <= 0xFF ? flags : 1
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
function parseTraceParent(value) {
|
|
3125
|
+
if (!value) {
|
|
3126
|
+
return null;
|
|
3127
|
+
}
|
|
3128
|
+
if (isArray(value)) {
|
|
3129
|
+
value = value[0] || "";
|
|
3130
|
+
}
|
|
3131
|
+
if (!value || !isString(value) || value.length > 8192) {
|
|
3132
|
+
return null;
|
|
3133
|
+
}
|
|
3134
|
+
var match = TRACE_PARENT_REGEX.exec(strTrim(value));
|
|
3135
|
+
if (!match ||
|
|
3136
|
+
match[1] === INVALID_VERSION ||
|
|
3137
|
+
match[2] === INVALID_TRACE_ID ||
|
|
3138
|
+
match[3] === INVALID_SPAN_ID) {
|
|
3139
|
+
return null;
|
|
3140
|
+
}
|
|
3141
|
+
return {
|
|
3142
|
+
version: match[1],
|
|
3143
|
+
traceId: match[2],
|
|
3144
|
+
spanId: match[3],
|
|
3145
|
+
traceFlags: parseInt(match[4], 16)
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
function isValidTraceId(value) {
|
|
3149
|
+
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
3150
|
+
}
|
|
3151
|
+
function isValidSpanId(value) {
|
|
3152
|
+
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
3153
|
+
}
|
|
3154
|
+
function isValidTraceParent(value) {
|
|
3155
|
+
if (!value ||
|
|
3156
|
+
!_isValid(value.version, 2, INVALID_VERSION) ||
|
|
3157
|
+
!_isValid(value.traceId, 32, INVALID_TRACE_ID) ||
|
|
3158
|
+
!_isValid(value.spanId, 16, INVALID_SPAN_ID) ||
|
|
3159
|
+
!_isValid(_formatFlags(value.traceFlags), 2)) {
|
|
3160
|
+
return false;
|
|
3161
|
+
}
|
|
3162
|
+
return true;
|
|
3163
|
+
}
|
|
3164
|
+
function isSampledFlag(value) {
|
|
3165
|
+
if (isValidTraceParent(value)) {
|
|
3166
|
+
return (value.traceFlags & SAMPLED_FLAG) === SAMPLED_FLAG;
|
|
3167
|
+
}
|
|
3168
|
+
return false;
|
|
3169
|
+
}
|
|
3170
|
+
function formatTraceParent(value) {
|
|
3171
|
+
if (value) {
|
|
3172
|
+
var flags = _formatFlags(value.traceFlags);
|
|
3173
|
+
if (!_isValid(flags, 2)) {
|
|
3174
|
+
flags = "01";
|
|
3175
|
+
}
|
|
3176
|
+
var version = value.version || DEFAULT_VERSION;
|
|
3177
|
+
if (version !== "00" && version !== "ff") {
|
|
3178
|
+
version = DEFAULT_VERSION;
|
|
3179
|
+
}
|
|
3180
|
+
return "".concat(version, "-").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), "-").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), "-").concat(flags);
|
|
3181
|
+
}
|
|
3182
|
+
return "";
|
|
3183
|
+
}
|
|
3184
|
+
function findW3cTraceParent() {
|
|
3185
|
+
var traceParent;
|
|
3186
|
+
var doc = getDocument();
|
|
3187
|
+
if (doc) {
|
|
3188
|
+
traceParent = parseTraceParent(_getTraceParentValue(doc.querySelectorAll("meta")).content);
|
|
3189
|
+
}
|
|
3190
|
+
if (!traceParent) {
|
|
3191
|
+
var perf = getPerformance();
|
|
3192
|
+
if (perf) {
|
|
3193
|
+
var navPerf = perf.getEntriesByType("navigation") || [];
|
|
3194
|
+
traceParent = parseTraceParent(_getTraceParentValue((navPerf.length > 0 ? navPerf[0] : {}).serverTiming).description);
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
return traceParent;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3148
3200
|
var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
3149
3201
|
var BreezeChannelIdentifier = "AppInsightsChannelPlugin";
|
|
3150
3202
|
var AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
|
|
@@ -3175,11 +3227,14 @@
|
|
|
3175
3227
|
exports.RemoteDependencyData = RemoteDependencyData;
|
|
3176
3228
|
exports.RequestHeaders = RequestHeaders;
|
|
3177
3229
|
exports.SampleRate = SampleRate;
|
|
3230
|
+
exports.SeverityLevel = SeverityLevel;
|
|
3178
3231
|
exports.TelemetryItemCreator = TelemetryItemCreator;
|
|
3179
3232
|
exports.Trace = Trace;
|
|
3180
3233
|
exports.UrlHelper = UrlHelper;
|
|
3181
3234
|
exports.Util = Util;
|
|
3182
3235
|
exports.createDomEvent = createDomEvent;
|
|
3236
|
+
exports.createTelemetryItem = createTelemetryItem;
|
|
3237
|
+
exports.createTraceParent = createTraceParent;
|
|
3183
3238
|
exports.dataSanitizeException = dataSanitizeException;
|
|
3184
3239
|
exports.dataSanitizeId = dataSanitizeId;
|
|
3185
3240
|
exports.dataSanitizeInput = dataSanitizeInput;
|
|
@@ -3193,12 +3248,19 @@
|
|
|
3193
3248
|
exports.dateTimeUtilsDuration = dateTimeUtilsDuration;
|
|
3194
3249
|
exports.dateTimeUtilsNow = dateTimeUtilsNow;
|
|
3195
3250
|
exports.dsPadNumber = dsPadNumber;
|
|
3251
|
+
exports.findW3cTraceParent = findW3cTraceParent;
|
|
3252
|
+
exports.formatTraceParent = formatTraceParent;
|
|
3196
3253
|
exports.getExtensionByName = getExtensionByName;
|
|
3197
3254
|
exports.isBeaconApiSupported = isBeaconsSupported;
|
|
3198
3255
|
exports.isCrossOriginError = isCrossOriginError;
|
|
3199
3256
|
exports.isInternalApplicationInsightsEndpoint = isInternalApplicationInsightsEndpoint;
|
|
3257
|
+
exports.isSampledFlag = isSampledFlag;
|
|
3258
|
+
exports.isValidSpanId = isValidSpanId;
|
|
3259
|
+
exports.isValidTraceId = isValidTraceId;
|
|
3260
|
+
exports.isValidTraceParent = isValidTraceParent;
|
|
3200
3261
|
exports.msToTimeSpan = msToTimeSpan;
|
|
3201
3262
|
exports.parseConnectionString = parseConnectionString;
|
|
3263
|
+
exports.parseTraceParent = parseTraceParent;
|
|
3202
3264
|
exports.strNotSpecified = strNotSpecified;
|
|
3203
3265
|
exports.stringToBoolOrDefault = stringToBoolOrDefault;
|
|
3204
3266
|
exports.urlGetAbsoluteUrl = urlGetAbsoluteUrl;
|