@microsoft/applicationinsights-properties-js 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28

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/browser/es5/ai.props.3.0.0-nightly3.2304-28.cjs.js +3990 -0
  2. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.cjs.js.map +1 -0
  3. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.cjs.min.js +6 -0
  4. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.cjs.min.js.map +1 -0
  5. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.gbl.js +3994 -0
  6. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.gbl.js.map +1 -0
  7. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.gbl.min.js +6 -0
  8. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.gbl.min.js.map +1 -0
  9. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.integrity.json +66 -0
  10. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.js +3996 -0
  11. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.js.map +1 -0
  12. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.min.js +6 -0
  13. package/browser/es5/ai.props.3.0.0-nightly3.2304-28.min.js.map +1 -0
  14. package/browser/es5/ai.props.3.cjs.js +3990 -0
  15. package/browser/es5/ai.props.3.cjs.js.map +1 -0
  16. package/browser/es5/ai.props.3.cjs.min.js +6 -0
  17. package/browser/es5/ai.props.3.cjs.min.js.map +1 -0
  18. package/browser/es5/ai.props.3.gbl.js +3994 -0
  19. package/browser/es5/ai.props.3.gbl.js.map +1 -0
  20. package/browser/es5/ai.props.3.gbl.min.js +6 -0
  21. package/browser/es5/ai.props.3.gbl.min.js.map +1 -0
  22. package/{dist/applicationinsights-properties-js.js → browser/es5/ai.props.3.js} +858 -828
  23. package/browser/es5/ai.props.3.js.map +1 -0
  24. package/browser/es5/ai.props.3.min.js +6 -0
  25. package/browser/es5/ai.props.3.min.js.map +1 -0
  26. package/{browser → dist/es5}/applicationinsights-properties-js.js +857 -827
  27. package/dist/es5/applicationinsights-properties-js.js.map +1 -0
  28. package/dist/es5/applicationinsights-properties-js.min.js +6 -0
  29. package/dist/es5/applicationinsights-properties-js.min.js.map +1 -0
  30. package/{dist-esm → dist-es5}/Context/Application.js +1 -1
  31. package/{dist-esm → dist-es5}/Context/Device.js +1 -1
  32. package/{dist-esm → dist-es5}/Context/Internal.js +1 -1
  33. package/{dist-esm → dist-es5}/Context/Location.js +1 -1
  34. package/{dist-esm → dist-es5}/Context/Session.js +1 -1
  35. package/{dist-esm → dist-es5}/Context/TelemetryTrace.js +1 -1
  36. package/{dist-esm → dist-es5}/Context/User.js +1 -1
  37. package/{dist-esm → dist-es5}/Interfaces/IPropTelemetryContext.js +1 -1
  38. package/{dist-esm → dist-es5}/Interfaces/IPropertiesConfig.js +1 -1
  39. package/{dist-esm → dist-es5}/PropertiesPlugin.js +1 -1
  40. package/{dist-esm → dist-es5}/TelemetryContext.js +1 -1
  41. package/{dist-esm → dist-es5}/__DynamicConstants.js +1 -1
  42. package/{dist-esm → dist-es5}/applicationinsights-properties-js.js +1 -1
  43. package/package.json +18 -17
  44. package/tsconfig.json +4 -3
  45. package/types/applicationinsights-properties-js.d.ts +161 -6
  46. package/{dist/applicationinsights-properties-js.d.ts → types/applicationinsights-properties-js.namespaced.d.ts} +1 -1
  47. package/browser/applicationinsights-properties-js.integrity.json +0 -26
  48. package/browser/applicationinsights-properties-js.js.map +0 -1
  49. package/browser/applicationinsights-properties-js.min.js +0 -6
  50. package/browser/applicationinsights-properties-js.min.js.map +0 -1
  51. package/dist/applicationinsights-properties-js.api.json +0 -3120
  52. package/dist/applicationinsights-properties-js.api.md +0 -173
  53. package/dist/applicationinsights-properties-js.js.map +0 -1
  54. package/dist/applicationinsights-properties-js.min.js +0 -6
  55. package/dist/applicationinsights-properties-js.min.js.map +0 -1
  56. package/dist/applicationinsights-properties-js.rollup.d.ts +0 -162
  57. package/src/Context/Application.ts +0 -16
  58. package/src/Context/Device.ts +0 -49
  59. package/src/Context/Internal.ts +0 -49
  60. package/src/Context/Location.ts +0 -12
  61. package/src/Context/Session.ts +0 -257
  62. package/src/Context/TelemetryTrace.ts +0 -26
  63. package/src/Context/User.ts +0 -233
  64. package/src/Interfaces/IPropTelemetryContext.ts +0 -21
  65. package/src/Interfaces/IPropertiesConfig.ts +0 -19
  66. package/src/PropertiesPlugin.ts +0 -183
  67. package/src/TelemetryContext.ts +0 -233
  68. package/src/__DynamicConstants.ts +0 -41
  69. package/src/applicationinsights-properties-js.ts +0 -10
  70. package/types/Context/Application.d.ts +0 -11
  71. package/types/Context/Device.d.ts +0 -31
  72. package/types/Context/Internal.d.ts +0 -30
  73. package/types/Context/Location.d.ts +0 -7
  74. package/types/Context/Session.d.ts +0 -42
  75. package/types/Context/TelemetryTrace.d.ts +0 -10
  76. package/types/Context/User.d.ts +0 -59
  77. package/types/Interfaces/IPropTelemetryContext.d.ts +0 -16
  78. package/types/Interfaces/IPropertiesConfig.d.ts +0 -16
  79. package/types/PropertiesPlugin.d.ts +0 -19
  80. package/types/TelemetryContext.d.ts +0 -34
  81. package/types/__DynamicConstants.d.ts +0 -29
  82. package/types/tsdoc-metadata.json +0 -11
  83. /package/{dist-esm → dist-es5}/Context/Application.js.map +0 -0
  84. /package/{dist-esm → dist-es5}/Context/Device.js.map +0 -0
  85. /package/{dist-esm → dist-es5}/Context/Internal.js.map +0 -0
  86. /package/{dist-esm → dist-es5}/Context/Location.js.map +0 -0
  87. /package/{dist-esm → dist-es5}/Context/Session.js.map +0 -0
  88. /package/{dist-esm → dist-es5}/Context/TelemetryTrace.js.map +0 -0
  89. /package/{dist-esm → dist-es5}/Context/User.js.map +0 -0
  90. /package/{dist-esm → dist-es5}/Interfaces/IPropTelemetryContext.js.map +0 -0
  91. /package/{dist-esm → dist-es5}/Interfaces/IPropertiesConfig.js.map +0 -0
  92. /package/{dist-esm → dist-es5}/PropertiesPlugin.js.map +0 -0
  93. /package/{dist-esm → dist-es5}/TelemetryContext.js.map +0 -0
  94. /package/{dist-esm → dist-es5}/__DynamicConstants.js.map +0 -0
  95. /package/{dist-esm → dist-es5}/applicationinsights-properties-js.js.map +0 -0
@@ -1,233 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import dynamicProto from "@microsoft/dynamicproto-js";
5
- import { IUserContext, utlRemoveStorage } from "@microsoft/applicationinsights-common";
6
- import {
7
- IAppInsightsCore, ICookieMgr, IUnloadHookContainer, _eInternalMessageId, _throwInternal, eLoggingSeverity, newId, onConfigChange,
8
- safeGetCookieMgr, safeGetLogger, toISOString
9
- } from "@microsoft/applicationinsights-core-js";
10
- import { objDefine } from "@nevware21/ts-utils";
11
- import { IPropertiesConfig } from "../Interfaces/IPropertiesConfig";
12
-
13
- function _validateUserInput(id: string): boolean {
14
- // Validate:
15
- // 1. Id is a non-empty string.
16
- // 2. It does not contain special characters for cookies.
17
- if (typeof id !== "string" ||
18
- !id ||
19
- id.match(/,|;|=| |\|/)) {
20
- return false;
21
- }
22
-
23
- return true;
24
- }
25
-
26
- export class User implements IUserContext {
27
-
28
- static cookieSeparator: string = "|";
29
- static userCookieName: string = "ai_user";
30
- static authUserCookieName: string = "ai_authUser";
31
-
32
- /**
33
- * The telemetry configuration.
34
- */
35
- public readonly config: IPropertiesConfig;
36
-
37
- /**
38
- * The user ID.
39
- */
40
- public id: string;
41
-
42
- /**
43
- * Authenticated user id
44
- */
45
- public authenticatedId: string;
46
-
47
- /**
48
- * The localId
49
- */
50
- public localId: string;
51
-
52
- /**
53
- * The account ID.
54
- */
55
- public accountId: string;
56
-
57
- /**
58
- * The account acquisition date.
59
- */
60
- public accountAcquisitionDate: string;
61
-
62
- /**
63
- * A flag indicating whether this represents a new user
64
- */
65
- public isNewUser = false;
66
-
67
- /**
68
- * A flag indicating whether the user cookie has been set
69
- */
70
- public isUserCookieSet = false;
71
-
72
- constructor(config: IPropertiesConfig, core: IAppInsightsCore, unloadHookContainer?: IUnloadHookContainer) {
73
- let _logger = safeGetLogger(core);
74
- let _cookieManager: ICookieMgr = safeGetCookieMgr(core);
75
- let _storageNamePrefix: string;
76
-
77
- dynamicProto(User, this, (_self) => {
78
- // Define _self.config
79
- objDefine(_self, "config", {
80
- g: () => config
81
- });
82
-
83
- let unloadHook = onConfigChange(config, () => {
84
-
85
- const userCookiePostfix = config.userCookiePostfix || "";
86
- _storageNamePrefix = User.userCookieName + userCookiePostfix;
87
-
88
- // get userId or create new one if none exists
89
- const cookie = _cookieManager.get(_storageNamePrefix);
90
- if (cookie) {
91
- _self.isNewUser = false;
92
- const params = cookie.split(User.cookieSeparator);
93
- if (params.length > 0) {
94
- _self.id = params[0];
95
- // we already have a cookie
96
- _self.isUserCookieSet = !!_self.id;
97
- }
98
- }
99
-
100
- if (!_self.id) {
101
- _self.id = _generateNewId();
102
- const newCookie = _generateNewCookie(_self.id);
103
-
104
- _setUserCookie(newCookie.join(User.cookieSeparator));
105
-
106
- // If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies.
107
- // We should respect their wishes and clear ourselves from local storage
108
- const name = (config.namePrefix || "") + "ai_session";
109
- utlRemoveStorage(_logger, name);
110
- }
111
-
112
- // We still take the account id from the ctor param for backward compatibility.
113
- // But if the the customer set the accountId through the newer setAuthenticatedUserContext API, we will override it.
114
- _self.accountId = config.accountId || undefined;
115
-
116
- // Get the auth user id and account id from the cookie if exists
117
- // Cookie is in the pattern: <authenticatedId>|<accountId>
118
- let authCookie = _cookieManager.get(User.authUserCookieName);
119
- if (authCookie) {
120
- authCookie = decodeURI(authCookie);
121
- const authCookieString = authCookie.split(User.cookieSeparator);
122
- if (authCookieString[0]) {
123
- _self.authenticatedId = authCookieString[0];
124
- }
125
-
126
- if (authCookieString.length > 1 && authCookieString[1]) {
127
- _self.accountId = authCookieString[1];
128
- }
129
- }
130
- });
131
-
132
- unloadHookContainer && unloadHookContainer.add(unloadHook);
133
-
134
- function _generateNewId() {
135
- let theConfig = (config || {}) as IPropertiesConfig;
136
- let getNewId = theConfig.getNewId || newId;
137
- let id = getNewId(theConfig.idLength ? config.idLength : 22);
138
- return id;
139
- }
140
-
141
- function _generateNewCookie(userId: string) {
142
- const acqStr = toISOString(new Date());
143
- _self.accountAcquisitionDate = acqStr;
144
- _self.isNewUser = true;
145
- const newCookie = [userId, acqStr];
146
- return newCookie;
147
- }
148
-
149
- function _setUserCookie(cookie: string) {
150
- // without expiration, cookies expire at the end of the session
151
- // set it to 365 days from now
152
- // 365 * 24 * 60 * 60 = 31536000
153
- const oneYear = 31536000;
154
- _self.isUserCookieSet = _cookieManager.set(_storageNamePrefix, cookie, oneYear);
155
- }
156
-
157
- _self.setAuthenticatedUserContext = (authenticatedUserId: string, accountId?: string, storeInCookie = false) => {
158
-
159
- // Validate inputs to ensure no cookie control characters.
160
- const isInvalidInput = !_validateUserInput(authenticatedUserId) || (accountId && !_validateUserInput(accountId));
161
- if (isInvalidInput) {
162
- _throwInternal(_logger,
163
- eLoggingSeverity.WARNING,
164
- _eInternalMessageId.SetAuthContextFailedAccountName,
165
- "Setting auth user context failed. " +
166
- "User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",
167
- true);
168
- return;
169
- }
170
-
171
- // Create cookie string.
172
- _self.authenticatedId = authenticatedUserId;
173
- let authCookie = _self.authenticatedId;
174
- if (accountId) {
175
- _self.accountId = accountId;
176
- authCookie = [_self.authenticatedId, _self.accountId].join(User.cookieSeparator);
177
- }
178
-
179
- if (storeInCookie) {
180
- // Set the cookie. No expiration date because this is a session cookie (expires when browser closed).
181
- // Encoding the cookie to handle unexpected unicode characters.
182
- _cookieManager.set(User.authUserCookieName, encodeURI(authCookie));
183
- }
184
- };
185
-
186
- /**
187
- * Clears the authenticated user id and the account id from the user context.
188
- * @returns {}
189
- */
190
- _self.clearAuthenticatedUserContext = () => {
191
- _self.authenticatedId = null;
192
- _self.accountId = null;
193
- _cookieManager.del(User.authUserCookieName);
194
- };
195
-
196
- _self.update = (userId?: string) => {
197
- // Optimizations to avoid setting and processing the cookie when not needed
198
- if (_self.id !== userId || !_self.isUserCookieSet) {
199
- let user_id = userId ? userId : _generateNewId();
200
- let user_cookie = _generateNewCookie(user_id);
201
- _setUserCookie(user_cookie.join(User.cookieSeparator));
202
- }
203
- };
204
- });
205
- }
206
-
207
- /**
208
- * Sets the authenticated user id and the account id in this session.
209
- *
210
- * @param authenticatedUserId - {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
211
- * @param accountId - {string} - An optional string to represent the account associated with the authenticated user.
212
- */
213
- public setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie = false) {
214
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
215
- }
216
-
217
- /**
218
- * Clears the authenticated user id and the account id from the user context.
219
- * @returns {}
220
- */
221
- public clearAuthenticatedUserContext() {
222
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
223
- }
224
-
225
- /**
226
- * Update or create the user cookie if cookies where previously disabled or the new userId does not match the existing value.
227
- * If you pass nothing a new random user id will be created.
228
- * @param userId - Specific either the current (via appInsights.context.user.id) or new id that you want to set
229
- */
230
- public update(userId?: string) {
231
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
232
- }
233
- }
@@ -1,21 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import { ITelemetryContext } from "@microsoft/applicationinsights-common";
5
- import { IProcessTelemetryContext, ITelemetryItem } from "@microsoft/applicationinsights-core-js";
6
- import { _SessionManager } from "../Context/Session";
7
-
8
- export interface IPropTelemetryContext extends ITelemetryContext {
9
- readonly sessionManager: _SessionManager; // The session manager that manages session on the base of cookies.
10
-
11
- applySessionContext(evt: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
12
- applyOperatingSystemContxt(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
13
- applyApplicationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
14
- applyDeviceContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
15
- applyInternalContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
16
- applyLocationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
17
- applyOperationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
18
- applyWebContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
19
- applyUserContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
20
- cleanUp(event:ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
21
- }
@@ -1,19 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- export interface IPropertiesConfig {
5
- readonly accountId: string;
6
- readonly sessionRenewalMs: number;
7
- readonly samplingPercentage: number;
8
- readonly sessionExpirationMs: number;
9
- readonly cookieDomain: string,
10
- readonly sdkExtension: string;
11
- readonly isBrowserLinkTrackingEnabled: boolean;
12
- readonly appId: string;
13
- readonly getSessionId: string;
14
- readonly namePrefix: string;
15
- readonly sessionCookiePostfix: string;
16
- readonly userCookiePostfix: string;
17
- readonly idLength: number;
18
- readonly getNewId: (idLength?: number) => string;
19
- }
@@ -1,183 +0,0 @@
1
- /**
2
- * PropertiesPlugin.ts
3
- * @copyright Microsoft 2018
4
- */
5
-
6
- import dynamicProto from "@microsoft/dynamicproto-js";
7
- import {
8
- BreezeChannelIdentifier, IConfig, IPropertiesPlugin, PageView, PropertiesPluginIdentifier, createDistributedTraceContextFromTrace
9
- } from "@microsoft/applicationinsights-common";
10
- import {
11
- BaseTelemetryPlugin, IAppInsightsCore, IConfigDefaults, IConfiguration, IDistributedTraceContext, IPlugin, IProcessTelemetryContext,
12
- IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPluginChain, ITelemetryUnloadState, _InternalLogMessage, _eInternalMessageId,
13
- _logInternalMessage, createProcessTelemetryContext, eLoggingSeverity, getNavigator, getSetValue, isNullOrUndefined, onConfigChange
14
- } from "@microsoft/applicationinsights-core-js";
15
- import { objDeepFreeze, objDefine } from "@nevware21/ts-utils";
16
- import { IPropTelemetryContext } from "./Interfaces/IPropTelemetryContext";
17
- import { IPropertiesConfig } from "./Interfaces/IPropertiesConfig";
18
- import { TelemetryContext } from "./TelemetryContext";
19
-
20
- let undefString: string;
21
- const nullValue: any = null;
22
-
23
- const _defaultConfig: IConfigDefaults<IPropertiesConfig> = objDeepFreeze({
24
- accountId: nullValue,
25
- sessionRenewalMs: 30 * 60 * 1000,
26
- samplingPercentage: 100,
27
- sessionExpirationMs: 24 * 60 * 60 * 1000,
28
- cookieDomain: nullValue,
29
- sdkExtension: nullValue,
30
- isBrowserLinkTrackingEnabled: false,
31
- appId: nullValue,
32
- getSessionId: nullValue,
33
- namePrefix: undefString,
34
- sessionCookiePostfix: undefString,
35
- userCookiePostfix: undefString,
36
- idLength: 22,
37
- getNewId: nullValue
38
- });
39
-
40
- export default class PropertiesPlugin extends BaseTelemetryPlugin implements IPropertiesPlugin {
41
-
42
- public context: IPropTelemetryContext;
43
-
44
- public priority = 110;
45
- public identifier = PropertiesPluginIdentifier;
46
-
47
- constructor() {
48
- super();
49
-
50
- let _extensionConfig: IPropertiesConfig;
51
- let _distributedTraceCtx: IDistributedTraceContext;
52
- let _previousTraceCtx: IDistributedTraceContext;
53
- let _context: IPropTelemetryContext;
54
-
55
- dynamicProto(PropertiesPlugin, this, (_self, _base) => {
56
-
57
- _initDefaults();
58
-
59
- objDefine(_self, "context", {
60
- g: function() {
61
- return _context;
62
- }
63
- });
64
-
65
- _self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => {
66
- _base.initialize(config, core, extensions, pluginChain);
67
- _populateDefaults(config);
68
- };
69
-
70
- /**
71
- * Add Part A fields to the event
72
- * @param event - The event that needs to be processed
73
- */
74
- _self.processTelemetry = (event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {
75
- if (!isNullOrUndefined(event)) {
76
- itemCtx = _self._getTelCtx(itemCtx);
77
- // If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page.
78
- if (event.name === PageView.envelopeType) {
79
- itemCtx.diagLog().resetInternalMessageCount();
80
- }
81
-
82
- let theContext: TelemetryContext = (_context || {}) as TelemetryContext;
83
-
84
- if (theContext.session) {
85
- // If customer did not provide custom session id update the session manager
86
- if (typeof _context.session.id !== "string" && theContext.sessionManager) {
87
- theContext.sessionManager.update();
88
- }
89
- }
90
-
91
- let userCtx = theContext.user;
92
- if (userCtx && !userCtx.isUserCookieSet) {
93
- userCtx.update(theContext.user.id);
94
- }
95
-
96
- _processTelemetryInternal(event, itemCtx);
97
-
98
- if (userCtx && userCtx.isNewUser) {
99
- userCtx.isNewUser = false;
100
- const message = new _InternalLogMessage(_eInternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator()||{} as any).userAgent||""));
101
- _logInternalMessage(itemCtx.diagLog(), eLoggingSeverity.CRITICAL, message);
102
- }
103
-
104
- _self.processNext(event, itemCtx);
105
- }
106
- };
107
-
108
- _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => {
109
- let core = (unloadCtx || {} as any).core();
110
- if (core && core.getTraceCtx) {
111
- let traceCtx = core.getTraceCtx(false);
112
- if (traceCtx === _distributedTraceCtx) {
113
- core.setTraceCtx(_previousTraceCtx);
114
- }
115
- }
116
-
117
- _initDefaults();
118
- };
119
-
120
- function _initDefaults() {
121
- _extensionConfig = null;
122
- _distributedTraceCtx = null;
123
- _previousTraceCtx = null;
124
- _context = null;
125
- }
126
-
127
- function _populateDefaults(config: IConfiguration) {
128
- let identifier = _self.identifier;
129
- let core = _self.core;
130
-
131
- // This function will be re-called whenever any referenced configuration is changed
132
- _self._addHook(onConfigChange(config, () => {
133
- let ctx = createProcessTelemetryContext(null, config, core);
134
- _extensionConfig = ctx.getExtCfg(identifier, _defaultConfig);
135
-
136
- // Test hook to allow accessing the internal values -- explicitly not defined as an available property on the class
137
- _self["_extConfig"] = _extensionConfig;
138
- }));
139
-
140
- // This is outside of the onConfigChange as we don't want to update (replace) these values whenever a referenced config item changes
141
- _previousTraceCtx = core.getTraceCtx(false);
142
- _context = new TelemetryContext(core, _extensionConfig, _previousTraceCtx, _self._unloadHooks);
143
- _distributedTraceCtx = createDistributedTraceContextFromTrace(_self.context.telemetryTrace, _previousTraceCtx);
144
- core.setTraceCtx(_distributedTraceCtx);
145
- _self.context.appId = () => {
146
- let breezeChannel = core.getPlugin<IPlugin>(BreezeChannelIdentifier);
147
- return breezeChannel ? breezeChannel.plugin["_appId"] : null;
148
- };
149
- }
150
-
151
- function _processTelemetryInternal(evt: ITelemetryItem, itemCtx: IProcessTelemetryContext) {
152
- // Set Part A fields
153
- getSetValue(evt, "tags", []);
154
- getSetValue(evt, "ext", {});
155
-
156
- let ctx = _self.context;
157
- ctx.applySessionContext(evt, itemCtx);
158
- ctx.applyApplicationContext(evt, itemCtx);
159
- ctx.applyDeviceContext(evt, itemCtx);
160
- ctx.applyOperationContext(evt, itemCtx);
161
- ctx.applyUserContext(evt, itemCtx);
162
- ctx.applyOperatingSystemContxt(evt, itemCtx);
163
- ctx.applyWebContext(evt, itemCtx);
164
-
165
- ctx.applyLocationContext(evt, itemCtx); // legacy tags
166
- ctx.applyInternalContext(evt, itemCtx); // legacy tags
167
- ctx.cleanUp(evt, itemCtx);
168
- }
169
- });
170
- }
171
-
172
- public initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) {
173
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
174
- }
175
-
176
- /**
177
- * Add Part A fields to the event
178
- * @param event - The event that needs to be processed
179
- */
180
- public processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
181
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
182
- }
183
- }