@microsoft/applicationinsights-web-basic 2.7.5-nightly.2204-03 → 2.7.6

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/src/index.ts DELETED
@@ -1,203 +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 {
6
- IConfiguration,
7
- AppInsightsCore,
8
- _InternalMessageId,
9
- isNullOrUndefined,
10
- ITelemetryItem,
11
- throwError,
12
- proxyFunctions,
13
- UnloadHandler,
14
- IPlugin,
15
- ITelemetryPlugin,
16
- ILoadedPlugin
17
- } from "@microsoft/applicationinsights-core-js";
18
- import { IConfig } from "@microsoft/applicationinsights-common";
19
- import { Sender } from "@microsoft/applicationinsights-channel-js";
20
-
21
- /**
22
- * @export
23
- * @class ApplicationInsights
24
- */
25
- export class ApplicationInsights {
26
- public config: IConfiguration & IConfig;
27
-
28
- /**
29
- * Creates an instance of ApplicationInsights.
30
- * @param {IConfiguration & IConfig} config
31
- * @memberof ApplicationInsights
32
- */
33
- constructor(config: IConfiguration & IConfig) {
34
- let core = new AppInsightsCore();
35
-
36
- // initialize the queue and config in case they are undefined
37
- if (
38
- isNullOrUndefined(config) ||
39
- isNullOrUndefined(config.instrumentationKey)
40
- ) {
41
- throwError("Invalid input configuration");
42
- }
43
-
44
- dynamicProto(ApplicationInsights, this, (_self) => {
45
- _self.config = config;
46
- _self.getSKUDefaults();
47
-
48
- _initialize();
49
-
50
- _self.initialize = _initialize;
51
-
52
- _self.getSKUDefaults = () => {
53
- _self.config.diagnosticLogInterval =
54
- _self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval > 0 ? _self.config.diagnosticLogInterval : 10000;
55
- };
56
-
57
- proxyFunctions(_self, core, [
58
- "track",
59
- "flush",
60
- "pollInternalLogs",
61
- "stopPollingInternalLogs",
62
- "unload",
63
- "getPlugin",
64
- "addPlugin",
65
- "evtNamespace",
66
- "addUnloadCb"
67
- ]);
68
-
69
- function _initialize(): void {
70
- const extensions = [];
71
- const appInsightsChannel: Sender = new Sender();
72
-
73
- extensions.push(appInsightsChannel);
74
-
75
- // initialize core
76
- core.initialize(this.config, extensions);
77
-
78
- // initialize extensions
79
- appInsightsChannel.initialize(this.config, core, extensions);
80
-
81
- core.pollInternalLogs();
82
- }
83
- });
84
- }
85
-
86
- /**
87
- * Initialize this instance of ApplicationInsights
88
- *
89
- * @memberof ApplicationInsights
90
- */
91
- public initialize(): void {
92
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
93
- }
94
-
95
- /**
96
- * Send a manually constructed custom event
97
- *
98
- * @param {ITelemetryItem} item
99
- * @memberof ApplicationInsights
100
- */
101
- public track(item: ITelemetryItem) {
102
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
103
- }
104
-
105
- /**
106
- * Immediately send all batched telemetry
107
- * @param {boolean} [async=true]
108
- * @memberof ApplicationInsights
109
- */
110
- public flush(async: boolean = true) {
111
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
112
- }
113
-
114
- public pollInternalLogs(): void {
115
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
116
- }
117
-
118
- public stopPollingInternalLogs(): void {
119
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
120
- }
121
-
122
- public getSKUDefaults() {
123
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
124
- }
125
-
126
- /**
127
- * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
128
- * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
129
- * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
130
- * approach is to create a new instance and initialize that instance.
131
- * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
132
- * to successfully remove any global references or they may just be completing the unload process asynchronously.
133
- */
134
- public unload(isAsync?: boolean, unloadComplete?: () => void): void {
135
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
136
- return null;
137
- }
138
-
139
- /**
140
- * Find and return the (first) plugin with the specified identifier if present
141
- * @param pluginIdentifier
142
- */
143
- public getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T> {
144
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
145
- return null;
146
- }
147
-
148
- /**
149
- * Add a new plugin to the installation
150
- * @param plugin - The new plugin to add
151
- * @param replaceExisting - should any existing plugin be replaced
152
- * @param doAsync - Should the add be performed asynchronously
153
- */
154
- public addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void {
155
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
156
- }
157
-
158
- /**
159
- * Returns the unique event namespace that should be used
160
- */
161
- public evtNamespace(): string {
162
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
163
- return null;
164
- }
165
-
166
- /**
167
- * Add an unload handler that will be called when the SDK is being unloaded
168
- * @param handler - the handler
169
- */
170
- public addUnloadCb(handler: UnloadHandler): void {
171
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
172
- }
173
- }
174
-
175
- export {
176
- IConfiguration,
177
- AppInsightsCore,
178
- IAppInsightsCore,
179
- CoreUtils,
180
- ITelemetryItem,
181
- ILoadedPlugin,
182
- arrForEach,
183
- SendRequestReason,
184
- _eInternalMessageId,
185
- _InternalMessageId,
186
- isNullOrUndefined,
187
- throwError,
188
- proxyFunctions,
189
- IPlugin,
190
- ITelemetryPlugin
191
-
192
- } from "@microsoft/applicationinsights-core-js";
193
- export {
194
- SeverityLevel,
195
- IPageViewTelemetry,
196
- IDependencyTelemetry,
197
- IAutoExceptionTelemetry,
198
- IEventTelemetry,
199
- IMetricTelemetry,
200
- IPageViewPerformanceTelemetry,
201
- ITraceTelemetry
202
- } from "@microsoft/applicationinsights-common";
203
- export { Sender } from "@microsoft/applicationinsights-channel-js";