@microsoft/applicationinsights-channel-js 3.0.0-beta.2209-03 → 3.0.0-beta.2210-02

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 (38) hide show
  1. package/browser/applicationinsights-channel-js.integrity.json +9 -9
  2. package/browser/applicationinsights-channel-js.js +946 -428
  3. package/browser/applicationinsights-channel-js.js.map +1 -1
  4. package/browser/applicationinsights-channel-js.min.js +2 -2
  5. package/browser/applicationinsights-channel-js.min.js.map +1 -1
  6. package/dist/applicationinsights-channel-js.api.json +2 -2
  7. package/dist/applicationinsights-channel-js.d.ts +22 -22
  8. package/dist/applicationinsights-channel-js.js +946 -428
  9. package/dist/applicationinsights-channel-js.js.map +1 -1
  10. package/dist/applicationinsights-channel-js.min.js +2 -2
  11. package/dist/applicationinsights-channel-js.min.js.map +1 -1
  12. package/dist/applicationinsights-channel-js.rollup.d.ts +22 -22
  13. package/dist-esm/EnvelopeCreator.js +2 -2
  14. package/dist-esm/EnvelopeCreator.js.map +1 -1
  15. package/dist-esm/Interfaces.js +1 -1
  16. package/dist-esm/InternalConstants.js +1 -1
  17. package/dist-esm/Offline.js +1 -1
  18. package/dist-esm/SendBuffer.js +9 -11
  19. package/dist-esm/SendBuffer.js.map +1 -1
  20. package/dist-esm/Sender.js +186 -135
  21. package/dist-esm/Sender.js.map +1 -1
  22. package/dist-esm/Serializer.js +2 -3
  23. package/dist-esm/Serializer.js.map +1 -1
  24. package/dist-esm/TelemetryProcessors/Sample.js +1 -1
  25. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  26. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  27. package/dist-esm/__DynamicConstants.js +11 -15
  28. package/dist-esm/__DynamicConstants.js.map +1 -1
  29. package/dist-esm/applicationinsights-channel-js.js +1 -1
  30. package/package.json +4 -4
  31. package/src/Interfaces.ts +17 -17
  32. package/src/SendBuffer.ts +5 -5
  33. package/src/Sender.ts +194 -129
  34. package/src/__DynamicConstants.ts +10 -14
  35. package/types/Interfaces.d.ts +17 -17
  36. package/types/Sender.d.ts +4 -4
  37. package/types/__DynamicConstants.d.ts +5 -9
  38. package/types/tsdoc-metadata.json +1 -1
package/src/Interfaces.ts CHANGED
@@ -2,81 +2,81 @@ export interface ISenderConfig {
2
2
  /**
3
3
  * The url to which payloads will be sent
4
4
  */
5
- endpointUrl: () => string;
5
+ endpointUrl: string;
6
6
 
7
7
  /**
8
8
  * The JSON format (normal vs line delimited). True means line delimited JSON.
9
9
  */
10
- emitLineDelimitedJson: () => boolean;
10
+ emitLineDelimitedJson: boolean;
11
11
 
12
12
  /**
13
13
  * The maximum size of a batch in bytes
14
14
  */
15
- maxBatchSizeInBytes: () => number;
15
+ maxBatchSizeInBytes: number;
16
16
 
17
17
  /**
18
18
  * The maximum interval allowed between calls to batchInvoke
19
19
  */
20
- maxBatchInterval: () => number;
20
+ maxBatchInterval: number;
21
21
 
22
22
  /**
23
23
  * The master off switch. Do not send any data if set to TRUE
24
24
  */
25
- disableTelemetry: () => boolean;
25
+ disableTelemetry: boolean;
26
26
 
27
27
  /**
28
28
  * Store a copy of a send buffer in the session storage
29
29
  */
30
- enableSessionStorageBuffer: () => boolean;
30
+ enableSessionStorageBuffer: boolean;
31
31
 
32
32
  /**
33
33
  * Is retry handler disabled.
34
34
  * If enabled, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error) and 503 (service unavailable).
35
35
  */
36
- isRetryDisabled: () => boolean;
36
+ isRetryDisabled: boolean;
37
37
 
38
- isBeaconApiDisabled: () => boolean;
38
+ isBeaconApiDisabled: boolean;
39
39
 
40
40
  /**
41
41
  * Don't use XMLHttpRequest or XDomainRequest (for IE < 9) by default instead attempt to use fetch() or sendBeacon.
42
42
  * If no other transport is available it will still use XMLHttpRequest
43
43
  */
44
- disableXhr: () => boolean;
44
+ disableXhr: boolean;
45
45
 
46
46
  /**
47
47
  * If fetch keepalive is supported do not use it for sending events during unload, it may still fallback to fetch() without keepalive
48
48
  */
49
- onunloadDisableFetch: () => boolean;
49
+ onunloadDisableFetch: boolean;
50
50
 
51
51
  /**
52
52
  * Is beacon disabled on page unload.
53
53
  * If enabled, flush events through beaconSender.
54
54
  */
55
- onunloadDisableBeacon: () => boolean;
55
+ onunloadDisableBeacon: boolean;
56
56
 
57
57
  /**
58
58
  * (Optional) Override the instrumentation key that this channel instance sends to
59
59
  */
60
- instrumentationKey: () => string;
60
+ instrumentationKey: string;
61
61
 
62
- namePrefix: () => string;
62
+ namePrefix: string;
63
63
 
64
- samplingPercentage: () => number;
64
+ samplingPercentage: number;
65
65
 
66
66
  /**
67
67
  * (Optional) The ability for the user to provide extra headers
68
68
  */
69
- customHeaders: () => [{header: string, value: string}]
69
+ customHeaders: [{header: string, value: string}];
70
70
 
71
71
  /**
72
72
  * (Optional) Provide user an option to convert undefined field to user defined value.
73
73
  */
74
- convertUndefined: () => any
74
+ convertUndefined: any
75
75
 
76
76
  /**
77
77
  * (Optional) The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
78
78
  */
79
- eventsLimitInMem: () => number;
79
+ eventsLimitInMem: number;
80
80
  }
81
81
 
82
82
  export interface IBackendResponse {
package/src/SendBuffer.ts CHANGED
@@ -70,7 +70,7 @@ abstract class BaseSendBuffer {
70
70
  dynamicProto(BaseSendBuffer, this, (_self) => {
71
71
 
72
72
  _self.enqueue = (payload: string) => {
73
- if (_self.count() >= config.eventsLimitInMem()) {
73
+ if (_self.count() >= config.eventsLimitInMem) {
74
74
  // sent internal log only once per page view
75
75
  if (!_bufferFullMessageSent) {
76
76
  _throwInternal(logger,
@@ -97,7 +97,7 @@ abstract class BaseSendBuffer {
97
97
  size += _buffer[lp].length;
98
98
  }
99
99
 
100
- if (!config.emitLineDelimitedJson()) {
100
+ if (!config.emitLineDelimitedJson) {
101
101
  size += 2;
102
102
  }
103
103
 
@@ -115,7 +115,7 @@ abstract class BaseSendBuffer {
115
115
 
116
116
  _self.batchPayloads = (payload: string[]): string => {
117
117
  if (payload && payload.length > 0) {
118
- const batch = config.emitLineDelimitedJson() ?
118
+ const batch = config.emitLineDelimitedJson ?
119
119
  payload.join("\n") :
120
120
  "[" + payload.join(",") + "]";
121
121
 
@@ -286,7 +286,7 @@ export class SessionStorageSendBuffer extends BaseSendBuffer implements ISendBuf
286
286
  function _getBuffer(key: string): string[] {
287
287
  let prefixedKey = key;
288
288
  try {
289
- prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + "_" + prefixedKey : prefixedKey;
289
+ prefixedKey = config.namePrefix ? config.namePrefix + "_" + prefixedKey : prefixedKey;
290
290
  const bufferJson = utlGetSessionStorage(logger, prefixedKey);
291
291
  if (bufferJson) {
292
292
  let buffer: string[] = getJSON().parse(bufferJson);
@@ -312,7 +312,7 @@ export class SessionStorageSendBuffer extends BaseSendBuffer implements ISendBuf
312
312
  function _setBuffer(key: string, buffer: string[]) {
313
313
  let prefixedKey = key;
314
314
  try {
315
- prefixedKey = config.namePrefix && config.namePrefix() ? config.namePrefix() + "_" + prefixedKey : prefixedKey;
315
+ prefixedKey = config.namePrefix ? config.namePrefix + "_" + prefixedKey : prefixedKey;
316
316
  const bufferJson = JSON.stringify(buffer);
317
317
  utlSetSessionStorage(logger, prefixedKey, bufferJson);
318
318
  } catch (e) {