@microsoft/applicationinsights-offlinechannel-js 0.1.0-nightly3.2402-06
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/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +14 -0
- package/LICENSE.TXT +21 -0
- package/PRIVACY +3 -0
- package/README.md +63 -0
- package/SECURITY.md +41 -0
- package/SUPPORT.md +14 -0
- package/dist/es5/applicationinsights-offlinechannel-js.js +6391 -0
- package/dist/es5/applicationinsights-offlinechannel-js.js.map +1 -0
- package/dist/es5/applicationinsights-offlinechannel-js.min.js +6 -0
- package/dist/es5/applicationinsights-offlinechannel-js.min.js.map +1 -0
- package/dist-es5/Helpers/Utils.js +185 -0
- package/dist-es5/Helpers/Utils.js.map +1 -0
- package/dist-es5/InMemoryBatch.js +64 -0
- package/dist-es5/InMemoryBatch.js.map +1 -0
- package/dist-es5/Interfaces/IInMemoryBatch.js +8 -0
- package/dist-es5/Interfaces/IInMemoryBatch.js.map +1 -0
- package/dist-es5/Interfaces/IOfflineBatch.js +9 -0
- package/dist-es5/Interfaces/IOfflineBatch.js.map +1 -0
- package/dist-es5/Interfaces/IOfflineIndexDb.js +8 -0
- package/dist-es5/Interfaces/IOfflineIndexDb.js.map +1 -0
- package/dist-es5/Interfaces/IOfflineProvider.js +8 -0
- package/dist-es5/Interfaces/IOfflineProvider.js.map +1 -0
- package/dist-es5/Interfaces/ISender.js +8 -0
- package/dist-es5/Interfaces/ISender.js.map +1 -0
- package/dist-es5/OfflineBatchHandler.js +343 -0
- package/dist-es5/OfflineBatchHandler.js.map +1 -0
- package/dist-es5/OfflineChannel.js +465 -0
- package/dist-es5/OfflineChannel.js.map +1 -0
- package/dist-es5/PayloadHelper.js +62 -0
- package/dist-es5/PayloadHelper.js.map +1 -0
- package/dist-es5/Providers/IndexDbHelper.js +626 -0
- package/dist-es5/Providers/IndexDbHelper.js.map +1 -0
- package/dist-es5/Providers/IndexDbProvider.js +468 -0
- package/dist-es5/Providers/IndexDbProvider.js.map +1 -0
- package/dist-es5/Providers/WebStorageProvider.js +463 -0
- package/dist-es5/Providers/WebStorageProvider.js.map +1 -0
- package/dist-es5/Sender.js +572 -0
- package/dist-es5/Sender.js.map +1 -0
- package/dist-es5/__DynamicConstants.js +80 -0
- package/dist-es5/__DynamicConstants.js.map +1 -0
- package/dist-es5/applicationinsights-offlinechannel-js.js +11 -0
- package/dist-es5/applicationinsights-offlinechannel-js.js.map +1 -0
- package/package.json +65 -0
- package/tsconfig.json +28 -0
- package/types/applicationinsights-offlinechannel-js.d.ts +605 -0
- package/types/applicationinsights-offlinechannel-js.namespaced.d.ts +601 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.1.0-nightly3.2402-06
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { generateW3CId } from "@microsoft/applicationinsights-core-js";
|
|
8
|
+
import { isString, strSubstr } from "@nevware21/ts-utils";
|
|
9
|
+
import { _DYN_CHAR_AT, _DYN_CHAR_CODE_AT, _DYN_FROM_CHAR_CODE, _DYN_GET_TIME, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_REPLACE, _DYN_SPLIT, _DYN_TO_STRING } from "../__DynamicConstants";
|
|
10
|
+
// Endpoint schema
|
|
11
|
+
// <prefix>.<suffix>
|
|
12
|
+
//Prefix: Defines a service.
|
|
13
|
+
//Suffix: Defines the common domain name.
|
|
14
|
+
/**
|
|
15
|
+
* Get domian from an endpoint url.
|
|
16
|
+
* for example, https://test.com?auth=true, will return test.com
|
|
17
|
+
* @param endpoint endpoint url
|
|
18
|
+
* @returns domain string
|
|
19
|
+
*/
|
|
20
|
+
export function getEndpointDomain(endpoint) {
|
|
21
|
+
try {
|
|
22
|
+
var url = endpoint[_DYN_REPLACE /* @min:%2ereplace */](/^https?:\/\/|^www\./, "");
|
|
23
|
+
url = url[_DYN_REPLACE /* @min:%2ereplace */](/\?/, "/");
|
|
24
|
+
var arr = url[_DYN_SPLIT /* @min:%2esplit */]("/");
|
|
25
|
+
if (arr && arr[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
26
|
+
return arr[0];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
// eslint-disable-next-line no-empty
|
|
31
|
+
}
|
|
32
|
+
// if we can't get domain, entire endpoint will be used
|
|
33
|
+
return endpoint;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* If current value is equal or greater than zero.
|
|
37
|
+
* @param value number
|
|
38
|
+
* @returns boolean
|
|
39
|
+
*/
|
|
40
|
+
export function isGreaterThanZero(value) {
|
|
41
|
+
return value >= 0;
|
|
42
|
+
}
|
|
43
|
+
//Base64 is a binary encoding rather than a text encoding,
|
|
44
|
+
// it were added to the web platform before it supported binary data types.
|
|
45
|
+
// As a result, the two functions use strings to represent binary data
|
|
46
|
+
var _base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
47
|
+
/**
|
|
48
|
+
* Base64-encodes a Uint8Array.
|
|
49
|
+
*
|
|
50
|
+
* @param data the Uint8Array or string to encode.
|
|
51
|
+
*
|
|
52
|
+
* @return the base64-encoded output string.
|
|
53
|
+
*/
|
|
54
|
+
export function base64Encode(data) {
|
|
55
|
+
var line = "";
|
|
56
|
+
var input = "";
|
|
57
|
+
if (isString(data)) {
|
|
58
|
+
input = data;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
input = data[_DYN_TO_STRING /* @min:%2etoString */]();
|
|
62
|
+
}
|
|
63
|
+
var output = "";
|
|
64
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
|
65
|
+
var chr1, chr2, chr3;
|
|
66
|
+
var lp = 0;
|
|
67
|
+
while (lp < input[_DYN_LENGTH /* @min:%2elength */]) {
|
|
68
|
+
chr1 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);
|
|
69
|
+
chr2 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);
|
|
70
|
+
chr3 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);
|
|
71
|
+
// encode 4 character group
|
|
72
|
+
line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](chr1 >> 2);
|
|
73
|
+
line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](((chr1 & 3) << 4) | (chr2 >> 4));
|
|
74
|
+
if (isNaN(chr2)) {
|
|
75
|
+
line += "==";
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](((chr2 & 15) << 2) | (chr3 >> 6));
|
|
79
|
+
line += isNaN(chr3) ? "=" : _base64[_DYN_CHAR_AT /* @min:%2echarAt */](chr3 & 63);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
output += line;
|
|
83
|
+
return output;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Base64-decodes an encoded string and transforms it back to a Uint8Array.
|
|
87
|
+
* @param input the encoded string to decode
|
|
88
|
+
* @return Uint8Array
|
|
89
|
+
*/
|
|
90
|
+
export function base64Decode(input) {
|
|
91
|
+
var output = "";
|
|
92
|
+
var chr1, chr2, chr3;
|
|
93
|
+
var enc1, enc2, enc3, enc4;
|
|
94
|
+
var i = 0;
|
|
95
|
+
input = input[_DYN_REPLACE /* @min:%2ereplace */](/[^A-Za-z0-9\+\/\=]/g, "");
|
|
96
|
+
while (i < input[_DYN_LENGTH /* @min:%2elength */]) {
|
|
97
|
+
enc1 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));
|
|
98
|
+
enc2 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));
|
|
99
|
+
enc3 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));
|
|
100
|
+
enc4 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));
|
|
101
|
+
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
102
|
+
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
103
|
+
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
104
|
+
output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr1);
|
|
105
|
+
if (enc3 != 64) {
|
|
106
|
+
output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr2);
|
|
107
|
+
}
|
|
108
|
+
if (enc4 != 64) {
|
|
109
|
+
output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr3);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
var arr = output[_DYN_SPLIT /* @min:%2esplit */](",").map(function (c) { return Number(c); });
|
|
113
|
+
return new Uint8Array(arr);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get number value of current time and append a random float number.
|
|
117
|
+
* For example, if current time value is 12345678, so "12345678.randomfl" will be returned
|
|
118
|
+
* @returns time id string
|
|
119
|
+
*/
|
|
120
|
+
export function getTimeId() {
|
|
121
|
+
var time = (new Date())[_DYN_GET_TIME /* @min:%2egetTime */]();
|
|
122
|
+
// append random digits to avoid same timestamp value
|
|
123
|
+
var random = strSubstr(generateW3CId(), 0, 8);
|
|
124
|
+
// function to create spanid();
|
|
125
|
+
return time + "." + random;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get time value from a time id that is generated from getTimeId() function.
|
|
129
|
+
* For example, if time id is "12345678.randomfl", 12345678 will be returned
|
|
130
|
+
* @param id time id string
|
|
131
|
+
* @returns time value number
|
|
132
|
+
*/
|
|
133
|
+
export function getTimeFromId(id) {
|
|
134
|
+
try {
|
|
135
|
+
var regex = new RegExp(/\d+\./g);
|
|
136
|
+
if (id && isString(id) && regex.test(id)) {
|
|
137
|
+
var arr = id[_DYN_SPLIT /* @min:%2esplit */](".");
|
|
138
|
+
return parseInt(arr[0]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
// eslint-disable-next-line no-empty
|
|
143
|
+
}
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
// OneCollector:
|
|
147
|
+
// 200-OK – Success or partial success.
|
|
148
|
+
// 204-NoContent – Success or partial success. Regarding accepting events, identical to 200-OK. If the request header contains NoResponseBody with the value of true and the request was successful/partially successful, 204-NoContent status code is returned instead of 200-OK.
|
|
149
|
+
// 400-BadRequest – all events were rejected.
|
|
150
|
+
// 403-Forbidden – client is above its quota and all events were throttled.
|
|
151
|
+
// 413-RequestEntityTooLarge – the request doesn’t conform to limits described in Request constraints section.
|
|
152
|
+
// 415-UnsupportedMediaType – the Content-Type or Content-Encoding header has an unexpected value.
|
|
153
|
+
// 429-TooManyRequests – the server decided to throttle given request (no data accepted) as the client (device, client version, …) generates too much traffic.
|
|
154
|
+
// 401-Unauthorized – Can occur under two conditions:
|
|
155
|
+
// All tenant tokens included in this request are invalid (unauthorized). kill-tokens header indicates which one(s). WWW-Authenticate: Token realm="ingestion" (see: rfc2617 for more details) header is added.
|
|
156
|
+
// The client has supplied the “strict” header (see section 3.3), and at least one MSA and/or XAuth event token cannot be used as a source of trusted user or device information. The event failure reason “TokenCrackingFailure” will be present in the response’ JSON body. In this scenario, the client is expected to fix or replace the offending ticket and retry.
|
|
157
|
+
// 500-InternalServerError – an unexpected exception while handling the request.
|
|
158
|
+
// 503-ServiceUnavailable – a machine serving this request is overloaded or shutting down. The request should be retried to a different machine. The server adds Connection: Close header to enforce TCP connection closing.
|
|
159
|
+
// Breeze
|
|
160
|
+
// 0 ad blockers
|
|
161
|
+
// 200 Success!
|
|
162
|
+
// 206 - Partial Accept
|
|
163
|
+
// 307/308 - Redirect
|
|
164
|
+
// 400 - Invalid
|
|
165
|
+
// 400 can also be caused by Azure AD authentication.
|
|
166
|
+
// 400 is not retriable and SDK should drop invalid data.
|
|
167
|
+
// 401 - Unauthorized
|
|
168
|
+
// 401 can be also caused by an AAD outage.
|
|
169
|
+
// 401 is retriable.
|
|
170
|
+
// 402 - Daily Quota Exceeded, drop the data.
|
|
171
|
+
// There is no retry-after in the response header for 402.
|
|
172
|
+
// 403 - Forbidden
|
|
173
|
+
// 403 can also caused by misconfiguring the access control assigned to the Application Insights resource.
|
|
174
|
+
// 403 is retriable.
|
|
175
|
+
// 404 - Ingestion is allowed only from stamp specific endpoint
|
|
176
|
+
// Telemetry will be dropped and customer must update their connection string.
|
|
177
|
+
// 404 is not retriable and SDK should drop the data.
|
|
178
|
+
// 408 - Timeout, retry it later. (offline might get this)
|
|
179
|
+
// 429 - Too Many Requests, Breeze returns retry-after for status code 429 only.
|
|
180
|
+
// 500 - Internal Server Error, retry it later.
|
|
181
|
+
// 502 - Bad Gateway, retry it later.
|
|
182
|
+
// 503 - Service Unavailable, retry it later. (offline)
|
|
183
|
+
// 504 - Gateway timeout, retry it later.
|
|
184
|
+
// All other response codes, SDK should drop the data.
|
|
185
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js.map","sources":["Utils.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { generateW3CId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { isString, strSubstr } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CHAR_AT, _DYN_CHAR_CODE_AT, _DYN_FROM_CHAR_CODE, _DYN_GET_TIME, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_REPLACE, _DYN_SPLIT, _DYN_TO_STRING } from \"../__DynamicConstants\";\r\n// Endpoint schema\r\n// <prefix>.<suffix>\r\n//Prefix: Defines a service.\r\n//Suffix: Defines the common domain name.\r\n/**\r\n * Get domian from an endpoint url.\r\n * for example, https://test.com?auth=true, will return test.com\r\n * @param endpoint endpoint url\r\n * @returns domain string\r\n */\r\nexport function getEndpointDomain(endpoint) {\r\n try {\r\n var url = endpoint[_DYN_REPLACE /* @min:%2ereplace */](/^https?:\\/\\/|^www\\./, \"\");\r\n url = url[_DYN_REPLACE /* @min:%2ereplace */](/\\?/, \"/\");\r\n var arr = url[_DYN_SPLIT /* @min:%2esplit */](\"/\");\r\n if (arr && arr[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n return arr[0];\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n // if we can't get domain, entire endpoint will be used\r\n return endpoint;\r\n}\r\n/**\r\n * If current value is equal or greater than zero.\r\n * @param value number\r\n * @returns boolean\r\n */\r\nexport function isGreaterThanZero(value) {\r\n return value >= 0;\r\n}\r\n//Base64 is a binary encoding rather than a text encoding,\r\n// it were added to the web platform before it supported binary data types.\r\n// As a result, the two functions use strings to represent binary data\r\nvar _base64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n/**\r\n * Base64-encodes a Uint8Array.\r\n *\r\n * @param data the Uint8Array or string to encode.\r\n *\r\n * @return the base64-encoded output string.\r\n */\r\nexport function base64Encode(data) {\r\n var line = \"\";\r\n var input = \"\";\r\n if (isString(data)) {\r\n input = data;\r\n }\r\n else {\r\n input = data[_DYN_TO_STRING /* @min:%2etoString */]();\r\n }\r\n var output = \"\";\r\n // tslint:disable-next-line:one-variable-per-declaration\r\n var chr1, chr2, chr3;\r\n var lp = 0;\r\n while (lp < input[_DYN_LENGTH /* @min:%2elength */]) {\r\n chr1 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);\r\n chr2 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);\r\n chr3 = input[_DYN_CHAR_CODE_AT /* @min:%2echarCodeAt */](lp++);\r\n // encode 4 character group\r\n line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](chr1 >> 2);\r\n line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](((chr1 & 3) << 4) | (chr2 >> 4));\r\n if (isNaN(chr2)) {\r\n line += \"==\";\r\n }\r\n else {\r\n line += _base64[_DYN_CHAR_AT /* @min:%2echarAt */](((chr2 & 15) << 2) | (chr3 >> 6));\r\n line += isNaN(chr3) ? \"=\" : _base64[_DYN_CHAR_AT /* @min:%2echarAt */](chr3 & 63);\r\n }\r\n }\r\n output += line;\r\n return output;\r\n}\r\n/**\r\n * Base64-decodes an encoded string and transforms it back to a Uint8Array.\r\n * @param input the encoded string to decode\r\n * @return Uint8Array\r\n */\r\nexport function base64Decode(input) {\r\n var output = \"\";\r\n var chr1, chr2, chr3;\r\n var enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n input = input[_DYN_REPLACE /* @min:%2ereplace */](/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\r\n while (i < input[_DYN_LENGTH /* @min:%2elength */]) {\r\n enc1 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));\r\n enc2 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));\r\n enc3 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));\r\n enc4 = _base64[_DYN_INDEX_OF /* @min:%2eindexOf */](input[_DYN_CHAR_AT /* @min:%2echarAt */](i++));\r\n chr1 = (enc1 << 2) | (enc2 >> 4);\r\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\r\n chr3 = ((enc3 & 3) << 6) | enc4;\r\n output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr1);\r\n if (enc3 != 64) {\r\n output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr2);\r\n }\r\n if (enc4 != 64) {\r\n output = output + String[_DYN_FROM_CHAR_CODE /* @min:%2efromCharCode */](chr3);\r\n }\r\n }\r\n var arr = output[_DYN_SPLIT /* @min:%2esplit */](\",\").map(function (c) { return Number(c); });\r\n return new Uint8Array(arr);\r\n}\r\n/**\r\n * Get number value of current time and append a random float number.\r\n * For example, if current time value is 12345678, so \"12345678.randomfl\" will be returned\r\n * @returns time id string\r\n */\r\nexport function getTimeId() {\r\n var time = (new Date())[_DYN_GET_TIME /* @min:%2egetTime */]();\r\n // append random digits to avoid same timestamp value\r\n var random = strSubstr(generateW3CId(), 0, 8);\r\n // function to create spanid();\r\n return time + \".\" + random;\r\n}\r\n/**\r\n * Get time value from a time id that is generated from getTimeId() function.\r\n * For example, if time id is \"12345678.randomfl\", 12345678 will be returned\r\n * @param id time id string\r\n * @returns time value number\r\n */\r\nexport function getTimeFromId(id) {\r\n try {\r\n var regex = new RegExp(/\\d+\\./g);\r\n if (id && isString(id) && regex.test(id)) {\r\n var arr = id[_DYN_SPLIT /* @min:%2esplit */](\".\");\r\n return parseInt(arr[0]);\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return 0;\r\n}\r\n// OneCollector:\r\n// 200-OK – Success or partial success.\r\n// 204-NoContent – Success or partial success. Regarding accepting events, identical to 200-OK. If the request header contains NoResponseBody with the value of true and the request was successful/partially successful, 204-NoContent status code is returned instead of 200-OK.\r\n// 400-BadRequest – all events were rejected.\r\n// 403-Forbidden – client is above its quota and all events were throttled.\r\n// 413-RequestEntityTooLarge – the request doesn’t conform to limits described in Request constraints section.\r\n// 415-UnsupportedMediaType – the Content-Type or Content-Encoding header has an unexpected value.\r\n// 429-TooManyRequests – the server decided to throttle given request (no data accepted) as the client (device, client version, …) generates too much traffic.\r\n// 401-Unauthorized – Can occur under two conditions:\r\n// All tenant tokens included in this request are invalid (unauthorized). kill-tokens header indicates which one(s). WWW-Authenticate: Token realm=\"ingestion\" (see: rfc2617 for more details) header is added.\r\n// The client has supplied the “strict” header (see section 3.3), and at least one MSA and/or XAuth event token cannot be used as a source of trusted user or device information. The event failure reason “TokenCrackingFailure” will be present in the response’ JSON body. In this scenario, the client is expected to fix or replace the offending ticket and retry.\r\n// 500-InternalServerError – an unexpected exception while handling the request.\r\n// 503-ServiceUnavailable – a machine serving this request is overloaded or shutting down. The request should be retried to a different machine. The server adds Connection: Close header to enforce TCP connection closing.\r\n// Breeze\r\n// 0 ad blockers\r\n// 200 Success!\r\n// 206 - Partial Accept\r\n// 307/308 - Redirect\r\n// 400 - Invalid\r\n// 400 can also be caused by Azure AD authentication.\r\n// 400 is not retriable and SDK should drop invalid data.\r\n// 401 - Unauthorized\r\n// 401 can be also caused by an AAD outage.\r\n// 401 is retriable.\r\n// 402 - Daily Quota Exceeded, drop the data.\r\n// There is no retry-after in the response header for 402.\r\n// 403 - Forbidden\r\n// 403 can also caused by misconfiguring the access control assigned to the Application Insights resource.\r\n// 403 is retriable.\r\n// 404 - Ingestion is allowed only from stamp specific endpoint\r\n// Telemetry will be dropped and customer must update their connection string.\r\n// 404 is not retriable and SDK should drop the data.\r\n// 408 - Timeout, retry it later. (offline might get this)\r\n// 429 - Too Many Requests, Breeze returns retry-after for status code 429 only.\r\n// 500 - Internal Server Error, retry it later.\r\n// 502 - Bad Gateway, retry it later.\r\n// 503 - Service Unavailable, retry it later. (offline)\r\n// 504 - Gateway timeout, retry it later.\r\n// All other response codes, SDK should drop the data.\r\n//# sourceMappingURL=Utils.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.1.0-nightly3.2402-06
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
8
|
+
import { isNullOrUndefined } from "@microsoft/applicationinsights-core-js";
|
|
9
|
+
import { _DYN_ADD_EVENT, _DYN_ENDPOINT, _DYN_GET_ITEMS, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLICE, _DYN_SPLIT } from "./__DynamicConstants";
|
|
10
|
+
var InMemoryBatch = /** @class */ (function () {
|
|
11
|
+
function InMemoryBatch(logger, endpoint, evts, evtsLimitInMem) {
|
|
12
|
+
var _buffer = evts ? [].concat(evts) : [];
|
|
13
|
+
dynamicProto(InMemoryBatch, this, function (_self) {
|
|
14
|
+
_self[_DYN_ENDPOINT /* @min:%2eendpoint */] = function () {
|
|
15
|
+
return endpoint;
|
|
16
|
+
};
|
|
17
|
+
_self[_DYN_ADD_EVENT /* @min:%2eaddEvent */] = function (payload) {
|
|
18
|
+
if (!isNullOrUndefined(evtsLimitInMem) && _self.count() >= evtsLimitInMem) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
_buffer[_DYN_PUSH /* @min:%2epush */](payload);
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
_self.count = function () {
|
|
25
|
+
return _buffer[_DYN_LENGTH /* @min:%2elength */];
|
|
26
|
+
};
|
|
27
|
+
_self.clear = function () {
|
|
28
|
+
_buffer = [];
|
|
29
|
+
};
|
|
30
|
+
_self[_DYN_GET_ITEMS /* @min:%2egetItems */] = function () {
|
|
31
|
+
return _buffer.slice(0);
|
|
32
|
+
};
|
|
33
|
+
_self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvt, numEvts) {
|
|
34
|
+
// Create a new batch with the same endpointUrl
|
|
35
|
+
var theEvts;
|
|
36
|
+
if (fromEvt < _buffer[_DYN_LENGTH /* @min:%2elength */]) {
|
|
37
|
+
var cnt = _buffer[_DYN_LENGTH /* @min:%2elength */] - fromEvt;
|
|
38
|
+
if (!isNullOrUndefined(numEvts)) {
|
|
39
|
+
cnt = numEvts < cnt ? numEvts : cnt;
|
|
40
|
+
}
|
|
41
|
+
theEvts = _buffer[_DYN_SPLICE /* @min:%2esplice */](fromEvt, cnt);
|
|
42
|
+
}
|
|
43
|
+
return new InMemoryBatch(logger, endpoint, theEvts, evtsLimitInMem);
|
|
44
|
+
};
|
|
45
|
+
_self.createNew = function (newEndpoint, evts, evtsLimitInMem) {
|
|
46
|
+
return new InMemoryBatch(logger, newEndpoint, evts, evtsLimitInMem);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// Removed Stub for InMemoryBatch.prototype.addEvent.
|
|
51
|
+
// Removed Stub for InMemoryBatch.prototype.endpoint.
|
|
52
|
+
// Removed Stub for InMemoryBatch.prototype.count.
|
|
53
|
+
// Removed Stub for InMemoryBatch.prototype.clear.
|
|
54
|
+
// Removed Stub for InMemoryBatch.prototype.getItems.
|
|
55
|
+
// Removed Stub for InMemoryBatch.prototype.split.
|
|
56
|
+
// Removed Stub for InMemoryBatch.prototype.createNew.
|
|
57
|
+
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
|
58
|
+
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
|
59
|
+
InMemoryBatch.__ieDyn=1;
|
|
60
|
+
|
|
61
|
+
return InMemoryBatch;
|
|
62
|
+
}());
|
|
63
|
+
export { InMemoryBatch };
|
|
64
|
+
//# sourceMappingURL=InMemoryBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InMemoryBatch.js.map","sources":["InMemoryBatch.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isNullOrUndefined } from \"@microsoft/applicationinsights-core-js\";\r\nimport { _DYN_ADD_EVENT, _DYN_ENDPOINT, _DYN_GET_ITEMS, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLICE, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nvar InMemoryBatch = /** @class */ (function () {\r\n function InMemoryBatch(logger, endpoint, evts, evtsLimitInMem) {\r\n var _buffer = evts ? [].concat(evts) : [];\r\n dynamicProto(InMemoryBatch, this, function (_self) {\r\n _self[_DYN_ENDPOINT /* @min:%2eendpoint */] = function () {\r\n return endpoint;\r\n };\r\n _self[_DYN_ADD_EVENT /* @min:%2eaddEvent */] = function (payload) {\r\n if (!isNullOrUndefined(evtsLimitInMem) && _self.count() >= evtsLimitInMem) {\r\n return false;\r\n }\r\n _buffer[_DYN_PUSH /* @min:%2epush */](payload);\r\n return true;\r\n };\r\n _self.count = function () {\r\n return _buffer[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self.clear = function () {\r\n _buffer = [];\r\n };\r\n _self[_DYN_GET_ITEMS /* @min:%2egetItems */] = function () {\r\n return _buffer.slice(0);\r\n };\r\n _self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvt, numEvts) {\r\n // Create a new batch with the same endpointUrl\r\n var theEvts;\r\n if (fromEvt < _buffer[_DYN_LENGTH /* @min:%2elength */]) {\r\n var cnt = _buffer[_DYN_LENGTH /* @min:%2elength */] - fromEvt;\r\n if (!isNullOrUndefined(numEvts)) {\r\n cnt = numEvts < cnt ? numEvts : cnt;\r\n }\r\n theEvts = _buffer[_DYN_SPLICE /* @min:%2esplice */](fromEvt, cnt);\r\n }\r\n return new InMemoryBatch(logger, endpoint, theEvts, evtsLimitInMem);\r\n };\r\n _self.createNew = function (newEndpoint, evts, evtsLimitInMem) {\r\n return new InMemoryBatch(logger, newEndpoint, evts, evtsLimitInMem);\r\n };\r\n });\r\n }\r\n InMemoryBatch.prototype.addEvent = function (payload) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n InMemoryBatch.prototype.endpoint = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n InMemoryBatch.prototype.count = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return 0;\r\n };\r\n InMemoryBatch.prototype.clear = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n InMemoryBatch.prototype.getItems = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Split this batch into 2 with any events > fromEvent returned in the new batch and all other\r\n * events are kept in the current batch.\r\n * @param fromEvt The first event to remove from the current batch.\r\n * @param numEvts The number of events to be removed from the current batch and returned in the new one. Defaults to all trailing events\r\n */\r\n InMemoryBatch.prototype.split = function (fromEvt, numEvts) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * create current buffer to a new endpoint\r\n * @param endpoint if not defined, current endpoint will be used\r\n * @param evts new events to be added\r\n * @param addCurEvts if it is set to true, current itemss will be transferred to the new batch\r\n */\r\n InMemoryBatch.prototype.createNew = function (endpoint, evts, evtsLimitInMem) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return InMemoryBatch;\r\n}());\r\nexport { InMemoryBatch };\r\n//# sourceMappingURL=InMemoryBatch.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;sDAsCM,CAAC;;;;;yBACkB;AACzB;AACA;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IInMemoryBatch.js.map","sources":["IInMemoryBatch.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=IInMemoryBatch.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.1.0-nightly3.2402-06
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {};
|
|
8
|
+
//export declare type createOfflineBatchHandler = (storageType: eStorageType, cfg?: IOfflineBatchHandlerCfg) => IOfflineBatchHandler;
|
|
9
|
+
//# sourceMappingURL=IOfflineBatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IOfflineBatch.js.map","sources":["IOfflineBatch.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//export declare type createOfflineBatchHandler = (storageType: eStorageType, cfg?: IOfflineBatchHandlerCfg) => IOfflineBatchHandler;\r\n//# sourceMappingURL=IOfflineBatch.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IOfflineIndexDb.js.map","sources":["IOfflineIndexDb.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=IOfflineIndexDb.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IOfflineProvider.js.map","sources":["IOfflineProvider.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=IOfflineProvider.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISender.js.map","sources":["ISender.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=ISender.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|