@microsoft/applicationinsights-channel-js 3.0.0-beta.2303-11 → 3.0.0-beta.2304-07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.cjs.js +5768 -0
  2. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.cjs.js.map +1 -0
  3. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.cjs.min.js +6 -0
  4. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.cjs.min.js.map +1 -0
  5. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.gbl.js +5772 -0
  6. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.gbl.js.map +1 -0
  7. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.gbl.min.js +6 -0
  8. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.gbl.min.js.map +1 -0
  9. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.integrity.json +66 -0
  10. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.js +5774 -0
  11. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.js.map +1 -0
  12. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.min.js +6 -0
  13. package/browser/es5/applicationinsights-channel-js.3.0.0-beta.2304-07.min.js.map +1 -0
  14. package/browser/es5/applicationinsights-channel-js.3.cjs.js +5768 -0
  15. package/browser/es5/applicationinsights-channel-js.3.cjs.js.map +1 -0
  16. package/browser/es5/applicationinsights-channel-js.3.cjs.min.js +6 -0
  17. package/browser/es5/applicationinsights-channel-js.3.cjs.min.js.map +1 -0
  18. package/browser/es5/applicationinsights-channel-js.3.gbl.js +5772 -0
  19. package/browser/es5/applicationinsights-channel-js.3.gbl.js.map +1 -0
  20. package/browser/es5/applicationinsights-channel-js.3.gbl.min.js +6 -0
  21. package/browser/es5/applicationinsights-channel-js.3.gbl.min.js.map +1 -0
  22. package/{dist/applicationinsights-channel-js.js → browser/es5/applicationinsights-channel-js.3.js} +875 -829
  23. package/browser/es5/applicationinsights-channel-js.3.js.map +1 -0
  24. package/browser/es5/applicationinsights-channel-js.3.min.js +6 -0
  25. package/browser/es5/applicationinsights-channel-js.3.min.js.map +1 -0
  26. package/{browser → dist/es5}/applicationinsights-channel-js.js +874 -828
  27. package/dist/es5/applicationinsights-channel-js.js.map +1 -0
  28. package/dist/es5/applicationinsights-channel-js.min.js +6 -0
  29. package/dist/es5/applicationinsights-channel-js.min.js.map +1 -0
  30. package/{dist-esm → dist-es5}/EnvelopeCreator.js +2 -2
  31. package/{dist-esm → dist-es5}/EnvelopeCreator.js.map +1 -1
  32. package/{dist-esm → dist-es5}/Interfaces.js +1 -1
  33. package/{dist-esm → dist-es5}/InternalConstants.js +1 -1
  34. package/{dist-esm → dist-es5}/Offline.js +8 -7
  35. package/dist-es5/Offline.js.map +1 -0
  36. package/{dist-esm → dist-es5}/SendBuffer.js +1 -1
  37. package/{dist-esm → dist-es5}/Sender.js +6 -4
  38. package/dist-es5/Sender.js.map +1 -0
  39. package/{dist-esm → dist-es5}/Serializer.js +1 -1
  40. package/{dist-esm → dist-es5}/TelemetryProcessors/Sample.js +1 -1
  41. package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  42. package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  43. package/{dist-esm → dist-es5}/__DynamicConstants.js +2 -1
  44. package/dist-es5/__DynamicConstants.js.map +1 -0
  45. package/{dist-esm → dist-es5}/applicationinsights-channel-js.js +1 -1
  46. package/package.json +17 -16
  47. package/tsconfig.json +5 -4
  48. package/types/applicationinsights-channel-js.d.ts +284 -1
  49. package/{dist/applicationinsights-channel-js.d.ts → types/applicationinsights-channel-js.namespaced.d.ts} +1 -1
  50. package/browser/applicationinsights-channel-js.integrity.json +0 -26
  51. package/browser/applicationinsights-channel-js.js.map +0 -1
  52. package/browser/applicationinsights-channel-js.min.js +0 -6
  53. package/browser/applicationinsights-channel-js.min.js.map +0 -1
  54. package/dist/applicationinsights-channel-js.api.json +0 -1357
  55. package/dist/applicationinsights-channel-js.api.md +0 -60
  56. package/dist/applicationinsights-channel-js.js.map +0 -1
  57. package/dist/applicationinsights-channel-js.min.js +0 -6
  58. package/dist/applicationinsights-channel-js.min.js.map +0 -1
  59. package/dist/applicationinsights-channel-js.rollup.d.ts +0 -285
  60. package/dist-esm/Offline.js.map +0 -1
  61. package/dist-esm/Sender.js.map +0 -1
  62. package/dist-esm/__DynamicConstants.js.map +0 -1
  63. package/src/EnvelopeCreator.ts +0 -351
  64. package/src/Interfaces.ts +0 -114
  65. package/src/InternalConstants.ts +0 -11
  66. package/src/Offline.ts +0 -106
  67. package/src/SendBuffer.ts +0 -396
  68. package/src/Sender.ts +0 -1256
  69. package/src/Serializer.ts +0 -177
  70. package/src/TelemetryProcessors/Sample.ts +0 -49
  71. package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +0 -37
  72. package/src/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.ts +0 -35
  73. package/src/__DynamicConstants.ts +0 -64
  74. package/src/applicationinsights-channel-js.ts +0 -1
  75. package/types/EnvelopeCreator.d.ts +0 -12
  76. package/types/Interfaces.d.ts +0 -95
  77. package/types/InternalConstants.d.ts +0 -1
  78. package/types/Offline.d.ts +0 -10
  79. package/types/SendBuffer.d.ts +0 -73
  80. package/types/Sender.d.ts +0 -84
  81. package/types/Serializer.d.ts +0 -9
  82. package/types/TelemetryProcessors/Sample.d.ts +0 -12
  83. package/types/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.d.ts +0 -5
  84. package/types/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.d.ts +0 -5
  85. package/types/__DynamicConstants.d.ts +0 -52
  86. package/types/tsdoc-metadata.json +0 -11
  87. /package/{dist-esm → dist-es5}/Interfaces.js.map +0 -0
  88. /package/{dist-esm → dist-es5}/InternalConstants.js.map +0 -0
  89. /package/{dist-esm → dist-es5}/SendBuffer.js.map +0 -0
  90. /package/{dist-esm → dist-es5}/Serializer.js.map +0 -0
  91. /package/{dist-esm → dist-es5}/TelemetryProcessors/Sample.js.map +0 -0
  92. /package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js.map +0 -0
  93. /package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js.map +0 -0
  94. /package/{dist-esm → dist-es5}/applicationinsights-channel-js.js.map +0 -0
@@ -1 +1,284 @@
1
- export { Sender } from "./Sender";
1
+ /*
2
+ * Microsoft Application Insights JavaScript SDK Channel, 3.0.0-beta.2304-07
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ *
5
+ * Microsoft Application Insights Team
6
+ * https://github.com/microsoft/ApplicationInsights-JS#readme
7
+ *
8
+ * ---------------------------------------------------------------------------
9
+ * This is a single combined (rollup) declaration file for the package,
10
+ * if you require a namespace wrapped version it is also available.
11
+ * - Namespaced version: types/applicationinsights-channel-js.namespaced.d.ts
12
+ * ---------------------------------------------------------------------------
13
+ */
14
+
15
+ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
16
+ import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
17
+ import { IChannelControls } from '@microsoft/applicationinsights-core-js';
18
+ import { IConfig } from '@microsoft/applicationinsights-common';
19
+ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
20
+ import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
21
+ import { IEnvelope } from '@microsoft/applicationinsights-common';
22
+ import { IPlugin } from '@microsoft/applicationinsights-core-js';
23
+ import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
24
+ import { ISample } from '@microsoft/applicationinsights-common';
25
+ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
26
+ import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
27
+ import { SendRequestReason } from '@microsoft/applicationinsights-core-js';
28
+
29
+ declare class ArraySendBuffer extends BaseSendBuffer implements ISendBuffer {
30
+ constructor(logger: IDiagnosticLogger, config: ISenderConfig);
31
+ markAsSent(payload: string[]): void;
32
+ clearSent(payload: string[]): void;
33
+ }
34
+
35
+ declare abstract class BaseSendBuffer {
36
+ protected _get: () => string[];
37
+ protected _set: (buffer: string[]) => string[];
38
+ constructor(logger: IDiagnosticLogger, config: ISenderConfig);
39
+ enqueue(payload: string): void;
40
+ count(): number;
41
+ size(): number;
42
+ clear(): void;
43
+ getItems(): string[];
44
+ batchPayloads(payload: string[]): string;
45
+ createNew(newLogger?: IDiagnosticLogger, newConfig?: ISenderConfig, canUseSessionStorage?: boolean): ArraySendBuffer | SessionStorageSendBuffer;
46
+ }
47
+
48
+ declare interface IBackendResponse {
49
+ /**
50
+ * Number of items received by the backend
51
+ */
52
+ readonly itemsReceived: number;
53
+ /**
54
+ * Number of items succesfuly accepted by the backend
55
+ */
56
+ readonly itemsAccepted: number;
57
+ /**
58
+ * List of errors for items which were not accepted
59
+ */
60
+ readonly errors: IResponseError[];
61
+ /**
62
+ * App id returned by the backend - not necessary returned, but we don't need it with each response.
63
+ */
64
+ readonly appId?: string;
65
+ }
66
+
67
+ declare interface IResponseError {
68
+ readonly index: number;
69
+ readonly statusCode: number;
70
+ readonly message: string;
71
+ }
72
+
73
+ declare interface ISendBuffer {
74
+ /**
75
+ * Enqueue the payload
76
+ */
77
+ enqueue: (payload: string) => void;
78
+ /**
79
+ * Returns the number of elements in the buffer
80
+ */
81
+ count: () => number;
82
+ /**
83
+ * Returns the current size of the serialized buffer
84
+ */
85
+ size: () => number;
86
+ /**
87
+ * Clears the buffer
88
+ */
89
+ clear: () => void;
90
+ /**
91
+ * Returns items stored in the buffer
92
+ */
93
+ getItems: () => string[];
94
+ /**
95
+ * Build a batch of all elements in the payload array
96
+ */
97
+ batchPayloads: (payload: string[]) => string;
98
+ /**
99
+ * Moves items to the SENT_BUFFER.
100
+ * The buffer holds items which were sent, but we haven't received any response from the backend yet.
101
+ */
102
+ markAsSent: (payload: string[]) => void;
103
+ /**
104
+ * Removes items from the SENT_BUFFER. Should be called on successful response from the backend.
105
+ */
106
+ clearSent: (payload: string[]) => void;
107
+ /**
108
+ * Copy current buffer items to a new buffer.
109
+ * if canUseSessionStorage is undefined, it will set to false.
110
+ * if newLogger and newConfig are undefined, current logger and empty config will be used.
111
+ * if canUseSessionStorage is set to true, new SessionStorageSendBuffer will be returned otherwise ArraySendBuffer will be returned.
112
+ */
113
+ createNew: (newLogger?: IDiagnosticLogger, newConfig?: ISenderConfig, canUseSessionStorage?: boolean) => ArraySendBuffer | SessionStorageSendBuffer;
114
+ }
115
+
116
+ declare interface ISenderConfig {
117
+ /**
118
+ * The url to which payloads will be sent
119
+ */
120
+ endpointUrl: string;
121
+ /**
122
+ * The JSON format (normal vs line delimited). True means line delimited JSON.
123
+ */
124
+ emitLineDelimitedJson: boolean;
125
+ /**
126
+ * The maximum size of a batch in bytes
127
+ */
128
+ maxBatchSizeInBytes: number;
129
+ /**
130
+ * The maximum interval allowed between calls to batchInvoke
131
+ */
132
+ maxBatchInterval: number;
133
+ /**
134
+ * The master off switch. Do not send any data if set to TRUE
135
+ */
136
+ disableTelemetry: boolean;
137
+ /**
138
+ * Store a copy of a send buffer in the session storage
139
+ */
140
+ enableSessionStorageBuffer: boolean;
141
+ /**
142
+ * Is retry handler disabled.
143
+ * If enabled, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error) and 503 (service unavailable).
144
+ */
145
+ isRetryDisabled: boolean;
146
+ isBeaconApiDisabled: boolean;
147
+ /**
148
+ * Don't use XMLHttpRequest or XDomainRequest (for IE < 9) by default instead attempt to use fetch() or sendBeacon.
149
+ * If no other transport is available it will still use XMLHttpRequest
150
+ */
151
+ disableXhr: boolean;
152
+ /**
153
+ * If fetch keepalive is supported do not use it for sending events during unload, it may still fallback to fetch() without keepalive
154
+ */
155
+ onunloadDisableFetch: boolean;
156
+ /**
157
+ * Is beacon disabled on page unload.
158
+ * If enabled, flush events through beaconSender.
159
+ */
160
+ onunloadDisableBeacon: boolean;
161
+ /**
162
+ * (Optional) Override the instrumentation key that this channel instance sends to
163
+ */
164
+ instrumentationKey: string;
165
+ namePrefix: string;
166
+ samplingPercentage: number;
167
+ /**
168
+ * (Optional) The ability for the user to provide extra headers
169
+ */
170
+ customHeaders: [{
171
+ header: string;
172
+ value: string;
173
+ }];
174
+ /**
175
+ * (Optional) Provide user an option to convert undefined field to user defined value.
176
+ */
177
+ convertUndefined: any;
178
+ /**
179
+ * (Optional) The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
180
+ */
181
+ eventsLimitInMem: number;
182
+ }
183
+
184
+ export declare class Sender extends BaseTelemetryPlugin implements IChannelControls {
185
+ static constructEnvelope(orig: ITelemetryItem, iKey: string, logger: IDiagnosticLogger, convertUndefined?: any): IEnvelope;
186
+ readonly priority: number;
187
+ readonly identifier: string;
188
+ /**
189
+ * The configuration for this sender instance
190
+ */
191
+ readonly _senderConfig: ISenderConfig;
192
+ /**
193
+ * A method which will cause data to be send to the url
194
+ */
195
+ _sender: SenderFunction;
196
+ /**
197
+ * A send buffer object
198
+ */
199
+ _buffer: ISendBuffer;
200
+ /**
201
+ * AppId of this component parsed from some backend response.
202
+ */
203
+ _appId: string;
204
+ protected _sample: ISample;
205
+ constructor();
206
+ /**
207
+ * Pause the sending (transmission) of events, this will cause all events to be batched only until the maximum limits are
208
+ * hit at which point new events are dropped. Will also cause events to NOT be sent during page unload, so if Session storage
209
+ * is disabled events will be lost.
210
+ * SessionStorage Limit is 2000 events, In-Memory (Array) Storage is 10,000 events (can be configured via the eventsLimitInMem).
211
+ */
212
+ pause(): void;
213
+ /**
214
+ * Resume the sending (transmission) of events, this will restart the timer and any batched events will be sent using the normal
215
+ * send interval.
216
+ */
217
+ resume(): void;
218
+ /**
219
+ * Flush the batched events immediately (not synchronously).
220
+ * Will not flush if the Sender has been paused.
221
+ */
222
+ flush(): void;
223
+ /**
224
+ * Flush the batched events synchronously (if possible -- based on configuration).
225
+ * Will not flush if the Send has been paused.
226
+ */
227
+ onunloadFlush(): void;
228
+ initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
229
+ processTelemetry(telemetryItem: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
230
+ /**
231
+ * xhr state changes
232
+ */
233
+ _xhrReadyStateChange(xhr: XMLHttpRequest, payload: string[], countOfItemsInPayload: number): void;
234
+ /**
235
+ * Immediately send buffered data
236
+ * @param async - {boolean} - Indicates if the events should be sent asynchronously
237
+ * @param forcedSender - {SenderFunction} - Indicates the forcedSender, undefined if not passed
238
+ */
239
+ triggerSend(async?: boolean, forcedSender?: SenderFunction, sendReason?: SendRequestReason): void;
240
+ /**
241
+ * error handler
242
+ */
243
+ _onError(payload: string[], message: string, event?: ErrorEvent): void;
244
+ /**
245
+ * partial success handler
246
+ */
247
+ _onPartialSuccess(payload: string[], results: IBackendResponse): void;
248
+ /**
249
+ * success handler
250
+ */
251
+ _onSuccess(payload: string[], countOfItemsInPayload: number): void;
252
+ /**
253
+ * xdr state changes
254
+ */
255
+ _xdrOnLoad(xdr: XDomainRequest, payload: string[]): void;
256
+ /**
257
+ * Add header to request
258
+ * @param name - Header name.
259
+ * @param value - Header value.
260
+ */
261
+ addHeader(name: string, value: string): void;
262
+ }
263
+
264
+ declare type SenderFunction = (payload: string[], isAsync: boolean) => void;
265
+
266
+ declare class SessionStorageSendBuffer extends BaseSendBuffer implements ISendBuffer {
267
+ static BUFFER_KEY: string;
268
+ static SENT_BUFFER_KEY: string;
269
+ static MAX_BUFFER_SIZE: number;
270
+ constructor(logger: IDiagnosticLogger, config: ISenderConfig);
271
+ enqueue(payload: string): void;
272
+ clear(): void;
273
+ markAsSent(payload: string[]): void;
274
+ clearSent(payload: string[]): void;
275
+ createNew(newLogger?: IDiagnosticLogger, newConfig?: ISenderConfig, canUseSessionStorage?: boolean): ArraySendBuffer | SessionStorageSendBuffer;
276
+ }
277
+
278
+ declare interface XDomainRequest extends XMLHttpRequestEventTarget {
279
+ readonly responseText: string;
280
+ send(payload: string): void;
281
+ open(method: string, url: string): void;
282
+ }
283
+
284
+ export { }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights JavaScript SDK Channel, 3.0.0-beta.2303-11
2
+ * Microsoft Application Insights JavaScript SDK Channel, 3.0.0-beta.2304-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,26 +0,0 @@
1
- {
2
- "name": "applicationinsights-channel-js",
3
- "version": "3.0.0-beta.2303-11",
4
- "ext": {
5
- "@js": {
6
- "file": "applicationinsights-channel-js.js",
7
- "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-OPc4rwFPf0g1hFi+G51JgGVQZijGOvs0g6tOZeZpdv4= sha384-FlXIsTrF4Vl9tExQYwuyCjFKlg3mlbdAivuYGHOVlNrHcDHbkvLLUjHlqW3bHtrz sha512-nOb41+xgI3ffXOhKshBqbLSTZiwEyE70ETJ+18qPda6xQJetuiCMsr+vxIyWGlt52RhPQnydA+LvZhVOEQBH8Q==",
9
- "hashes": {
10
- "sha256": "OPc4rwFPf0g1hFi+G51JgGVQZijGOvs0g6tOZeZpdv4=",
11
- "sha384": "FlXIsTrF4Vl9tExQYwuyCjFKlg3mlbdAivuYGHOVlNrHcDHbkvLLUjHlqW3bHtrz",
12
- "sha512": "nOb41+xgI3ffXOhKshBqbLSTZiwEyE70ETJ+18qPda6xQJetuiCMsr+vxIyWGlt52RhPQnydA+LvZhVOEQBH8Q=="
13
- }
14
- },
15
- "@min.js": {
16
- "file": "applicationinsights-channel-js.min.js",
17
- "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-aIUSk/KRCesVrR4W1amAMZ7Zu0KFNsgHy0UCStwvT8M= sha384-0mUgYL28mmIjn4k3AUtoTYgd9O3edd0mUVUtiRd1ZVQbaeHqZrT2qDfqx1r991DF sha512-cJyZpl9Y+qm42kREziVPljGo4DpMpEJu0qa8ANmmC2KN6CfohIIx/y6nZb+i4j86bvgsWCMa4/kKTGDAhUqBsQ==",
19
- "hashes": {
20
- "sha256": "aIUSk/KRCesVrR4W1amAMZ7Zu0KFNsgHy0UCStwvT8M=",
21
- "sha384": "0mUgYL28mmIjn4k3AUtoTYgd9O3edd0mUVUtiRd1ZVQbaeHqZrT2qDfqx1r991DF",
22
- "sha512": "cJyZpl9Y+qm42kREziVPljGo4DpMpEJu0qa8ANmmC2KN6CfohIIx/y6nZb+i4j86bvgsWCMa4/kKTGDAhUqBsQ=="
23
- }
24
- }
25
- }
26
- }