push neon reactor

This commit is contained in:
2026-07-12 15:11:38 +02:00
parent 172e72dbcd
commit aeab5f7820
9597 changed files with 2407488 additions and 0 deletions
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
@@ -0,0 +1,14 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+17
View File
@@ -0,0 +1,17 @@
NOTICES AND INFORMATION
Do Not Translate or Localize
This software incorporates material from third parties. Microsoft makes certain
open source code available at https://3rdpartysource.microsoft.com, or you may
send a check or money order for US $5.00, including the product name, the open
source component name, and version number, to:
Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA
Notwithstanding any other terms, you may reverse engineer this software to the
extent required to debug changes to any libraries licensed under the GNU Lesser
General Public License.
+3
View File
@@ -0,0 +1,3 @@
# Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsofts privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
+152
View File
@@ -0,0 +1,152 @@
# Microsoft 1DS Web SDK Core
## Description
1DS Web SDK Core is the telemetry orchestrator, responsible for initializing all attached plugins and calling process() on each of them.
## npm
Packages available [here](https://www.npmjs.com/package/@microsoft/1ds-core-js).
## Basic Usage
### Setup
```js
import { AppInsightsCore, IExtendedConfiguration } from '@microsoft/1ds-core-js';
```
```js
var appInsightsCore: AppInsightsCore = new AppInsightsCore();
var coreConfig: IExtendedConfiguration = {
instrumentationKey: "YOUR_TENANT_KEY"
};
//Initialize SDK
appInsightsCore.initialize(coreConfig, []);
```
## Configuration
### [IExtendedConfiguration](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html)
| Config | Description | Type
|----------------|----------------------------------------|----|
| [instrumentationKey](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#instrumentationKey) |Instrumentation key of resource.|string
| [diagnosticLogInterval](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#diagnosticLogInterval) |Polling interval (in ms) for internal logging queue.|number
| [maxMessageLimit](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#maxMessageLimit) |Maximum number of iKey transmitted logging telemetry per page view.|number
| [loggingLevelConsole](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#loggingLevelConsole) |Console logging level. All logs with a severity level higher than the configured level will be printed to console. Otherwise they are suppressed. |number
| [loggingLevelTelemetry](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#loggingLevelTelemetry) |Telemtry logging level to instrumentation key. All logs with a severity level higher than the configured level will sent as telemetry data to the configured instrumentation key.|number
| [enableDebugExceptions](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#enableDebugExceptions) |If enabled, uncaught exceptions will be thrown to help with debugging.|boolean
| [endpointUrl](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#endpointUrl) |Endpoint where telemetry data is sent.|string
| [extensionConfig](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#extensionConfig) |Extension configs loaded in SDK.|[key: string]: any;
| [extensions](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#extensions) |Additional plugins that should be loaded by core at runtime.| Array< ITelemetryPlugin>
| [channels](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#channels) |Channel queues that is setup by caller in desired order.|Array< IChannelControls[]>
| [propertyStorageOverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#propertyStorageOverride) |The property storage override that should be used to store internal SDK properties, otherwise stored as cookies. It is needed where cookies are not available.|IPropertyStorageOverride
| [cookieCfg](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#cookieCfg) | Defaults to cookie usage enabled see [ICookieCfgConfig](#ICookieMgrConfig) settings for full defaults. | [ICookieCfgConfig](#ICookieMgrConfig)<br>[Optional]<br>(Since 3.1.0)
| [disableCookiesUsage](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#disableCookiesUsage) |A boolean that indicated whether to disable the use of cookies by the Aria SDK. The cookies added by the SDK are MicrosoftApplicationsTelemetryDeviceId and MicrosoftApplicationsTelemetryFirstLaunchTime. If cookies are disabled, then session events are not sent unless propertyStorageOverride is provided to store the values elsewhere.|boolean
| [cookieDomain](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#cookieDomain) | Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.<br>(Since v3.1.0) If `cookieCfg.domain` is defined it will take precedence over this value. | alias for [`cookieCfg.domain`](#ICookieMgrConfig)<br>[Optional]<br>(Since 3.1.0)
| [cookiePath](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#cookiePath) | Custom cookie path. This is helpful if you want to share Application Insights cookies behind an application gateway.<br>If `cookieCfg.path` is defined it will take precedence over this value. | alias for [`cookieCfg.path`](#ICookieMgrConfig)<br>[Optional]<br>(Since 3.1.0) |
| [anonCookieName](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#anonCookieName) |Name of the Anon cookie. The value will be set in the qsp header to collector requests. Collector will use this value to look for specific cookie to use for anid property.|string
| [enablePerfMgr](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#enablePerfMgr) | [Optional] When enabled (true) this will create local perfEvents for code that has been instrumented to emit perfEvents (via the doPerf() helper). This can be used to identify performance issues within the SDK based on your usage or optionally within your own instrumented code. [More details are available by the basic documentation](https://github.com/microsoft/ApplicationInsights-JS/blob/main/docs/PerformanceMonitoring.md). Since v2.4.0| boolean<br/>Defaults to false
| [perfEvtsSendAll](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#perfEvtsSendAll) | [Optional] When _enablePerfMgr_ is enabled and the [IPerfManager](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/IPerfManager.html) fires a [INotificationManager](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/INotificationManager.html).perfEvent() this flag determines whether an event is fired (and sent to all listeners) for all events (true) or only for 'parent' events (false &lt;default&gt;).<br />A parent [IPerfEvent](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/IPerfEvent.html) is an event where no other IPerfEvent is still running at the point of this event being created and it's _parent_ property is not null or undefined. Since v2.4.0 | boolean<br />Defaults to false
| [idLength](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#idLength) | [Optional] Identifies the default length used to generate new random session and user id's. Defaults to 22, previous default value was 5 (v2.4.2 or less), if you need to keep the previous maximum length you should set this value to 5. | number<br />Default: 22
| [disableEventTimings](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#disableEventTimings) | [Optional] Disables additional internal event timings that are added during processing of events, the timings are not sent as part telemetry items to the server. | boolean<br/>Default: false
| [enableCompoundKey](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#enableCompoundKey) | [Optional] Enables support for objects with compound keys which indirectly represent an object where the "key" of the object contains a "." as part of it's name.<br />Example: <code>event: { "somedata.embeddedvalue": 123 } </code> | boolean<br />Default: false
| [disablePageUnloadEvents](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#disablePageUnloadEvents) | [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.<br /> Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide". See [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html) for details.| string[]<br />Default: not specified
| [disablePageShowEvents](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IExtendedConfiguration.html#disablePageShowEvents) | [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.<br/> Page Show events include "pageshow" and "visibilitychange" (with 'visible' state). See [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html) for details.| string[]<br /> Default: not specified
### [IPropertyStorageOverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IPropertyStorageOverride.html)
| Config | Description | Type
|----------------|----------------------------------------|----|
| [setProperty](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IPropertyStorageOverride.html#setProperty) |A function for passing key value pairs to be stored.| function
| [getProperty](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js/interfaces/IPropertyStorageOverride.html#getProperty) | A function that gets a value for a given key.| function
### [ICookieMgrConfig](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html)
Cookie Configuration for instance based cookie management added in version 3.1.0.
| Name | Description | <div style="width:250px">Type</div> |
|------|-------------|--------------|
| [enabled](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#enabled) | A boolean that indicates whether the use of cookies by the SDK is enabled by the current instance. If false, the instance of the SDK initialized by this configuration will not store or read any data from cookies | boolean | true |
| [domain](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#domain) | Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains. If not provided uses the value from root `cookieDomain` value. | string<br/>Defaults: null |
| [path](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#path) | Specifies the path to use for the cookie, if not provided it will use any value from the root `cookiePath` value. | string<br/>Defaults: / |
| [ignoreCookies](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#ignoreCookies) | Specify the cookie name(s) to be ignored, this will cause any matching cookie name to never be read or written. They may still be explicitly purged or deleted. You do not need to repeat the name in the `blockedCookies` configuration.(Since v3.2.7) | string[] <br/> Defaults: undefined |
| [blockedCookies](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#blockedCookies) | Specify the cookie name(s) to never be written, this will cause any cookie name to never be created or updated, they will still be read unless also included in the ignoreCookies and may still be explicitly purged or deleted. If not provided defaults to the same list provided in ignoreCookies. (Since v3.2.7) | string[] <br/> Defaults: undefined |
| [getCookie](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#getCookie) | Function to fetch the named cookie value, if not provided it will use the internal cookie parsing / caching. | `(name: string) => string`<br/>Defaults: null |
| [setCookie](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#setCookie) | Function to set the named cookie with the specified value, only called when adding or updating a cookie. | `(name: string, value: string) => void`<br/>Defaults: null |
| [delCookie](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgrConfig.html#delCookie) | Function to delete the named cookie with the specified value, separated from setCookie to avoid the need to parse the value to determine whether the cookie is being added or removed.if not provided it will use the internal cookie parsing / caching. | `(name: string, value: string) => void`<br/>Defaults: null |
## Cookie Handling
From version 3.1.0, cookie management is now available directly from the instance and can be disabled and re-enabled after initialization.
If cookie usage is disabled during initialization via the `disableCookiesUsage` configurations, you can now re-enable via the [ICookieMgr](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgr.html) `setEnabled` function.
The instance based cookie management also replaces the previous CoreUtils and global functions of `disableCookies()`, `setCookie(...)`, `getCookie(...)` and `deleteCookie(...)`. And to benefit from the tree-shaking enhancements also introduced as part of version 3.1.0 you should no longer uses the global functions.
### Simplified Usage of new instance Cookie Manager
- oneDs.[getCookieMgr()](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgr.html).setEnabled(true/false)
- oneDs.[getCookieMgr()](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgr.html).set("MyCookie", "thevalue");
- oneDs.[getCookieMgr()](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgr.html).get("MyCookie");
- oneDs.[getCookieMgr()](https://microsoft.github.io/ApplicationInsights-JS/webSdk/applicationinsights-core-js/interfaces/ICookieMgr.html).del("MyCookie");
### Blocking individual cookies
Since v3.2.7 you can now specify which Cookie name(s) that you want the SDK to either ignore (never read, written or created) or blocked (will be read if already present but will not write or create), this is useful for blocking non-critical Cookies that your site does not need but the SDK automatically populates. These settings only affect the Javascript SDK reading, writing and creation of the cookies and do NOT affect automatic cookies added by the Collector. See the ["Cookies Set/Read by 1DS Web SDK" section of the linked page](https://eng.ms/docs/products/geneva/collect/instrument/1ds/javascriptsdk/getting-started).
Example.
```typescript
var coreConfig: IExtendedConfiguration = {
instrumentationKey: "YOUR_TENANT_KEY",
cookieCfg: {
ignoreCookies: [ "MicrosoftApplicationsTelemetryDeviceId" ]
}
extensions: [ /* Your extensions */ ],
extensionConfig: []
};
```
## API documentation
[Typedoc generated API reference](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-core-js)
## Learn More
You can learn more in [1DS First party (Internal) getting started](https://aka.ms/1dsjs).
## Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at [https://go.microsoft.com/fwlink/?LinkID=824704](https://go.microsoft.com/fwlink/?LinkID=824704). You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
To turn off sending telemetry to Microsoft, ensure that the POST channel is not configured in the extensions. See below configuration for example:
```js
var coreConfig: IExtendedConfiguration = {
instrumentationKey: "YOUR_TENANT_KEY",
extensions: [
postChannel // << REMOVE THIS EXTENSION TO STOP SENDING TELEMETRY TO MICROSOFT
],
extensionConfig: []
};
```
## Contributing
Read our [contributing guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Application Insights.
## Data Collection
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsofts privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsofts Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-partys policies.
## License
[MIT](./LICENSE.TXT)
+41
View File
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->
+14
View File
@@ -0,0 +1,14 @@
# Support
## How to file issues and get help
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.
For help and questions about using this project, please create a Support request issue on
https://github.com/microsoft/ApplicationInsights-JS/issues.
## Microsoft Support Policy
Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
{
"name": "ms.core",
"version": "4.3.11",
"ext": {
"@gbl.js": {
"file": "ms.core-4.3.11.gbl.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-MRkoUy4DV0UOHbPlqUF0eoKl2ZaVUDpm9gFp8WqNU9g= sha384-YdKeDdetZX7TIEcjBfTEiHPsLHvHMlPotual4mKTnqqva4w0+4c/r5FL1+rF/8As sha512-LbVHpvVL2dzGkQzlw+4jcYit/qDRr3K1Av/94cVQMN0tQ0Ep4gf+bc7jIH4TCuLoARq0OsH92rsnUeNCZlJ0RQ==",
"hashes": {
"sha256": "MRkoUy4DV0UOHbPlqUF0eoKl2ZaVUDpm9gFp8WqNU9g=",
"sha384": "YdKeDdetZX7TIEcjBfTEiHPsLHvHMlPotual4mKTnqqva4w0+4c/r5FL1+rF/8As",
"sha512": "LbVHpvVL2dzGkQzlw+4jcYit/qDRr3K1Av/94cVQMN0tQ0Ep4gf+bc7jIH4TCuLoARq0OsH92rsnUeNCZlJ0RQ=="
}
},
"@gbl.min.js": {
"file": "ms.core-4.3.11.gbl.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-7xmqq259dved35dpH5n7Xtr1ATHyMPEXKO0iubpVURY= sha384-1fOYZws6THHUJoBlXbYFeytqUMpVf/AKJvDE60o2hhQ9Wby/Av0XfZ7YBdTGEb5k sha512-ihZWWIoH4CGt1ufWPQIDwAiLHEnATx9nWtRomphkSabqXVlmYefuqnOkU16Z1+fcQ7VRUPagz82VPAhLAZENZg==",
"hashes": {
"sha256": "7xmqq259dved35dpH5n7Xtr1ATHyMPEXKO0iubpVURY=",
"sha384": "1fOYZws6THHUJoBlXbYFeytqUMpVf/AKJvDE60o2hhQ9Wby/Av0XfZ7YBdTGEb5k",
"sha512": "ihZWWIoH4CGt1ufWPQIDwAiLHEnATx9nWtRomphkSabqXVlmYefuqnOkU16Z1+fcQ7VRUPagz82VPAhLAZENZg=="
}
},
"@js": {
"file": "ms.core-4.3.11.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-VxDmgBFxCWhNialefISZmeFEo3BMmOc0jzw5Ps9U8uQ= sha384-6tc47po83yvAlxJcYyl6Pt0lL0uS5HtI3PjMKZYGf5IVdQSVPGjsEJ0a3cydqD4x sha512-v9FdFIdf13lS0QiGTVN5jB2hAJrmgz/1Oh6yT7ZJSqvPPK45tIXaECPkjUHkm7/jCNs4HMU2LZG7CxFzLdrlFQ==",
"hashes": {
"sha256": "VxDmgBFxCWhNialefISZmeFEo3BMmOc0jzw5Ps9U8uQ=",
"sha384": "6tc47po83yvAlxJcYyl6Pt0lL0uS5HtI3PjMKZYGf5IVdQSVPGjsEJ0a3cydqD4x",
"sha512": "v9FdFIdf13lS0QiGTVN5jB2hAJrmgz/1Oh6yT7ZJSqvPPK45tIXaECPkjUHkm7/jCNs4HMU2LZG7CxFzLdrlFQ=="
}
},
"@min.js": {
"file": "ms.core-4.3.11.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-GQr2UBtA0RQkb/3eWQ3ZxGivdqbP7mZkjiP7Srqsqhs= sha384-WIn9eqAHE4UtpQrhOAdLOidpmUmd1mBpjDOD8aISQANtHZWRseRg+y78e2AyOyPq sha512-fm3YV535uLeY2xLHccKfbzYlYmskgBMSoEzS6jC05i5nOs86qAQOCrCjQpYTXjMgCDB4OpFOSRMyG5NE1w//5Q==",
"hashes": {
"sha256": "GQr2UBtA0RQkb/3eWQ3ZxGivdqbP7mZkjiP7Srqsqhs=",
"sha384": "WIn9eqAHE4UtpQrhOAdLOidpmUmd1mBpjDOD8aISQANtHZWRseRg+y78e2AyOyPq",
"sha512": "fm3YV535uLeY2xLHccKfbzYlYmskgBMSoEzS6jC05i5nOs86qAQOCrCjQpYTXjMgCDB4OpFOSRMyG5NE1w//5Q=="
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
{
"name": "ms.core",
"version": "4.3.11",
"ext": {
"@gbl.js": {
"file": "ms.core.gbl.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-iTpP+rIlT+GZ53FoOOjXUt0t3k9o+0D8ETa5UIM9/kk= sha384-A3GqO8Z7a8QZoAVb1V/2Xa07NXXGUTIPHX1BLtPgeuj/eT8cJ6SwUbqpz5H61VS8 sha512-ZMYRIRyz5uRSSLmiJh50wTpiirERv8qRZEddlEhjd91cb/rUjwmJbJ7hwRaSCwcAj5ag2zbSuvHCm/WHqNJFLg==",
"hashes": {
"sha256": "iTpP+rIlT+GZ53FoOOjXUt0t3k9o+0D8ETa5UIM9/kk=",
"sha384": "A3GqO8Z7a8QZoAVb1V/2Xa07NXXGUTIPHX1BLtPgeuj/eT8cJ6SwUbqpz5H61VS8",
"sha512": "ZMYRIRyz5uRSSLmiJh50wTpiirERv8qRZEddlEhjd91cb/rUjwmJbJ7hwRaSCwcAj5ag2zbSuvHCm/WHqNJFLg=="
}
},
"@gbl.min.js": {
"file": "ms.core.gbl.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-rk33DCX7zBEmXYpnFMaHUH5jByYMH+xe84RXjscaYq4= sha384-+ONJBEv/YR6nnjDsuYX2zQsoKH1/pYHzWFAY8gKXXLWPWQjjqt1j/1AoJv7Eo4K5 sha512-Bm2v2smhVRxoTg/V3l3ANL4ugfyIu9LnGKJGE0MvIFHpkyC5c7mkAEVEf8FAzS94zwj4U6aPboXzbDDxJwT7FA==",
"hashes": {
"sha256": "rk33DCX7zBEmXYpnFMaHUH5jByYMH+xe84RXjscaYq4=",
"sha384": "+ONJBEv/YR6nnjDsuYX2zQsoKH1/pYHzWFAY8gKXXLWPWQjjqt1j/1AoJv7Eo4K5",
"sha512": "Bm2v2smhVRxoTg/V3l3ANL4ugfyIu9LnGKJGE0MvIFHpkyC5c7mkAEVEf8FAzS94zwj4U6aPboXzbDDxJwT7FA=="
}
},
"@js": {
"file": "ms.core.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-xuVEvFltrzA85L7XSq/Pf85GOOHbWyYGwmazX348tbs= sha384-QdVQWeETeDM+p14Hqt4s/B2qJDPOPkEFr9cG/44hge0ZGrKuMGuA6tHvPO7ZywIn sha512-A++B9jCeDp62WocPiarfnUfgmrNkDoEd6Wbh3pDmS9e80ixbEYBhuZG5Fw1W7JCHbzAOarK7QinXE0D14bGt2w==",
"hashes": {
"sha256": "xuVEvFltrzA85L7XSq/Pf85GOOHbWyYGwmazX348tbs=",
"sha384": "QdVQWeETeDM+p14Hqt4s/B2qJDPOPkEFr9cG/44hge0ZGrKuMGuA6tHvPO7ZywIn",
"sha512": "A++B9jCeDp62WocPiarfnUfgmrNkDoEd6Wbh3pDmS9e80ixbEYBhuZG5Fw1W7JCHbzAOarK7QinXE0D14bGt2w=="
}
},
"@min.js": {
"file": "ms.core.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-uREf/Fs503OjuzECGS2lGovOdb1TCd2pQREesbvKduk= sha384-TdB2PdqI2gdSMm4Ai9V9Ho9gR4vpX+rmfYHZACKogn1iave9ZNiAaDhZNcs5zdfj sha512-5uAvJlTpgPv7ZGsK7reG4qIL0CE6yZSoffzFHjNqo86ISOB1mSmywrWKIae8mZdew3MTdSRmM/tPO04YyDAUug==",
"hashes": {
"sha256": "uREf/Fs503OjuzECGS2lGovOdb1TCd2pQREesbvKduk=",
"sha384": "TdB2PdqI2gdSMm4Ai9V9Ho9gR4vpX+rmfYHZACKogn1iave9ZNiAaDhZNcs5zdfj",
"sha512": "5uAvJlTpgPv7ZGsK7reG4qIL0CE6yZSoffzFHjNqo86ISOB1mSmywrWKIae8mZdew3MTdSRmM/tPO04YyDAUug=="
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,95 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
/**
* AppInsightsCore.ts
* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
* @copyright Microsoft 2018
*/
import dynamicProto from "@microsoft/dynamicproto-js";
import { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, doPerf, dumpObj, throwError } from "@microsoft/applicationinsights-core-js";
import { objDeepFreeze } from "@nevware21/ts-utils";
import { STR_DEFAULT_ENDPOINT_URL, STR_EMPTY, STR_PROPERTIES, STR_VERSION } from "./InternalConstants";
import { FullVersionString, getTime, isLatency } from "./Utils";
import { _DYN_INDEX_OF, _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS, _DYN_TIMINGS } from "./__DynamicConstants";
/**
* The default settings for the config.
* WE MUST include all defaults here to ensure that the config is created with all of the properties
* defined as dynamic.
*/
var defaultConfig = objDeepFreeze({
endpointUrl: STR_DEFAULT_ENDPOINT_URL,
propertyStorageOverride: { isVal: _chkPropOverride }
});
function _chkPropOverride(propertyStorageOverride) {
// Validate property storage override
if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {
throwError("Invalid property storage override passed.");
}
return true;
}
/**
* @group Classes
* @group Entrypoint
*/
var AppInsightsCore = /** @class */ (function (_super) {
__extends(AppInsightsCore, _super);
function AppInsightsCore() {
var _this = _super.call(this) || this;
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
try {
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);
}
catch (e) {
var logger_1 = _self.logger;
var message = dumpObj(e);
if (message[_DYN_INDEX_OF /* @min:%2eindexOf */]("channels") !== -1) {
// Add some additional context to the underlying reported error
message += "\n - Channels must be provided through config.channels only!";
}
_throwInternal(logger_1, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, "SDK Initialization Failed - no telemetry will be sent: " + message);
}
}, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
};
_self.track = function (item) {
doPerf(_self, function () { return "AppInsightsCore.track"; }, function () {
var telemetryItem = item;
if (telemetryItem) {
telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] || {};
telemetryItem[_DYN_TIMINGS /* @min:%2etimings */].trackStart = getTime();
if (!isLatency(telemetryItem.latency)) {
telemetryItem.latency = 1 /* EventLatencyValue.Normal */;
}
var itemExt = telemetryItem.ext = telemetryItem.ext || {};
itemExt.sdk = itemExt.sdk || {};
itemExt.sdk.ver = FullVersionString;
var baseData = telemetryItem.baseData = telemetryItem.baseData || {};
baseData[STR_PROPERTIES /* @min:%2eproperties */] = baseData[STR_PROPERTIES /* @min:%2eproperties */] || {};
var itemProperties = baseData[STR_PROPERTIES /* @min:%2eproperties */];
itemProperties[STR_VERSION] = itemProperties[STR_VERSION] || _self.pluginVersionString || STR_EMPTY;
}
_base.track(telemetryItem);
}, function () { return ({ item: item }); }, !(item.sync));
};
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {
return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || "InternalLog");
};
});
return _this;
}
// Removed Stub for AppInsightsCore.prototype.initialize.
// Removed Stub for AppInsightsCore.prototype.track.
// Removed Stub for AppInsightsCore.prototype.pollInternalLogs.
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
AppInsightsCore.__ieDyn=1;
return AppInsightsCore;
}(InternalCore));
export { AppInsightsCore };
//# sourceMappingURL=AppInsightsCore.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,67 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
/**
* BaseCore.ts
* Base Core is a subset of 1DS Web SDK Core. The purpose of Base Core is to generate a smaller bundle size while providing essential features of Core. Features that are not included in Base Core are:
* 1. Internal logging
* 2. Sending notifications on telemetry sent/discarded
* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
* @copyright Microsoft 2018
*/
import dynamicProto from "@microsoft/dynamicproto-js";
import { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, dumpObj } from "@microsoft/applicationinsights-core-js";
import { objDeepFreeze } from "@nevware21/ts-utils";
import { STR_DEFAULT_ENDPOINT_URL } from "./InternalConstants";
import { FullVersionString } from "./Utils";
import { _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS } from "./__DynamicConstants";
/**
* The default settings for the config.
* WE MUST include all defaults here to ensure that the config is created with all of the properties
* defined as dynamic.
*/
var defaultConfig = objDeepFreeze({
endpointUrl: STR_DEFAULT_ENDPOINT_URL
});
var BaseCore = /** @class */ (function (_super) {
__extends(BaseCore, _super);
function BaseCore() {
var _this = _super.call(this) || this;
dynamicProto(BaseCore, _this, function (_self, _base) {
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {
try {
_base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);
}
catch (e) {
_throwInternal(_self.logger, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
}
};
_self.track = function (item) {
var telemetryItem = item;
if (telemetryItem) {
var ext = telemetryItem.ext = telemetryItem.ext || {};
ext.sdk = ext.sdk || {};
ext.sdk.ver = FullVersionString;
}
_base.track(telemetryItem);
};
_self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {
return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || "InternalLog");
};
});
return _this;
}
// Removed Stub for BaseCore.prototype.initialize.
// Removed Stub for BaseCore.prototype.track.
// Removed Stub for BaseCore.prototype.pollInternalLogs.
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
BaseCore.__ieDyn=1;
return BaseCore;
}(InternalCore));
export { BaseCore };
//# sourceMappingURL=BaseCore.js.map
@@ -0,0 +1 @@
{"version":3,"file":"BaseCore.js.map","sources":["BaseCore.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\n/**\r\n* BaseCore.ts\r\n* Base Core is a subset of 1DS Web SDK Core. The purpose of Base Core is to generate a smaller bundle size while providing essential features of Core. Features that are not included in Base Core are:\r\n* 1. Internal logging\r\n* 2. Sending notifications on telemetry sent/discarded\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, dumpObj } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL } from \"./InternalConstants\";\r\nimport { FullVersionString } from \"./Utils\";\r\nimport { _DYN_INITIALIZE, _DYN_POLL_INTERNAL_LOGS } from \"./__DynamicConstants\";\r\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultConfig = objDeepFreeze({\r\n endpointUrl: STR_DEFAULT_ENDPOINT_URL\r\n});\r\nvar BaseCore = /** @class */ (function (_super) {\r\n __extends(BaseCore, _super);\r\n function BaseCore() {\r\n var _this = _super.call(this) || this;\r\n dynamicProto(BaseCore, _this, function (_self, _base) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n try {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self.logger, false).cfg, extensions, logger, notificationManager);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.logger, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"Initialization Failed: \" + dumpObj(e) + \"\\n - Note: Channels must be provided through config.channels only\");\r\n }\r\n };\r\n _self.track = function (item) {\r\n var telemetryItem = item;\r\n if (telemetryItem) {\r\n var ext = telemetryItem.ext = telemetryItem.ext || {};\r\n ext.sdk = ext.sdk || {};\r\n ext.sdk.ver = FullVersionString;\r\n }\r\n _base.track(telemetryItem);\r\n };\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {\r\n return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || \"InternalLog\");\r\n };\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Initialize the sdk.\r\n * @param config - The configuration to initialize the SDK.\r\n * @param extensions - An array of extensions that are to be used by the core.\r\n */\r\n BaseCore.prototype.initialize = function (config, extensions, logger, notificationManager) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n BaseCore.prototype.track = function (item) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Periodically check logger.queue for\r\n */\r\n BaseCore.prototype.pollInternalLogs = function (eventName) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return BaseCore;\r\n}(InternalCore));\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;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;;wDAiBM,CAAC;;;;;oBACa;AACpB;AACA;AACA"}
@@ -0,0 +1,7 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
export {};
//# sourceMappingURL=DataModels.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DataModels.js.map","sources":["DataModels.js"],"sourcesContent":["export {};\r\n//# sourceMappingURL=DataModels.js.map"],"names":[],"mappings":";;;;;AAAA;AACA"}
@@ -0,0 +1,92 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* Enums.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
* File containing the enums as constants.
*/
import { createEnumStyle } from "@microsoft/applicationinsights-core-js";
/**
* The ValueKind contains a set of values that specify value kind of the property.
* Either PII (Personal Identifiable Information) or customer content.
*/
export var ValueKind = ( /* @__PURE__ */createEnumStyle({
NotSet: 0 /* eValueKind.NotSet */,
Pii_DistinguishedName: 1 /* eValueKind.Pii_DistinguishedName */,
Pii_GenericData: 2 /* eValueKind.Pii_GenericData */,
Pii_IPV4Address: 3 /* eValueKind.Pii_IPV4Address */,
Pii_IPv6Address: 4 /* eValueKind.Pii_IPv6Address */,
Pii_MailSubject: 5 /* eValueKind.Pii_MailSubject */,
Pii_PhoneNumber: 6 /* eValueKind.Pii_PhoneNumber */,
Pii_QueryString: 7 /* eValueKind.Pii_QueryString */,
Pii_SipAddress: 8 /* eValueKind.Pii_SipAddress */,
Pii_SmtpAddress: 9 /* eValueKind.Pii_SmtpAddress */,
Pii_Identity: 10 /* eValueKind.Pii_Identity */,
Pii_Uri: 11 /* eValueKind.Pii_Uri */,
Pii_Fqdn: 12 /* eValueKind.Pii_Fqdn */,
Pii_IPV4AddressLegacy: 13 /* eValueKind.Pii_IPV4AddressLegacy */,
Pii_IPv6ScrubLastHextets: 14 /* eValueKind.Pii_IPv6ScrubLastHextets */,
Pii_DropValue: 15 /* eValueKind.Pii_DropValue */,
CustomerContent_GenericContent: 32 /* eValueKind.CustomerContent_GenericContent */
}));
/**
* The EventLatency contains a set of values that specify the latency with which an event is sent.
*/
export var EventLatency = ( /* @__PURE__ */createEnumStyle({
/**
* Normal latency.
*/
Normal: 1 /* EventLatencyValue.Normal */,
/**
* Cost deferred latency. At the moment this latency is treated as Normal latency.
*/
CostDeferred: 2 /* EventLatencyValue.CostDeferred */,
/**
* Real time latency.
*/
RealTime: 3 /* EventLatencyValue.RealTime */,
/**
* Bypass normal batching/timing and send as soon as possible, this will still send asynchronously.
* Added in v3.1.1
*/
Immediate: 4 /* EventLatencyValue.Immediate */
}));
/**
* Enum for property types.
*/
export var EventPropertyType = ( /* @__PURE__ */createEnumStyle({
Unspecified: 0 /* eEventPropertyType.Unspecified */,
String: 1 /* eEventPropertyType.String */,
Int32: 2 /* eEventPropertyType.Int32 */,
UInt32: 3 /* eEventPropertyType.UInt32 */,
Int64: 4 /* eEventPropertyType.Int64 */,
UInt64: 5 /* eEventPropertyType.UInt64 */,
Double: 6 /* eEventPropertyType.Double */,
Bool: 7 /* eEventPropertyType.Bool */,
Guid: 8 /* eEventPropertyType.Guid */,
DateTime: 9 /* eEventPropertyType.DateTime */
}));
/**
* The EventPersistence contains a set of values that specify the event's persistence.
*/
export var EventPersistence = ( /* @__PURE__ */createEnumStyle({
/**
* Normal persistence.
*/
Normal: 1 /* EventPersistenceValue.Normal */,
/**
* Critical persistence.
*/
Critical: 2 /* EventPersistenceValue.Critical */
}));
export var TraceLevel = ( /* @__PURE__ */createEnumStyle({
NONE: 0 /* eTraceLevel.NONE */,
ERROR: 1 /* eTraceLevel.ERROR */,
WARNING: 2 /* eTraceLevel.WARNING */,
INFORMATION: 3 /* eTraceLevel.INFORMATION */
}));
//# sourceMappingURL=Enums.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Enums.js.map","sources":["Enums.js"],"sourcesContent":["/**\r\n* Enums.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File containing the enums as constants.\r\n*/\r\nimport { createEnumStyle } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * The ValueKind contains a set of values that specify value kind of the property.\r\n * Either PII (Personal Identifiable Information) or customer content.\r\n */\r\nexport var ValueKind = ( /* @__PURE__ */createEnumStyle({\r\n NotSet: 0 /* eValueKind.NotSet */,\r\n Pii_DistinguishedName: 1 /* eValueKind.Pii_DistinguishedName */,\r\n Pii_GenericData: 2 /* eValueKind.Pii_GenericData */,\r\n Pii_IPV4Address: 3 /* eValueKind.Pii_IPV4Address */,\r\n Pii_IPv6Address: 4 /* eValueKind.Pii_IPv6Address */,\r\n Pii_MailSubject: 5 /* eValueKind.Pii_MailSubject */,\r\n Pii_PhoneNumber: 6 /* eValueKind.Pii_PhoneNumber */,\r\n Pii_QueryString: 7 /* eValueKind.Pii_QueryString */,\r\n Pii_SipAddress: 8 /* eValueKind.Pii_SipAddress */,\r\n Pii_SmtpAddress: 9 /* eValueKind.Pii_SmtpAddress */,\r\n Pii_Identity: 10 /* eValueKind.Pii_Identity */,\r\n Pii_Uri: 11 /* eValueKind.Pii_Uri */,\r\n Pii_Fqdn: 12 /* eValueKind.Pii_Fqdn */,\r\n Pii_IPV4AddressLegacy: 13 /* eValueKind.Pii_IPV4AddressLegacy */,\r\n Pii_IPv6ScrubLastHextets: 14 /* eValueKind.Pii_IPv6ScrubLastHextets */,\r\n Pii_DropValue: 15 /* eValueKind.Pii_DropValue */,\r\n CustomerContent_GenericContent: 32 /* eValueKind.CustomerContent_GenericContent */\r\n}));\r\n/**\r\n * The EventLatency contains a set of values that specify the latency with which an event is sent.\r\n */\r\nexport var EventLatency = ( /* @__PURE__ */createEnumStyle({\r\n /**\r\n * Normal latency.\r\n */\r\n Normal: 1 /* EventLatencyValue.Normal */,\r\n /**\r\n * Cost deferred latency. At the moment this latency is treated as Normal latency.\r\n */\r\n CostDeferred: 2 /* EventLatencyValue.CostDeferred */,\r\n /**\r\n * Real time latency.\r\n */\r\n RealTime: 3 /* EventLatencyValue.RealTime */,\r\n /**\r\n * Bypass normal batching/timing and send as soon as possible, this will still send asynchronously.\r\n * Added in v3.1.1\r\n */\r\n Immediate: 4 /* EventLatencyValue.Immediate */\r\n}));\r\n/**\r\n * Enum for property types.\r\n */\r\nexport var EventPropertyType = ( /* @__PURE__ */createEnumStyle({\r\n Unspecified: 0 /* eEventPropertyType.Unspecified */,\r\n String: 1 /* eEventPropertyType.String */,\r\n Int32: 2 /* eEventPropertyType.Int32 */,\r\n UInt32: 3 /* eEventPropertyType.UInt32 */,\r\n Int64: 4 /* eEventPropertyType.Int64 */,\r\n UInt64: 5 /* eEventPropertyType.UInt64 */,\r\n Double: 6 /* eEventPropertyType.Double */,\r\n Bool: 7 /* eEventPropertyType.Bool */,\r\n Guid: 8 /* eEventPropertyType.Guid */,\r\n DateTime: 9 /* eEventPropertyType.DateTime */\r\n}));\r\n/**\r\n * The EventPersistence contains a set of values that specify the event's persistence.\r\n */\r\nexport var EventPersistence = ( /* @__PURE__ */createEnumStyle({\r\n /**\r\n * Normal persistence.\r\n */\r\n Normal: 1 /* EventPersistenceValue.Normal */,\r\n /**\r\n * Critical persistence.\r\n */\r\n Critical: 2 /* EventPersistenceValue.Critical */\r\n}));\r\nexport var TraceLevel = ( /* @__PURE__ */createEnumStyle({\r\n NONE: 0 /* eTraceLevel.NONE */,\r\n ERROR: 1 /* eTraceLevel.ERROR */,\r\n WARNING: 2 /* eTraceLevel.WARNING */,\r\n INFORMATION: 3 /* eTraceLevel.INFORMATION */\r\n}));\r\n//# sourceMappingURL=Enums.js.map"],"names":[],"mappings":";;;;;AAAA;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,29 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* Index.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
* File to export public classes, interfaces and enums.
*/
import { AppInsightsCore } from "./AppInsightsCore";
import { EventLatency, EventPersistence, EventPropertyType, TraceLevel, ValueKind } from "./Enums";
import { ValueSanitizer } from "./ValueSanitizer";
export { ValueKind, EventLatency, EventPersistence, TraceLevel, AppInsightsCore, EventPropertyType, ValueSanitizer };
export { NotificationManager, BaseTelemetryPlugin, ProcessTelemetryContext, MinChannelPriorty, EventsDiscardedReason, DiagnosticLogger, LoggingSeverity, PerfEvent, PerfManager, doPerf, AppInsightsCore as InternalAppInsightsCore, _InternalLogMessage, ActiveStatus, createEnumStyle, _throwInternal, _warnToConsole, _logInternalMessage,
// The HelperFuncs functions
isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, attachEvent, detachEvent, normalizeJsName, objForEachKey, strStartsWith, strEndsWith, strContains, strTrim, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, optimizeObject, addEventHandler, newGuid, perfNow, newId, generateW3CId, safeGetLogger, objFreeze, objSeal, fieldRedaction,
// EnvUtils
getGlobal, getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, strUndefined, strObject, strPrototype, strFunction, setEnableEnvMocks, strUndefined as Undefined,
// Random
randomValue, random32, uaDisallowsSameSiteNone as disallowsSameSiteNone, areCookiesSupported, areCookiesSupported as cookieAvailable, createCookieMgr, safeGetCookieMgr,
// Aliases
toISOString as getISOString, isBeaconsSupported, isFetchSupported, isXhrSupported, useXDomainRequest, addPageHideEventListener, addPageShowEventListener, addEventListeners, addPageUnloadEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, createUniqueNamespace, __getRegisteredEvents, createProcessTelemetryContext, createUnloadHandlerContainer, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent, createDynamicConfig, onConfigChange, getDynamicConfigHandler, blockDynamicConversion, forceDynamicConversion, SenderPostManager, getResponseText, formatErrorMessageXdr, formatErrorMessageXhr, prependTransports, parseResponse, convertAllHeadersToMap, _getAllResponseHeaders, _appendHeader, isFeatureEnabled,
// Test Hooks
_testHookMaxUnloadHooksCb } from "@microsoft/applicationinsights-core-js";
export { isValueAssigned, isLatency, isUint8ArrayAvailable, getTenantId, sanitizeProperty, Version, FullVersionString, getCommonSchemaMetaData, getCookieValue, extend, createGuid, isDocumentObjectAvailable, isWindowObjectAvailable, setProcessTelemetryTimings, getTime, isArrayValid, isValueKind, getFieldValueType, isChromium, // Replace with ai-core version once published in ai-core
openXhr, isGreaterThanZero } from "./Utils";
//# sourceMappingURL=Index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Index.js.map","sources":["Index.js"],"sourcesContent":["/**\r\n* Index.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File to export public classes, interfaces and enums.\r\n*/\r\nimport { AppInsightsCore } from \"./AppInsightsCore\";\r\nimport { EventLatency, EventPersistence, EventPropertyType, TraceLevel, ValueKind } from \"./Enums\";\r\nimport { ValueSanitizer } from \"./ValueSanitizer\";\r\nexport { ValueKind, EventLatency, EventPersistence, TraceLevel, AppInsightsCore, EventPropertyType, ValueSanitizer };\r\nexport { NotificationManager, BaseTelemetryPlugin, ProcessTelemetryContext, MinChannelPriorty, EventsDiscardedReason, DiagnosticLogger, LoggingSeverity, PerfEvent, PerfManager, doPerf, AppInsightsCore as InternalAppInsightsCore, _InternalLogMessage, ActiveStatus, createEnumStyle, _throwInternal, _warnToConsole, _logInternalMessage, \r\n// The HelperFuncs functions\r\nisTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, attachEvent, detachEvent, normalizeJsName, objForEachKey, strStartsWith, strEndsWith, strContains, strTrim, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, optimizeObject, addEventHandler, newGuid, perfNow, newId, generateW3CId, safeGetLogger, objFreeze, objSeal, fieldRedaction, \r\n// EnvUtils\r\ngetGlobal, getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, strUndefined, strObject, strPrototype, strFunction, setEnableEnvMocks, strUndefined as Undefined, \r\n// Random\r\nrandomValue, random32, uaDisallowsSameSiteNone as disallowsSameSiteNone, areCookiesSupported, areCookiesSupported as cookieAvailable, createCookieMgr, safeGetCookieMgr, \r\n// Aliases\r\ntoISOString as getISOString, isBeaconsSupported, isFetchSupported, isXhrSupported, useXDomainRequest, addPageHideEventListener, addPageShowEventListener, addEventListeners, addPageUnloadEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, createUniqueNamespace, __getRegisteredEvents, createProcessTelemetryContext, createUnloadHandlerContainer, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent, createDynamicConfig, onConfigChange, getDynamicConfigHandler, blockDynamicConversion, forceDynamicConversion, SenderPostManager, getResponseText, formatErrorMessageXdr, formatErrorMessageXhr, prependTransports, parseResponse, convertAllHeadersToMap, _getAllResponseHeaders, _appendHeader, isFeatureEnabled, \r\n// Test Hooks\r\n_testHookMaxUnloadHooksCb } from \"@microsoft/applicationinsights-core-js\";\r\nexport { isValueAssigned, isLatency, isUint8ArrayAvailable, getTenantId, sanitizeProperty, Version, FullVersionString, getCommonSchemaMetaData, getCookieValue, extend, createGuid, isDocumentObjectAvailable, isWindowObjectAvailable, setProcessTelemetryTimings, getTime, isArrayValid, isValueKind, getFieldValueType, isChromium, // Replace with ai-core version once published in ai-core\r\nopenXhr, isGreaterThanZero } from \"./Utils\";\r\n//# sourceMappingURL=Index.js.map"],"names":[],"mappings":";;;;;AAAA;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,17 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
// Licensed under the MIT License.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
// as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
export var STR_EMPTY = "";
export var STR_DEFAULT_ENDPOINT_URL = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
export var STR_VERSION = "version";
export var STR_PROPERTIES = "properties";
//# sourceMappingURL=InternalConstants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"InternalConstants.js.map","sources":["InternalConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_DEFAULT_ENDPOINT_URL = \"https://browser.events.data.microsoft.com/OneCollector/1.0/\";\r\nexport var STR_VERSION = \"version\";\r\nexport var STR_PROPERTIES = \"properties\";\r\n//# sourceMappingURL=InternalConstants.js.map"],"names":[],"mappings":";;;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,397 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
var _a;
/**
* Utils.ts
* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)
* @copyright Microsoft 2018
* File containing utility functions.
*/
import { arrForEach, getGlobalInst, getNavigator, hasDocument, hasWindow, isArray, isBoolean, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isUndefined, newGuid, objForEachKey, perfNow } from "@microsoft/applicationinsights-core-js";
import { ObjProto, strShimObject } from "@microsoft/applicationinsights-shims";
import { strIndexOf, strLeft } from "@nevware21/ts-utils";
import { STR_EMPTY } from "./InternalConstants";
import { _DYN_INDEX_OF, _DYN_LENGTH, _DYN_PROCESS_TELEMETRY_ST0, _DYN_TIMINGS, _DYN_VALUE } from "./__DynamicConstants";
export var Version = '4.3.11';
export var FullVersionString = "1DS-Web-JS-" + Version;
var ObjHasOwnProperty = ObjProto.hasOwnProperty;
// Defining here so we don't need to take (import) the ApplicationInsights Common module
var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
var strWithCredentials = "withCredentials";
var strTimeout = "timeout";
// If value is array just get the type for the first element
var _fieldTypeEventPropMap = (_a = {},
_a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,
_a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,
_a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,
_a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,
_a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,
_a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,
_a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,
_a);
/**
* @ignore
*/
// let _uaDisallowsSameSiteNone = null;
var uInt8ArraySupported = null;
// var _areCookiesAvailable: boolean | undefined;
/**
* Checks if document object is available
*/
export var isDocumentObjectAvailable = hasDocument();
/**
* Checks if window object is available
*/
export var isWindowObjectAvailable = hasWindow();
/**
* Checks if value is assigned to the given param.
* @param value - The token from which the tenant id is to be extracted.
* @returns True/false denoting if value is assigned to the param.
*/
export function isValueAssigned(value) {
/// <summary> takes a value and checks for undefined, null and empty string </summary>
/// <param type="any"> value to be tested </param>
/// <returns> true if value is null undefined or emptyString </returns>
return !(value === STR_EMPTY || isNullOrUndefined(value));
}
/**
* Gets the tenant id from the tenant token.
* @param apiKey - The token from which the tenant id is to be extracted.
* @returns The tenant id.
*/
export function getTenantId(apiKey) {
if (apiKey) {
var indexTenantId = strIndexOf(apiKey, "-");
if (indexTenantId > -1) {
return strLeft(apiKey, indexTenantId);
}
}
return STR_EMPTY;
}
/**
* Checks if Uint8Array are available in the current environment. Safari and Firefox along with
* ReactNative are known to not support Uint8Array properly.
* @returns True if available, false otherwise.
*/
export function isUint8ArrayAvailable() {
if (uInt8ArraySupported === null) {
uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();
}
return uInt8ArraySupported;
}
/**
* Checks if the value is a valid EventLatency.
* @param value - The value that needs to be checked.
* @returns True if the value is in AWTEventLatency, false otherwise.
*/
export function isLatency(value) {
if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {
return true;
}
return false;
}
/**
* Sanitizes the Property. It checks the that the property name and value are valid. It also
* checks/populates the correct type and pii of the property value.
* @param name - property name - The property name.
* @param property - The property value or an IEventProperty containing value,
* type ,pii and customer content.
* @returns IEventProperty containing valid name, value, pii and type or null if invalid.
*/
export function sanitizeProperty(name, property, stringifyObjects) {
// Check that property is valid
if ((!property && !isValueAssigned(property)) || typeof name !== "string") {
return null;
}
// Perf optimization -- only need to get the type once not multiple times
var propType = typeof property;
// If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.
if (propType === "string" || propType === "number" || propType === "boolean" || isArray(property)) {
property = { value: property };
}
else if (propType === "object" && !ObjHasOwnProperty.call(property, "value")) {
property = { value: stringifyObjects ? JSON.stringify(property) : property };
}
else if (isNullOrUndefined(property[_DYN_VALUE /* @min:%2evalue */])
|| property[_DYN_VALUE /* @min:%2evalue */] === STR_EMPTY || (!isString(property[_DYN_VALUE /* @min:%2evalue */])
&& !isNumber(property[_DYN_VALUE /* @min:%2evalue */]) && !isBoolean(property[_DYN_VALUE /* @min:%2evalue */])
&& !isArray(property[_DYN_VALUE /* @min:%2evalue */]))) {
// Since property is IEventProperty, we need to validate its value
return null;
}
// We need to check that if the property value is an array, it is valid
if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) &&
!isArrayValid(property[_DYN_VALUE /* @min:%2evalue */])) {
return null;
}
// If either pii or cc is set convert value to string (since only string pii/cc is allowed).
// If the value is a complex type like an array that can't be converted to string we will drop
// the property.
if (!isNullOrUndefined(property.kind)) {
if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property.kind)) {
return null;
}
property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();
}
return property;
}
export function getCommonSchemaMetaData(value, kind, type) {
var encodedTypeValue = -1;
if (!isUndefined(value)) {
if (kind > 0) {
if (kind === 32 /* eValueKind.CustomerContent_GenericContent */) {
// encode customer content. Value can only be string. bit 13-16 are for cc
encodedTypeValue = (1 << 13);
}
else if (kind <= 13) {
// encode PII. Value can only be string. bits 5-12 are for Pii
encodedTypeValue = (kind << 5);
}
}
// isDataType checks that the "type" is a number so we don't need to check for undefined
if (isDataType(type)) {
// Data Type is provided and valid, so use that
if (encodedTypeValue === -1) {
// Don't return -1
encodedTypeValue = 0;
}
encodedTypeValue |= type;
}
else {
var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;
if (encodedTypeValue !== -1 && propType !== -1) {
// pii exists so we must return correct type
encodedTypeValue |= propType;
}
else if (propType === 6 /* eEventPropertyType.Double */) {
encodedTypeValue = propType;
}
}
}
return encodedTypeValue;
}
/**
* Helper to get and decode the cookie value using decodeURIComponent, this is for historical
* backward compatibility where the document.cookie value was decoded before parsing.
* @param cookieMgr - The cookie manager to use
* @param name - The name of the cookie to get
* @param decode - A flag to indicate whether the cookie value should be decoded
* @returns The decoded cookie value (if available) otherwise an empty string.
*/
export function getCookieValue(cookieMgr, name, decode) {
if (decode === void 0) { decode = true; }
var cookieValue;
if (cookieMgr) {
cookieValue = cookieMgr.get(name);
if (decode && cookieValue && decodeURIComponent) {
cookieValue = decodeURIComponent(cookieValue);
}
}
return cookieValue || STR_EMPTY;
}
/**
* Create a new guid.
* @param style - The style of guid to generated, defaults to Digits
* Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000
* Braces - 32 digits separated by hyphens, enclosed in braces: \{00000000-0000-0000-0000-000000000000\}
* Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)
* Numeric - 32 digits: 00000000000000000000000000000000
*/
export function createGuid(style) {
if (style === void 0) { style = "D" /* GuidStyle.Digits */; }
var theGuid = newGuid();
if (style === "B" /* GuidStyle.Braces */) {
theGuid = "{" + theGuid + "}";
}
else if (style === "P" /* GuidStyle.Parentheses */) {
theGuid = "(" + theGuid + ")";
}
else if (style === "N" /* GuidStyle.Numeric */) {
theGuid = theGuid.replace(/-/g, STR_EMPTY);
}
return theGuid;
}
/**
* Pass in the objects to merge as arguments.
* @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
* @param obj2 - object to merge.
* @param obj3 - object to merge.
* @param obj4 - object to merge.
* @param obj5 - object to merge.
* @returns The extended object.
*/
export function extend(obj, obj2, obj3, obj4, obj5) {
// Variables
var extended = {};
var deep = false;
var i = 0;
var length = arguments[_DYN_LENGTH /* @min:%2elength */];
var theArgs = arguments;
// Check if a deep merge
if (isBoolean(theArgs[0])) {
deep = theArgs[0];
i++;
}
// Loop through each object and conduct a merge
for (; i < length; i++) {
var obj = theArgs[i];
objForEachKey(obj, function (prop, value) {
// If deep merge and property is an object, merge properties
if (deep && value && isObject(value)) {
if (isArray(value)) {
extended[prop] = extended[prop] || [];
arrForEach(value, function (arrayValue, arrayIndex) {
if (arrayValue && isObject(arrayValue)) {
extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);
}
else {
extended[prop][arrayIndex] = arrayValue;
}
});
}
else {
extended[prop] = extend(true, extended[prop], value);
}
}
else {
extended[prop] = value;
}
});
}
return extended;
}
export var getTime = perfNow;
export function isValueKind(value) {
// Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization
if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {
return true;
}
return false;
}
function isDataType(value) {
// Remark: 0 returns false, but it doesn't affect encoding anyways
// Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization
if (value >= 0 && value <= 9) {
return true;
}
return false;
}
function isSafariOrFirefox() {
var nav = getNavigator();
// If non-browser navigator will be undefined
if (!isUndefined(nav) && nav.userAgent) {
var ua = nav.userAgent.toLowerCase();
if ((ua[_DYN_INDEX_OF /* @min:%2eindexOf */]("safari") >= 0 || ua[_DYN_INDEX_OF /* @min:%2eindexOf */]("firefox") >= 0) && ua[_DYN_INDEX_OF /* @min:%2eindexOf */]("chrome") < 0) {
return true;
}
}
return false;
}
export function isArrayValid(value) {
return value[_DYN_LENGTH /* @min:%2elength */] > 0;
}
export function setProcessTelemetryTimings(event, identifier) {
var evt = event;
evt[_DYN_TIMINGS /* @min:%2etimings */] = evt[_DYN_TIMINGS /* @min:%2etimings */] || {};
evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] = evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] || {};
evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */][identifier] = getTime();
}
/**
* Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value
* @param value - The value to determine the type
*/
export function getFieldValueType(value) {
var theType = 0 /* FieldValueSanitizerType.NotSet */;
if (value !== null && value !== undefined) {
var objType = typeof value;
if (objType === "string") {
theType = 1 /* FieldValueSanitizerType.String */;
}
else if (objType === "number") {
theType = 2 /* FieldValueSanitizerType.Number */;
}
else if (objType === "boolean") {
theType = 3 /* FieldValueSanitizerType.Boolean */;
}
else if (objType === strShimObject) {
theType = 4 /* FieldValueSanitizerType.Object */;
if (isArray(value)) {
theType = 4096 /* FieldValueSanitizerType.Array */;
if (value[_DYN_LENGTH /* @min:%2elength */] > 0) {
// Empty arrays are not supported and are considered to be the same as null
theType |= getFieldValueType(value[0]);
}
}
else if (ObjHasOwnProperty.call(value, "value")) {
// Looks like an IEventProperty
theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value[_DYN_VALUE /* @min:%2evalue */]);
}
}
}
return theType;
}
/**
* Helper to identify whether we are running in a chromium based browser environment
*/
export function isChromium() {
return !!getGlobalInst("chrome");
}
/**
* Create and open an XMLHttpRequest object
* @param method - The request method
* @param urlString - The url
* @param withCredentials - Option flag indicating that credentials should be sent
* @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)
* @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)
* @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request
* @returns A new opened XHR request
*/
export function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {
if (disabled === void 0) { disabled = false; }
if (isSync === void 0) { isSync = false; }
function _wrapSetXhrProp(xhr, prop, value) {
try {
xhr[prop] = value;
}
catch (e) {
// - Wrapping as depending on the environment setting the property may fail (non-terminally)
}
}
var xhr = new XMLHttpRequest();
if (disabled) {
// Tag the instance so it's not tracked (trackDependency)
// If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would
// cause the request to fail and we no telemetry would be sent
_wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
}
if (withCredentials) {
// Some libraries require that the withCredentials flag is set "before" open and
// - Wrapping as IE 10 has started throwing when setting before open
_wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
}
xhr.open(method, urlString, !isSync);
if (withCredentials) {
// withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)
// And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing
_wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
}
// Only set the timeout for asynchronous requests as
// "Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.""
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout
if (!isSync && timeout) {
_wrapSetXhrProp(xhr, strTimeout, timeout);
}
return xhr;
}
/**
* Check to see if the value is \> 0
* @param value - The value to check
* @returns true if \> 0 otherwise false
*/
export function isGreaterThanZero(value) {
return value > 0;
}
//# sourceMappingURL=Utils.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,262 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
import { isNullOrUndefined, isString, objForEachKey } from "@microsoft/applicationinsights-core-js";
import { arrForEach, arrIncludes, arrIndexOf, getLength } from "@nevware21/ts-utils";
import { STR_EMPTY } from "./InternalConstants";
import { getFieldValueType, isValueAssigned, isValueKind } from "./Utils";
import { _DYN_CAN_HANDLE, _DYN_HANDLE_FIELD, _DYN_LENGTH, _DYN_RM_FIELD_SANITIZER, _DYN_RM_SANITIZER, _DYN_VALUE } from "./__DynamicConstants";
function _isSpecialName(name) {
return (name == "__proto__" || name == "constructor" || name == "prototype");
}
var ValueSanitizer = /** @class */ (function () {
function ValueSanitizer(fieldSanitizerProvider) {
var _self = this;
// To aid with performance this is a lookup map to check if the field value sanitizer supports this field
var _sanitizerMap = {};
var _sanitizers = [];
var _fieldSanitizers = [];
if (fieldSanitizerProvider) {
_fieldSanitizers.push(fieldSanitizerProvider);
}
function _getFieldSanitizer(path, name) {
var result;
var fieldLookup = _sanitizerMap[path];
if (fieldLookup) {
result = fieldLookup[name];
}
if (!result && result !== null) {
// Null is a valid result indicating that the value sanitizer does not support this field
if (isString(path) && isString(name)) {
if (_fieldSanitizers[_DYN_LENGTH /* @min:%2elength */] > 0) {
for (var lp = 0; lp < _fieldSanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
if (_fieldSanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
result = {
canHandle: true,
fieldHandler: _fieldSanitizers[lp]
};
break;
}
}
}
else if (_sanitizers[_DYN_LENGTH /* @min:%2elength */] === 0) {
// Special use-case where there is no sanitizer to pass on to, so just resolving the field
// and returning the resulting value (same as sanitizeProperty())
result = {
canHandle: true
};
}
}
// We still don't have a handler so lets lookup the providers
if (!result && result !== null) {
// Setting the result to null -- which means we and any contained sanitizers can't handle this field
result = null;
for (var lp = 0; lp < _sanitizers[_DYN_LENGTH /* @min:%2elength */]; lp++) {
if (_sanitizers[lp][_DYN_HANDLE_FIELD /* @min:%2ehandleField */](path, name)) {
result = {
canHandle: true,
handler: _sanitizers[lp],
fieldHandler: null
};
break;
}
}
}
if (!fieldLookup) {
// Handle edge case to avoid prototype pollution
if (_isSpecialName(path)) {
return null;
}
fieldLookup = _sanitizerMap[path] = {};
}
// Handle edge case to avoid prototype pollution
if (_isSpecialName(name)) {
return null;
}
fieldLookup[name] = result;
}
return result;
}
_self.clearCache = function () {
_sanitizerMap = {};
};
_self.addSanitizer = function (newSanitizer) {
if (newSanitizer) {
if (!arrIncludes(_sanitizers, newSanitizer)) {
_sanitizers.push(newSanitizer);
}
// Invalidate any previously mapped fields
_sanitizerMap = {};
}
};
_self.addFieldSanitizer = function (fieldSanitizer) {
if (fieldSanitizer) {
if (!arrIncludes(_fieldSanitizers, fieldSanitizer)) {
_fieldSanitizers.push(fieldSanitizer);
}
// Invalidate any previously mapped fields
_sanitizerMap = {};
}
};
_self[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] = function (theSanitizer) {
if (theSanitizer) {
var idx = arrIndexOf(_sanitizers, theSanitizer);
if (idx !== -1) {
_sanitizers.splice(idx, 1);
// Invalidate any previously mapped fields
_sanitizerMap = {};
}
// Try and remove the sanitizer from any chained sanitizer as well
arrForEach(_sanitizers, function (sanitizer) {
sanitizer && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */] && sanitizer[_DYN_RM_SANITIZER /* @min:%2ermSanitizer */](theSanitizer);
});
}
};
_self[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] = function (theFieldSanitizer) {
if (theFieldSanitizer) {
var idx = arrIndexOf(_fieldSanitizers, theFieldSanitizer);
if (idx !== -1) {
_fieldSanitizers.splice(idx, 1);
// Invalidate any previously mapped fields
_sanitizerMap = {};
}
// Try and remove the field sanitizer from any chained sanitizer as well
arrForEach(_sanitizers, function (sanitizer) {
sanitizer && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */] && sanitizer[_DYN_RM_FIELD_SANITIZER /* @min:%2ermFieldSanitizer */](theFieldSanitizer);
});
}
};
_self.isEmpty = function () {
return (getLength(_sanitizers) + getLength(_fieldSanitizers)) === 0;
};
_self[_DYN_HANDLE_FIELD /* @min:%2ehandleField */] = function (path, name) {
var mapValue = _getFieldSanitizer(path, name);
return mapValue ? mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */] : false;
};
_self[_DYN_VALUE /* @min:%2evalue */] = function (path, name, value, stringifyObjects) {
var mapValue = _getFieldSanitizer(path, name);
if (mapValue && mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
if (!mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
return null;
}
if (mapValue.handler) {
// This value sanitizer can't handle this field so pass it only the next one
return mapValue.handler[_DYN_VALUE /* @min:%2evalue */](path, name, value, stringifyObjects);
}
// Check that property is valid
if (!isString(name) || isNullOrUndefined(value) || value === STR_EMPTY) {
return null;
}
var property = null;
var fieldType = getFieldValueType(value);
if ((fieldType & 8192 /* FieldValueSanitizerType.EventProperty */) === 8192 /* FieldValueSanitizerType.EventProperty */) {
var subType = fieldType & ~8192 /* FieldValueSanitizerType.EventProperty */;
property = value;
if (!isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */]) ||
(subType !== 1 /* FieldValueSanitizerType.String */ &&
subType !== 2 /* FieldValueSanitizerType.Number */ &&
subType !== 3 /* FieldValueSanitizerType.Boolean */ &&
(subType & 4096 /* FieldValueSanitizerType.Array */) !== 4096 /* FieldValueSanitizerType.Array */)) {
// Not a supported IEventProperty type to be able to sanitize
return null;
}
}
else if (fieldType === 1 /* FieldValueSanitizerType.String */ ||
fieldType === 2 /* FieldValueSanitizerType.Number */ ||
fieldType === 3 /* FieldValueSanitizerType.Boolean */ ||
(fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */) {
// If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.
property = _convertToProperty(path, name, value);
}
else if (fieldType === 4 /* FieldValueSanitizerType.Object */) {
property = _convertToProperty(path, name, !!stringifyObjects ? JSON.stringify(value) : value);
}
if (property) {
return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);
}
}
return null;
};
_self.property = function (path, name, property, stringifyObjects) {
var mapValue = _getFieldSanitizer(path, name);
if (!mapValue || !mapValue[_DYN_CAN_HANDLE /* @min:%2ecanHandle */]) {
return null;
}
// Check that property is valid
if (!isString(name) || isNullOrUndefined(property) || !isValueAssigned(property[_DYN_VALUE /* @min:%2evalue */])) {
return null;
}
var fieldType = getFieldValueType(property[_DYN_VALUE /* @min:%2evalue */]);
if (fieldType === 0 /* FieldValueSanitizerType.NotSet */) {
// Not a supported field that we can sanitize or serialize
return null;
}
return _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects);
};
function _handleProperty(mapValue, path, name, fieldType, property, stringifyObjects) {
if (mapValue.handler) {
// This value sanitizer can't handle this field so pass it only the next one
return mapValue.handler.property(path, name, property, stringifyObjects);
}
// If either pii or cc is set convert value to string (since only string pii/cc is allowed).
// If the value is a complex type like an array that can't be converted to string we will drop
// the property.
if (!isNullOrUndefined(property.kind)) {
if ((fieldType & 4096 /* FieldValueSanitizerType.Array */) === 4096 /* FieldValueSanitizerType.Array */ || !isValueKind(property.kind)) {
return null;
}
// Convert the value to a string and assign back to the original value
property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();
}
return _callFieldSanitizer(mapValue.fieldHandler, path, name, fieldType, property);
}
function _convertToProperty(path, name, value) {
if (isValueAssigned(value)) {
return { value: value };
}
return null;
}
function _callFieldSanitizer(fieldProvider, path, name, theType, property) {
if (property && fieldProvider) {
var sanitizer = fieldProvider.getSanitizer(path, name, theType, property.kind, property.propertyType);
if (sanitizer) {
// This is where we the field will call the handler to "scrub" the value. This the primary hook for the ClientHashing Plugin to
// be able to apply the hashFunc() / Sha256 conversion of the properties value
if (theType === 4 /* FieldValueSanitizerType.Object */) {
// Special case of an embedded object (ext.metadata, data.properties)
var newValue_1 = {};
var propValue = property[_DYN_VALUE /* @min:%2evalue */];
objForEachKey(propValue, function (propKey, theValue) {
var newPath = path + "." + name;
if (isValueAssigned(theValue)) {
var newProp = _convertToProperty(newPath, propKey, theValue);
newProp = _callFieldSanitizer(fieldProvider, newPath, propKey, getFieldValueType(theValue), newProp);
if (newProp) {
newValue_1[propKey] = newProp[_DYN_VALUE /* @min:%2evalue */];
}
}
});
property[_DYN_VALUE /* @min:%2evalue */] = newValue_1;
}
else {
var details = {
path: path,
name: name,
type: theType,
prop: property,
sanitizer: _self
};
property = sanitizer.call(_self, details);
}
}
}
return property;
}
}
ValueSanitizer.getFieldType = getFieldValueType;
return ValueSanitizer;
}());
export { ValueSanitizer };
//# sourceMappingURL=ValueSanitizer.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
/*
* 1DS JS SDK Core, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
// Licensed under the MIT License.
// @skip-file-minify
// ##############################################################
// AUTO GENERATED FILE: This file is Auto Generated during build.
// ##############################################################
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
export var _DYN_INITIALIZE = "initialize"; // Count: 4
export var _DYN_INDEX_OF = "indexOf"; // Count: 4
export var _DYN_TIMINGS = "timings"; // Count: 4
export var _DYN_POLL_INTERNAL_LOGS = "pollInternalLogs"; // Count: 4
export var _DYN_VALUE = "value"; // Count: 20
export var _DYN_LENGTH = "length"; // Count: 7
export var _DYN_PROCESS_TELEMETRY_ST0 = "processTelemetryStart"; // Count: 3
export var _DYN_HANDLE_FIELD = "handleField"; // Count: 3
export var _DYN_RM_SANITIZER = "rmSanitizer"; // Count: 3
export var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer"; // Count: 3
export var _DYN_CAN_HANDLE = "canHandle"; // Count: 4
//# sourceMappingURL=__DynamicConstants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_INDEX_OF = \"indexOf\"; // Count: 4\r\nexport var _DYN_TIMINGS = \"timings\"; // Count: 4\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 4\r\nexport var _DYN_VALUE = \"value\"; // Count: 20\r\nexport var _DYN_LENGTH = \"length\"; // Count: 7\r\nexport var _DYN_PROCESS_TELEMETRY_ST0 = \"processTelemetryStart\"; // Count: 3\r\nexport var _DYN_HANDLE_FIELD = \"handleField\"; // Count: 3\r\nexport var _DYN_RM_SANITIZER = \"rmSanitizer\"; // Count: 3\r\nexport var _DYN_RM_FIELD_SANITIZER = \"rmFieldSanitizer\"; // Count: 3\r\nexport var _DYN_CAN_HANDLE = \"canHandle\"; // Count: 4\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;;AAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+69
View File
@@ -0,0 +1,69 @@
{
"name": "@microsoft/1ds-core-js",
"version": "4.3.11",
"description": "Microsoft Application Insights JavaScript SDK - 1ds-core-js",
"author": "Microsoft Application Insights Team",
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
"license": "MIT",
"sideEffects": false,
"scripts": {
"clean": "git clean -xdf",
"build": "npm run build:esm && npm run build:browser && npm run dtsgen && npm run sri",
"build:esm": "grunt 1dsCoreBuild",
"build:browser": "npx rollup -c rollup.config.js --bundleConfigAsCjs",
"rebuild": "npm run build",
"ai-min": "grunt 1dsCore-min",
"ai-restore": "grunt 1dsCore-restore",
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"1DS JS SDK Core\" -oneDs",
"test": "grunt 1dsCoreTest",
"mintest": "grunt 1dsCoreMinTest",
"perftest": "",
"publishPackage": "npm publish",
"sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
"npm-pack": "npm pack",
"api-docs": "typedoc"
},
"repository": {
"type": "git",
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/shared/1ds-core-js"
},
"main": "dist/es5/ms.core.js",
"module": "dist-es5/Index.js",
"types": "types/1ds-core-js.d.ts",
"keywords": [
"1DS",
"Js",
"SDK"
],
"dependencies": {
"@microsoft/applicationinsights-shims": "3.0.1",
"@microsoft/applicationinsights-core-js": "3.3.11",
"@microsoft/dynamicproto-js": "^2.0.3",
"@nevware21/ts-utils": ">= 0.11.8 < 2.x",
"@nevware21/ts-async": ">= 0.5.4 < 2.x"
},
"devDependencies": {
"@types/qunit": "^2.19.3",
"@types/sinon": "4.3.3",
"@microsoft/ai-test-framework": "0.0.1",
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
"@microsoft/applicationinsights-rollup-es5": "1.0.2",
"@microsoft/api-extractor": "^7.40.0",
"@nevware21/ts-async": ">= 0.5.4 < 2.x",
"grunt": "^1.5.3",
"grunt-cli": "^1.4.3",
"globby": "^11.0.0",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.2",
"rollup": "^3.20.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"typedoc": "^0.26.6",
"typescript": "^4.9.3",
"tslib": "^2.0.0",
"qunit": "^2.11.2",
"sinon": "^7.3.1",
"pako": "^2.0.3"
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"sourceMap": true,
"inlineSources": true,
"module": "es6",
"moduleResolution": "Node",
"target": "es5",
"alwaysStrict": true,
"strictNullChecks": false,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"noEmitHelpers": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationDir": "build/types",
"removeComments": false,
"outDir": "dist-es5/",
"rootDir": "./src"
},
"include": [
"./src/**/*.ts"
],
"exclude": [
"node_modules/"
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
@@ -0,0 +1,14 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+17
View File
@@ -0,0 +1,17 @@
NOTICES AND INFORMATION
Do Not Translate or Localize
This software incorporates material from third parties. Microsoft makes certain
open source code available at https://3rdpartysource.microsoft.com, or you may
send a check or money order for US $5.00, including the product name, the open
source component name, and version number, to:
Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA
Notwithstanding any other terms, you may reverse engineer this software to the
extent required to debug changes to any libraries licensed under the GNU Lesser
General Public License.
+3
View File
@@ -0,0 +1,3 @@
# Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsofts privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
+355
View File
@@ -0,0 +1,355 @@
# Microsoft 1DS Web SDK Post Plugin
## Description
1DS Web SDK Post Channel main functionality is to send data to OneCollector using POST, currently supporting XMLHttpRequest, fetch API and XDomainRequest.
## npm
Packages available [here](https://www.npmjs.com/package/@microsoft/1ds-post-js).
## Basic Usage
### Setup
```js
import { AppInsightsCore, IExtendedConfiguration } from '@microsoft/1ds-core-js';
import { PostChannel, IChannelConfiguration } from '@microsoft/1ds-post-js';
```
```js
var appInsightsCore: AppInsightsCore = new AppInsightsCore();
var postChannel: PostChannel = new PostChannel();
var coreConfig: IExtendedConfiguration = {
instrumentationKey: "YOUR_TENANT_KEY",
extensions: [
postChannel
],
extensionConfig: {}
};
var postChannelConfig: IChannelConfiguration = {
eventsLimitInMem: 5000
};
coreConfig.extensionConfig[postChannel.identifier] = postChannelConfig;
//Initialize SDK
appInsightsCore.initialize(coreConfig, []);
```
## Configuration
### [IChannelConfiguration](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html)
| Config | Description | Type
|----------------|--------------|----
| [eventsLimitInMem](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#eventsLimitInMem) | The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.|number
| [immediateEventLimit](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#immediateEventLimit) | [Optional] Sets the maximum number of immediate latency events that will be cached in memory before the SDK starts to drop other immediate events only, does not drop normal and real time latency events as immediate events have their own internal queue. Under normal situations immediate events are scheduled to be sent in the next Javascript execution cycle, so the typically number of immediate events is small (~1), the only time more than one event may be present is when the channel is paused or immediate send is disabled (via manual transmit profile). By default max number of events is 500 and the default transmit time is 0ms. Added in v3.1.1 | number
| [autoFlushEventsLimit](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#autoFlushEventsLimit) | [Optional] If defined, once this number of events has been queued the system perform a flush() to send the queued events without waiting for the normal schedule timers. Default is undefined | number
| [httpXHROverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#httpXHROverride) |The HTTP override that should be used to send requests, request properties and headers should be added to the request to maintain correct functionality with other plugins.|IXHROverride
| [overrideInstrumentationKey](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#overrideInstrumentationKey) |Override for Instrumentation key.|string
| [overrideEndpointUrl](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#overrideEndpointUrl) |Override for Endpoint where telemetry data is sent.|string
| [disableTelemetry](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableTelemetry) |The master off switch. Do not send any data if set to TRUE.|boolean
| [ignoreMc1Ms0CookieProcessing](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#ignoreMc1Ms0CookieProcessing) |MC1 and MSFPC cookies will not be provided. Default is false.|boolean
| [payloadPreprocessor](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#payloadPreprocessor) |POST channel preprocessing function. Can be used to gzip the payload (and set appropriate HTTP headers) before transmission. |[Function](./src/DataModels.ts)
| [payloadListener](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#payloadListener) |POST channel function hook to listen to events being sent, called after the batched events have been committed to be sent. Also used by Remote DDV Channel to send requests. |[Function](./src/DataModels.ts)
| [disableEventTimings](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableEventTimings) | [Optional] By default additional timing metrics details are added to each event after they are sent to allow you to review how long it took to create serialized request. As not all users require this level of detail and it's now possible to get the same metrics via the IPerfManager and IPerfEvent, so you can now disabled this previous level. Default value is false to retain the previous behavior, if you are not using these metrics and performance is a concern then it is recommended to set this value to true. | boolean
| [valueSanitizer](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#valueSanitizer) | [Optional] The value sanitizer to use while constructing the envelope, if not provided the default sanitizeProperty() method is called to validate and convert the fields for serialization. The path / fields names are based on the format of the envelope (serialized object) as defined via the [Common Schema 4.0](https://aka.ms/CommonSchema) specification. | IValueSanitizer
| [stringifyObjects](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#stringifyObjects) | [Optional] During serialization, when an object is identified should the object serialized by true => JSON.stringify(theObject); otherwise theObject.toString(). Defaults to false. | boolean
| [enableCompoundKey](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#enableCompoundKey) | [Optional] Enables support for objects with compound keys which indirectly represent an object eg. event: { "somedata.embeddedvalue": 123 } where the "key" of the object contains a "." as part of it's name. Defaults to false. | boolean
| [disableOptimizeObj](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableOptimizeObj) | [Optional] Switch to disable the v8 `optimizeObject()` calls used to provide better serialization performance. Defaults to false. | boolean
| [transports](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#transports) | [Optional] Either an array or single value identifying the requested `TransportType` (const enum) type that should be used. This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride is provided. | number or number[]
| [useSendBeacon](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#useSendBeacon) | [Optional] A flag to enable or disable the usage of the sendBeacon() API if available by the runtime. If running on ReactNative this defaults to `false` for all other cases it defaults to `true`.
| [disableFetchKeepAlive](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableFetchKeepAlive) | [Optional] A flag to disable the usage of the [fetch with keep-alive](https://javascript.info/fetch-api#keepalive) support.
| [unloadTransports](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#unloadTransports) | [Optional] Either an array or single value identifying the requested TransportType type(s) that should be used during unload or events marked as sendBeacon. This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride is provided and alwaysUseXhrOverride is true.
| [avoidOptions](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#avoidOptions)<br/><sub><i>(Since 3.1.10+)</i></sub><br /><sub>Default: false (Since 3.2.0)<br />Previously true</sub> | [Optional] Avoid adding request headers to the outgoing request that would cause a pre-flight (OPTIONS) request to be sent for each request. | boolean
| [xhrTimeout](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#xhrTimeout)<br/><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Specify a timeout (in ms) to apply to requests when sending requests using XHR or fetch() requests only, does not affect sendBeacon() or XDR (XDomainRequest) usage. Defaults to undefined and therefore the runtime defaults (normally zero for browser environments) | number
| [disableXhrSync](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableXhrSync)<br/><sub><i>(Since 3.1.11+)</i></sub> | [Optional] When using [Xhr](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) for sending requests disable sending as synchronous during unload or synchronous flush. __You should enable this feature for IE (when there is no sendBeacon() or fetch (with keep-alive) support) and you have clients that end up blocking the UI during page unloading__. <span style="color:red">This will cause ALL XHR requests to be sent asynchronously which during page unload may result in the lose of telemetry</span>. This does not affect any other request type (fetch(), sendBeacon() or XDR (XDomainRequest)) | boolean<br/>Default: undefined
| [alwaysUseXhrOverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#alwaysUseXhrOverride)<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] By default during unload (or when you specify to use sendBeacon() or sync fetch (with keep-alive) for an event) the SDK ignores any provided httpXhrOverride and attempts to use sendBeacon() or fetch(with keep-alive) when they are available. When this configuration option is true any provided httpXhrOverride will always be used, so any provided httpXhrOverride will also need to "handle" the synchronous unload scenario. | boolean<br /> Default: false
| [maxEventRetryAttempts](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#maxEventRetryAttempts)<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retirable) response, this causes the event to be internally "requeued" and resent in the next batch. As each normal batched send request is retried at least once before starting to increase the internal backoff send interval, normally batched events will generally be attempted the next nearest even number of times. This means that the total number of actual send attempts will almost always be even (setting to 5 will cause 6 requests), unless using manual synchronous flushing (calling flush(false)) which is not subject to request level retry attempts. | number<br/>Default: 6
| [maxUnloadEventRetryAttempts](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#maxUnloadEventRetryAttempts)<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retriable) response as part of processing / flushing events once a page unload state has been detected, this causes the event to be internally "requeued" and resent in the next batch, which during page unload. Unlike the normal batching process, send requests are never retried, so the value listed here is always the maximum number of attempts for any single event.<br/>Notes: The SDK by default will use the sendBeacon() API if it exists which is treated as a fire and forget successful response, so for environments that support or supply this API the events won't be retried (because they will be deeded to be successfully sent). When an environment (IE) doesn't support sendBeacon(), this will cause multiple synchronous (by default) XMLHttpRequests to be sent, which will block the UI until a response is received. You can disable ALL synchronous XHR requests by setting the 'disableXhrSync' configuration setting and/or changing this value to 0 or 1. | number<br/>Default: 2
| [addNoResponse](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#addNoResponse) <br /><sub><i>(Since 3.2.8+)</i></sub> | [Optional] flag to indicate whether the sendBeacon and fetch (with keep-alive flag) should add the "NoResponseBody" query string value to indicate that the server should return a 204 for successful requests. | boolean<br/>Default: true
| [disableZip](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IChannelConfiguration.html#disableZip) <br /><sub><i>(Since 4.3.7+)</i></sub> | [Optional] flag to use CompressionStream API to compress the payload. Compression will only occur if the event is asynchronous. For events like unloads, compression will not be applied. * Note: if user set payloadPreprocessor, this zip compression will not be applied. | boolean<br/>Default: true
### [IXHROverride](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IXHROverride.html)
| Config | Description | Type
|----------------|----------------------------------------|----|
| [sendPOST](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/interfaces/IXHROverride.html#sendPOST) |This method sends data to the specified URI using a POST request. If sync is true then the request is sent synchronously. The <i>oncomplete</i> function should always be called after the request is completed (either successfully or timed out or failed due to errors).|function
### Payload Preprocessors
```ts
interface IPayloadData {
urlString: string;
data: Uint8Array | string;
headers?: { [name: string]: string };
timeout?: number; // Optional value supplied by the xhrTimeout configuration option
disableXhrSync?: boolean; // Optional value supplied by the disableXhrSync configuration option
}
type PayloadPreprocessorFunction = (payload: IPayloadData, callback: (modifiedBuffer: IPayloadData) => void) => void;
```
To perform some preprocessing operation on your payload before it is sent over the wire, you can supply the POST channel config with a `payloadPreprocessor` function. A typical usage of it would be to gzip your payloads.
```ts
const zlib = require('zlib');
const gzipFn: PayloadPreprocessorFunction = (payload: IPayloadData, cb) => {
zlib.gzip(payload.data, (err, dataToSend) => {
if (err) return cb(payload); // send original payload on error
const payloadToSend = {
...payload,
headers: { ...payload.headers, 'Content-Encoding': 'gzip' };
data: dataToSend,
};
cb(payloadToSend);
});
}
```
### XHR Override
```ts
/**
* SendPOSTFunction type defines how an HTTP POST request is sent to an ingestion server
* @param payload - The payload object that should be sent, contains the url, bytes/string and headers for the request
* @param oncomplete - The function to call once the request has completed whether a success, failure or timeout
* @param sync - A boolean flag indicating whether the request should be sent as a synchronous request.
*/
export type SendPOSTFunction = (payload: IPayloadData, oncomplete: (status: number, headers: { [headerName: string]: string; }, response?: string) => void, sync?: boolean) => void;
/**
* The IXHROverride interface overrides the way HTTP requests are sent.
*/
export interface IXHROverride {
/**
* This method sends data to the specified URI using a POST request. If sync is true,
* then the request is sent synchronously. The <i>oncomplete</i> function should always be called after the request is
* completed (either successfully or timed out or failed due to errors).
*/
sendPOST: SendPOSTFunction;
}
```
#### Example using node.js Https module
```ts
const oneDs = require('@microsoft/1ds-analytics-js');
const https = require('https');
// XHR override using node.js https module
var customHttpXHROverride= {
sendPOST: (payload: IPayloadData, oncomplete) => {
var options = {
method: 'POST',
headers: {
...payload.headers,
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(payload.data)
}
};
const req = https.request(payload.urlString, options, res => {
res.on('data', function (responseData) {
oncomplete(res.statusCode, res.headers, responseData.toString());
});
});
req.write(payload.data);
req.end();
}
};
var postChannelConfig: IChannelConfiguration = {
httpXHROverride: customHttpXHROverride
};
```
#### Example always using fetch API
This example is using the [fetch() API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch) for all requests, include synchronous requests and assumes that the browser environment supports the (currently) experimental keepalive option (for chromium).
```ts
function fetchHttpXHROverride(payload: IPayloadData, onComplete: OnCompleteCallback, sync?: boolean) {
let ignoreResponse = false;
let responseHandled = false;
let requestInit: RequestInit = {
body: payload.data,
method: Method,
headers: payload.headers,
[DisabledPropertyName]: true,
credentials: "include"
};
if (sync) {
// You should validate whether the runtime environment supports this flag and if not you should use either sendBeacon or a synchronous XHR request
requestInit.keepalive = true;
if (sync) {
// As a sync request (during unload), it is unlikely that we will get a chance to process the response so
// just like beacon send assume that the events have been accepted and processed
ignoreResponse = true;
}
}
fetch(payload.urlString, requestInit).then((response) => {
let headerMap = {};
let responseText = "";
if (response.headers) {
response.headers.forEach((value: string, name: string) => {
headerMap[name] = value;
});
}
if (response.body) {
response.text().then(function(text) {
responseText = text;
});
}
if (!responseHandled) {
responseHandled = true;
onComplete(response.status, headerMap, responseText);
}
}).catch((error) => {
// In case there is an error in the request. Set the status to 0
// so that the events can be retried later.
if (!responseHandled) {
responseHandled = true;
onComplete(0, {});
}
});
// If we are treating this as a synchronous (keepAlive) we need to assume success during unload processing
if (ignoreResponse && !responseHandled) {
responseHandled = true;
onComplete(200, {});
}
// Simulate timeout if a timeout was supplied
if (!responseHandled && payload.timeout > 0) {
setTimeout(() => {
if (!responseHandled) {
// Assume a 500 response (which will cause a retry)
responseHandled = true;
onComplete(500, {});
}
}, payload.timeout);
}
}
let postChannelConfig: IChannelConfiguration = {
httpXHROverride: fetchHttpXHROverride,
// Enable this flag to cause the SDK to ALWAYS call your override otherwise during page unload the SDK will using it's internal
// sendPost implementation using sendBeacon() or fetch (with keepalive support) whichever is the first supported
//alwaysUseXhrOverride: true,
// If you want to specify a timeout this value is passed on the payload object as `payload.timeout`
//xhrTimeout: 20000,
};
```
## IValueSanitizer Paths / Fields which are excluded
To ensure that the service can continue to accept events that are sent from the SDK, some paths and fields are explicitly blocked and are never processed
via any configured valueSanitizer. These fields are blocked at the serialization level and cannot be overridden.
The path / fields names are based on the format of the envelope (serialized object) as defined via the [Common Schema 4.0](https://aka.ms/CommonSchema) specification, so the path / field names used for the IValueSanitizer are based on how the data is serialized to the service (CS 4.0 location) and not specifically the location
on the event object you pass into the track methods (unless they are the same).
The currently configured set of fields include
### Excluded Part A fields
- All direct top-level fields of the envelope, this includes "ver"; "name"; "time" and "iKey". see [Common Schema 4.0 - Part A](https://aka.ms/CommonSchema/PartA) for all defined fields. Note: This exclusion does does not match sub-keys (objects) like "ext", "data" and "properties".
- All fields of the web extension, this includes all fields and sub keys of "ext.web" (example fields include "ext.web.browser"; "ext.web.domain"; "ext.web.consentDetails"). see [Common Schema 4.0 - Part A Extension - web](https://aka.ms/CommonSchema/PartA/Web) for the complete set of defined fields.
- All fields and paths of the metadata extension, this includes all fields and sub keys of "ext.metadata". see [Common Schema 4.0 - Part A Extension - metadata](https://aka.ms/CommonSchema/PartA/MetaData) for the complete set of defined fields.
## Synchronous Events
By default events are batched and sent asynchronously, there are times when you want to send events immediately during the same JavaScript execution cycle.
To support this you can set the ```sync``` property on an event to tell the PostChannel to skip the normal event batching and send this event now within it's own outbound connection. Because each ```sync``` event will cause a new request / connection (per event) you should use this approach SPARINGLY to avoid creating an excessive number of requests from the users browser which may have a negative impact on their experience.
Note: If the initial synchronous request fails (not the normal case) any sync event will be queued for resending as an asynchronous batch (unless an "unload" event has been detected).
### Supported Sync values
Supported event ```sync``` values to cause an event to be sent immediately during the same JavaScript execution cycle.
In the case of the sendBeacon() and fetch() [with keepalive] (SyncFetch) both of these API's have a maximum payload size defined as 64Kb, as such if the size of the serialized (JSON) events are larger than this the events will be dropped as there is no safe way to send the event.
| Name | Value | Description
|----------|-------|-------------------
| Batched | undefined,<br />false,<br />0 | This is the default situation and will cause the event to be Batched and sent asynchronously.
| Synchronous | true,<br />1 | Attempt to send the request using the default synchronous method.<br />This will use the first available transport option:<br/>- httpXHROverride;<br/>-XMLHttpRequest (with sync flag);<br/>-fetch() [with keepalive] (Since v3.1.3);<br/>-sendBeacon() (Since v3.1.3)
| SendBeacon | 2 | (Since v3.1.3) Attempt to send the event synchronously with a preference for the sendBeacon() API.<br />This will use the first available transport option:<br/>-sendBeacon();<br/>-fetch() [with keepalive];<br/>-XMLHttpRequest (with sync flag);<br/>-httpXHROverride
| SyncFetch | 3 | (Since v3.1.3) Attempt to send the event synchronously with a preference for the fetch() API with the keepalive flag, the SDK checks to ensure that the fetch() implementation supports the 'keepalive' flag and if not it will skip this transport option.<br />This will use the first available transport option:<br/>-fetch() [with keepalive];<br/>-sendBeacon();<br/>-XMLHttpRequest (with sync flag);<br/>-httpXHROverride
The named values are available in TypeScript via the ```EventSendType``` const enum class since v3.1.3.
> Note: The SDK explicitly checks for ```keepalive``` support for fetch() via the ```Request``` class, so if not available this transport will not be used. [Browsers natively supporting fetch() keepalive](https://caniuse.com/?search=keepalive), as such any polyfill would also need to support this flag for it to be used.
___Special sendBeacon() Note___
As the sendBeacon() API does not provide any response handling, any events sent via this method are considered to have been successfully sent, even if the browser fails to send the requests. The only exception is that if the browser returns false indicating that it can't accept the sendBeacon() request, in this case the SDK will send a dropped event notification.
### When to use 'sync' events
Events that cause a page navigation can cause a race condition that could result in either event loss or duplication. This happens when any previously batched events have been sent (the request is in-flight) and the browser subsequently cancels the request before a response is processed AND it also triggers the JavaScript "cancel" or "abort" event, normally only during the unload process.
The SDK listens to all supported "unload" events (```unload```, ```beforeunload``` and ```pagehide```) and when any one of these are detected it will immediately send all (unsent) batched events via the "SendBeacon" (and fallback) methods above. This successfully mitigates the event loss case above, but it can compound the event duplication case for some scenarios as the SDK works to ensure that all events are sent and acknowledged.
This situation has become more prevalent with the enforcement by modern browsers to disallow, cancel or abort the usage of synchronous Xhr requests during page "unload" event.
There are effectively 2 scenarios where you should consider adding the `sync` property to an event (using the asynchronous SendBeacon and SyncFetch values) to remove the possibility of event duplication (the WebAnalytics extension already handles these cases).
1) You want to send your own event during the page "unload" events and you have hooked the "unload" events yourself (before) initializing the SDK.
- When you listen to the events "before" the SDK initializes, there is a small window of time where any "batched" event may get sent (and therefore become in-flight) before the SDK receives and processes the "unload" events, thus the potential race condition.
- If you attach to the "unload" events "after" the SDK is initialized, it will now (since v3.1.3) automatically convert all received event(s) into "sync" (SendBeacon) events to ensure delivery.
2) You want to send you own telemetry event(s) based on some user action after which a page-navigation immediately occurs, either via an anchor &lt;a /&gt; containing a href and letting the event bubble or by directly causing a navigation via a form Post or location change.
- This is because because the href / post / location change will eventually cause an "unload" event to occur and therefore (potentially) any outbound (in-flight) requests may get canceled and cause event to be duplicated.
- While this situation can occur with any other batched events, it is more likely to occur when events are created during these know situations that are known to directly trigger the "unload" cycle.
## API documentation
[Typedoc generated API reference](https://microsoft.github.io/ApplicationInsights-JS/webSdk/1ds-post-js/index.html)
## Learn More
You can learn more in [1DS First party getting started](https://aka.ms/1dsjs).
## Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at [https://go.microsoft.com/fwlink/?LinkID=824704](https://go.microsoft.com/fwlink/?LinkID=824704). You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
To turn off sending telemetry to Microsoft, ensure that the POST channel is not configured in the extensions. See below configuration for example:
```js
var coreConfig: IExtendedConfiguration = {
instrumentationKey: "YOUR_TENANT_KEY",
extensions: [
postChannel // << REMOVE THIS EXTENSION TO STOP SENDING TELEMETRY TO MICROSOFT
],
extensionConfig: {}
};
```
## Contributing
Read our [contributing guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Application Insights.
## Data Collection
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsofts privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsofts Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-partys policies.
## License
[MIT](./LICENSE.TXT)
+41
View File
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->
+14
View File
@@ -0,0 +1,14 @@
# Support
## How to file issues and get help
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.
For help and questions about using this project, please create a Support request issue on
https://github.com/microsoft/ApplicationInsights-JS/issues.
## Microsoft Support Policy
Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
{
"name": "ms.post",
"version": "4.3.11",
"ext": {
"@gbl.js": {
"file": "ms.post-4.3.11.gbl.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-rpCq8yvxE1UchUOEsf+4BYZOtFZ/zAI6k0SpXgsdGFM= sha384-3AXVB2BKYZSsYmnPZXSV2gdlC+/MV2izoq+GQkJkuA4ylNu0csI9mdszB+zNffBz sha512-a6DKbVV5rRQnaTjRlXIzaWihurp9D0dlBoXzaDxEV+orNCP1AoyxeDEkTohRrM+Siv9r4TXibVzoydKO1uV3uA==",
"hashes": {
"sha256": "rpCq8yvxE1UchUOEsf+4BYZOtFZ/zAI6k0SpXgsdGFM=",
"sha384": "3AXVB2BKYZSsYmnPZXSV2gdlC+/MV2izoq+GQkJkuA4ylNu0csI9mdszB+zNffBz",
"sha512": "a6DKbVV5rRQnaTjRlXIzaWihurp9D0dlBoXzaDxEV+orNCP1AoyxeDEkTohRrM+Siv9r4TXibVzoydKO1uV3uA=="
}
},
"@gbl.min.js": {
"file": "ms.post-4.3.11.gbl.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-lI2J8ZWW+7lMNur0ufWLk1yqY83Dm+9EJCG4q/WdMXg= sha384-mAerKbxZTOV1Nz34A324oUv1/bRadMnWoFIbsIP8GV8tU/1qz/Nid8e0Fs9FZ/7o sha512-5cFTX9prhAJA9OQSFGJlJEYICT8FiXH6sj3l3Pxbz1DiqUkQWVGQaNsLx9wiChi9PR5PIq5FToeK4DrvnKao/g==",
"hashes": {
"sha256": "lI2J8ZWW+7lMNur0ufWLk1yqY83Dm+9EJCG4q/WdMXg=",
"sha384": "mAerKbxZTOV1Nz34A324oUv1/bRadMnWoFIbsIP8GV8tU/1qz/Nid8e0Fs9FZ/7o",
"sha512": "5cFTX9prhAJA9OQSFGJlJEYICT8FiXH6sj3l3Pxbz1DiqUkQWVGQaNsLx9wiChi9PR5PIq5FToeK4DrvnKao/g=="
}
},
"@js": {
"file": "ms.post-4.3.11.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-0/5008gBqqv0rZYrTy2D89mXrBrsN7Cv1u8EZut46N8= sha384-KRIMjTLa3GELMbKGC+1jA0CNfb9gh3k0QjV7TsuSWKKuc2ZK5qrY3iUK5jJcybji sha512-s4krP9BnAge+pFj1lPb1yser/GG/b640sIefm6Cf6njL7LeofctilMkqmiRAfFDLV1FiRJvEM5pJnyWGUu3E4Q==",
"hashes": {
"sha256": "0/5008gBqqv0rZYrTy2D89mXrBrsN7Cv1u8EZut46N8=",
"sha384": "KRIMjTLa3GELMbKGC+1jA0CNfb9gh3k0QjV7TsuSWKKuc2ZK5qrY3iUK5jJcybji",
"sha512": "s4krP9BnAge+pFj1lPb1yser/GG/b640sIefm6Cf6njL7LeofctilMkqmiRAfFDLV1FiRJvEM5pJnyWGUu3E4Q=="
}
},
"@min.js": {
"file": "ms.post-4.3.11.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-dwzFb51yY09vBytS2q5RvCulmCy5SsgNIBSOPO8jRsw= sha384-BS2c8mnEoIF0gvGQIwPKnZlgiTYjvbaUM48Meaox9zjmiTbaBJpn3U85Rwif2H8A sha512-kxNBpU3FtvfHL2mABmHb/e7ZMg3wd+TcWSkzXEvIUysboPlTaR/YUbjpHiNE68N5O3Q+MYrPBm2qS6AlUrD7Pg==",
"hashes": {
"sha256": "dwzFb51yY09vBytS2q5RvCulmCy5SsgNIBSOPO8jRsw=",
"sha384": "BS2c8mnEoIF0gvGQIwPKnZlgiTYjvbaUM48Meaox9zjmiTbaBJpn3U85Rwif2H8A",
"sha512": "kxNBpU3FtvfHL2mABmHb/e7ZMg3wd+TcWSkzXEvIUysboPlTaR/YUbjpHiNE68N5O3Q+MYrPBm2qS6AlUrD7Pg=="
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
{
"name": "ms.post",
"version": "4.3.11",
"ext": {
"@gbl.js": {
"file": "ms.post.gbl.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-OZu4V5DXWpQxGiM8SY4R+ZIt/9RaO8ppSngEMQWiZ2Y= sha384-hJgRIhvhEpwJNzdz2M+qvWSJWXAkS+H6WuzAIFZxrRRFgFm4QT17FaOtbD5HGnJQ sha512-VeGk5QAuxGaihq+U/DRCeuro3hGCyb5B6roz4FdiLnMbmBh7MhGkgBlYqLA/AtPPvKc8Hu8CbSCvlwPTNdswcQ==",
"hashes": {
"sha256": "OZu4V5DXWpQxGiM8SY4R+ZIt/9RaO8ppSngEMQWiZ2Y=",
"sha384": "hJgRIhvhEpwJNzdz2M+qvWSJWXAkS+H6WuzAIFZxrRRFgFm4QT17FaOtbD5HGnJQ",
"sha512": "VeGk5QAuxGaihq+U/DRCeuro3hGCyb5B6roz4FdiLnMbmBh7MhGkgBlYqLA/AtPPvKc8Hu8CbSCvlwPTNdswcQ=="
}
},
"@gbl.min.js": {
"file": "ms.post.gbl.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-L1N1iybXFcLJZ0xrYpLFyRli3/u3EFpZmXqEu/8hTk8= sha384-dk52S4JCPHQ1Sr5OpPNksiPnilJZ2LrU7oZ6ZfYlge2rhp29zNb6wPDRlJtk6KuL sha512-SLxpi2MwQoocZySaYkjfqfUhxv12xA5vlkb95+SRfkGdULDZuIXEla/8e80+5Z9WVT+XOFtRevKj3vE0WJNr3g==",
"hashes": {
"sha256": "L1N1iybXFcLJZ0xrYpLFyRli3/u3EFpZmXqEu/8hTk8=",
"sha384": "dk52S4JCPHQ1Sr5OpPNksiPnilJZ2LrU7oZ6ZfYlge2rhp29zNb6wPDRlJtk6KuL",
"sha512": "SLxpi2MwQoocZySaYkjfqfUhxv12xA5vlkb95+SRfkGdULDZuIXEla/8e80+5Z9WVT+XOFtRevKj3vE0WJNr3g=="
}
},
"@js": {
"file": "ms.post.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-ZpkOObttmXB4ObP3X+pIJZIRnVBMVquiMoURlKRv0oA= sha384-ka96y2bQEtwPbCmI22J7eFqTBW2M6N+r2JRWp3rjWNPPmMeCUrCuvwQ7hjjnb/dX sha512-CIqG9k3ZKc6Cta0Zwb8/fv30pkzqtdFcHbBCwUY5nvGAmwed3HTjbqZfRoTmY01AMSCWxHXktvRC5WWtBTYUYw==",
"hashes": {
"sha256": "ZpkOObttmXB4ObP3X+pIJZIRnVBMVquiMoURlKRv0oA=",
"sha384": "ka96y2bQEtwPbCmI22J7eFqTBW2M6N+r2JRWp3rjWNPPmMeCUrCuvwQ7hjjnb/dX",
"sha512": "CIqG9k3ZKc6Cta0Zwb8/fv30pkzqtdFcHbBCwUY5nvGAmwed3HTjbqZfRoTmY01AMSCWxHXktvRC5WWtBTYUYw=="
}
},
"@min.js": {
"file": "ms.post.min.js",
"type": "text/javascript; charset=utf-8",
"integrity": "sha256-GX6CMRhuMcoKf0P2Dwl7ePtIQuuW+qHLOFcrcQmjsns= sha384-evRJiV++YzKi8iY7bM2TP8b9J7UgLTdEwoAvjOK6Y8UdnuK0LiuM+QRqb219WVt1 sha512-Wt98qjn2SIQlLEH5slsiQ+9zUn9evkOZlUii3pzgNdMqHN0FPmSW53JwJPSrteK6XsiAo5I7+Q8jOTfpMYp96Q==",
"hashes": {
"sha256": "GX6CMRhuMcoKf0P2Dwl7ePtIQuuW+qHLOFcrcQmjsns=",
"sha384": "evRJiV++YzKi8iY7bM2TP8b9J7UgLTdEwoAvjOK6Y8UdnuK0LiuM+QRqb219WVt1",
"sha512": "Wt98qjn2SIQlLEH5slsiQ+9zUn9evkOZlUii3pzgNdMqHN0FPmSW53JwJPSrteK6XsiAo5I7+Q8jOTfpMYp96Q=="
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
export {};
//# sourceMappingURL=BatchNotificationActions.js.map
@@ -0,0 +1 @@
{"version":3,"file":"BatchNotificationActions.js.map","sources":["BatchNotificationActions.js"],"sourcesContent":["export {};\r\n//# sourceMappingURL=BatchNotificationActions.js.map"],"names":[],"mappings":";;;;;AAAA;AACA"}
@@ -0,0 +1,92 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* ClockSkewManager.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
*/
import dynamicProto from "@microsoft/dynamicproto-js";
import { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_SET_CLOCK_SKEW, _DYN_SHOULD_ADD_CLOCK_SKE1 } from "./__DynamicConstants";
/**
* Class to manage clock skew correction.
*/
var ClockSkewManager = /** @class */ (function () {
function ClockSkewManager() {
var _allowRequestSending = true;
var _shouldAddClockSkewHeaders = true;
var _isFirstRequest = true;
var _clockSkewHeaderValue = "use-collector-delta";
var _clockSkewSet = false;
dynamicProto(ClockSkewManager, this, function (_self) {
/**
* Determine if requests can be sent.
* @returns True if requests can be sent, false otherwise.
*/
_self[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */] = function () {
return _allowRequestSending;
};
/**
* Tells the ClockSkewManager that it should assume that the first request has now been sent,
* If this method had not yet been called AND the clock Skew had not been set this will set
* allowRequestSending to false until setClockSet() is called.
*/
_self.firstRequestSent = function () {
if (_isFirstRequest) {
_isFirstRequest = false;
if (!_clockSkewSet) {
// Block sending until we get the first clock Skew
_allowRequestSending = false;
}
}
};
/**
* Determine if clock skew headers should be added to the request.
* @returns True if clock skew headers should be added, false otherwise.
*/
_self[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */] = function () {
return _shouldAddClockSkewHeaders;
};
/**
* Gets the clock skew header value.
* @returns The clock skew header value.
*/
_self[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */] = function () {
return _clockSkewHeaderValue;
};
/**
* Sets the clock skew header value. Once clock skew is set this method
* is no-op.
* @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.
*/
_self[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */] = function (timeDeltaInMillis) {
if (!_clockSkewSet) {
if (timeDeltaInMillis) {
_clockSkewHeaderValue = timeDeltaInMillis;
_shouldAddClockSkewHeaders = true;
_clockSkewSet = true;
}
else {
_shouldAddClockSkewHeaders = false;
}
// Unblock sending
_allowRequestSending = true;
}
};
});
}
// Removed Stub for ClockSkewManager.prototype.allowRequestSending.
// Removed Stub for ClockSkewManager.prototype.firstRequestSent.
// Removed Stub for ClockSkewManager.prototype.shouldAddClockSkewHeaders.
// Removed Stub for ClockSkewManager.prototype.getClockSkewHeaderValue.
// Removed Stub for ClockSkewManager.prototype.setClockSkew.
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
ClockSkewManager.__ieDyn=1;
return ClockSkewManager;
}());
export { ClockSkewManager };
//# sourceMappingURL=ClockSkewManager.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* Real Time profile (default profile). RealTime Latency events are sent every 1 sec and
* Normal Latency events are sent every 2 sec.
*/
export var RT_PROFILE = "REAL_TIME";
/**
* Near Real Time profile. RealTime Latency events are sent every 3 sec and
* Normal Latency events are sent every 6 sec.
*/
export var NRT_PROFILE = "NEAR_REAL_TIME";
/**
* Best Effort. RealTime Latency events are sent every 9 sec and
* Normal Latency events are sent every 18 sec.
*/
export var BE_PROFILE = "BEST_EFFORT";
//# sourceMappingURL=DataModels.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DataModels.js.map","sources":["DataModels.js"],"sourcesContent":["/**\r\n * Real Time profile (default profile). RealTime Latency events are sent every 1 sec and\r\n * Normal Latency events are sent every 2 sec.\r\n */\r\nexport var RT_PROFILE = \"REAL_TIME\";\r\n/**\r\n * Near Real Time profile. RealTime Latency events are sent every 3 sec and\r\n * Normal Latency events are sent every 6 sec.\r\n */\r\nexport var NRT_PROFILE = \"NEAR_REAL_TIME\";\r\n/**\r\n * Best Effort. RealTime Latency events are sent every 9 sec and\r\n * Normal Latency events are sent every 18 sec.\r\n */\r\nexport var BE_PROFILE = \"BEST_EFFORT\";\r\n//# sourceMappingURL=DataModels.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,93 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* EventBatch.ts
* @author Nev Wylie (newylie)
* @copyright Microsoft 2020
*/
import { isNullOrUndefined, isValueAssigned } from "@microsoft/1ds-core-js";
import { STR_EMPTY, STR_MSFPC } from "./InternalConstants";
import { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLIT } from "./__DynamicConstants";
function _getEventMsfpc(theEvent) {
var intWeb = ((theEvent.ext || {})["intweb"]);
if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {
return intWeb[STR_MSFPC];
}
return null;
}
function _getMsfpc(theEvents) {
var msfpc = null;
for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {
msfpc = _getEventMsfpc(theEvents[lp]);
}
return msfpc;
}
/**
* This class defines a "batch" events related to a specific iKey, it is used by the PostChannel and HttpManager
* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous
* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature
* of sending requests.
*/
var EventBatch = /** @class */ (function () {
/**
* Private constructor so that caller is forced to use the static create method.
* @param iKey - The iKey to associate with the events (not validated)
* @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.
*/
function EventBatch(iKey, addEvents) {
var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];
var _self = this;
var _msfpc = _getMsfpc(events);
_self[_DYN_I_KEY /* @min:%2eiKey */] = function () {
return iKey;
};
_self.Msfpc = function () {
// return the cached value unless it's undefined -- used to avoid cpu
return _msfpc || STR_EMPTY;
};
_self[_DYN_COUNT /* @min:%2ecount */] = function () {
return events[_DYN_LENGTH /* @min:%2elength */];
};
_self[_DYN_EVENTS /* @min:%2eevents */] = function () {
return events;
};
_self.addEvent = function (theEvent) {
if (theEvent) {
events[_DYN_PUSH /* @min:%2epush */](theEvent);
if (!_msfpc) {
// Not found so try and find one
_msfpc = _getEventMsfpc(theEvent);
}
return true;
}
return false;
};
_self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {
// Create a new batch with the same iKey
var theEvents;
if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {
var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;
if (!isNullOrUndefined(numEvents)) {
cnt = numEvents < cnt ? numEvents : cnt;
}
theEvents = events.splice(fromEvent, cnt);
// reset the fetched msfpc value
_msfpc = _getMsfpc(events);
}
return new EventBatch(iKey, theEvents);
};
}
/**
* Creates a new Event Batch object
* @param iKey - The iKey associated with this batch of events
*/
EventBatch.create = function (iKey, theEvents) {
return new EventBatch(iKey, theEvents);
};
return EventBatch;
}());
export { EventBatch };
//# sourceMappingURL=EventBatch.js.map
@@ -0,0 +1 @@
{"version":3,"file":"EventBatch.js.map","sources":["EventBatch.js"],"sourcesContent":["/**\r\n* EventBatch.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2020\r\n*/\r\nimport { isNullOrUndefined, isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { STR_EMPTY, STR_MSFPC } from \"./InternalConstants\";\r\nimport { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nfunction _getEventMsfpc(theEvent) {\r\n var intWeb = ((theEvent.ext || {})[\"intweb\"]);\r\n if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {\r\n return intWeb[STR_MSFPC];\r\n }\r\n return null;\r\n}\r\nfunction _getMsfpc(theEvents) {\r\n var msfpc = null;\r\n for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n msfpc = _getEventMsfpc(theEvents[lp]);\r\n }\r\n return msfpc;\r\n}\r\n/**\r\n* This class defines a \"batch\" events related to a specific iKey, it is used by the PostChannel and HttpManager\r\n* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous\r\n* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature\r\n* of sending requests.\r\n*/\r\nvar EventBatch = /** @class */ (function () {\r\n /**\r\n * Private constructor so that caller is forced to use the static create method.\r\n * @param iKey - The iKey to associate with the events (not validated)\r\n * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.\r\n */\r\n function EventBatch(iKey, addEvents) {\r\n var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self[_DYN_I_KEY /* @min:%2eiKey */] = function () {\r\n return iKey;\r\n };\r\n _self.Msfpc = function () {\r\n // return the cached value unless it's undefined -- used to avoid cpu\r\n return _msfpc || STR_EMPTY;\r\n };\r\n _self[_DYN_COUNT /* @min:%2ecount */] = function () {\r\n return events[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self[_DYN_EVENTS /* @min:%2eevents */] = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events[_DYN_PUSH /* @min:%2epush */](theEvent);\r\n if (!_msfpc) {\r\n // Not found so try and find one\r\n _msfpc = _getEventMsfpc(theEvent);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {\r\n var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;\r\n if (!isNullOrUndefined(numEvents)) {\r\n cnt = numEvents < cnt ? numEvents : cnt;\r\n }\r\n theEvents = events.splice(fromEvent, cnt);\r\n // reset the fetched msfpc value\r\n _msfpc = _getMsfpc(events);\r\n }\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n }\r\n /**\r\n * Creates a new Event Batch object\r\n * @param iKey - The iKey associated with this batch of events\r\n */\r\n EventBatch.create = function (iKey, theEvents) {\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n return EventBatch;\r\n}());\r\nexport { EventBatch };\r\n//# sourceMappingURL=EventBatch.js.map"],"names":[],"mappings":";;;;;AAAA;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"}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* @name Index.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
* File to export public classes.
*/
import { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from "./DataModels";
import { PostChannel } from "./PostChannel";
export { PostChannel, BE_PROFILE, NRT_PROFILE, RT_PROFILE };
//# sourceMappingURL=Index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Index.js.map","sources":["Index.js"],"sourcesContent":["/**\r\n* @name Index.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File to export public classes.\r\n*/\r\nimport { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from \"./DataModels\";\r\nimport { PostChannel } from \"./PostChannel\";\r\nexport { PostChannel, BE_PROFILE, NRT_PROFILE, RT_PROFILE };\r\n//# sourceMappingURL=Index.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -0,0 +1,42 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
// Licensed under the MIT License.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
// as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
export var STR_EMPTY = "";
export var STR_POST_METHOD = "POST";
export var STR_DISABLED_PROPERTY_NAME = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
export var STR_DROPPED = "drop";
export var STR_SENDING = "send";
export var STR_REQUEUE = "requeue";
export var STR_RESPONSE_FAIL = "rspFail";
export var STR_OTHER = "oth";
export var DEFAULT_CACHE_CONTROL = "no-cache, no-store";
export var DEFAULT_CONTENT_TYPE = "application/x-json-stream";
export var STR_CACHE_CONTROL = "cache-control";
export var STR_CONTENT_TYPE_HEADER = "content-type";
export var STR_KILL_TOKENS_HEADER = "kill-tokens";
export var STR_KILL_DURATION_HEADER = "kill-duration";
export var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
export var STR_TIME_DELTA_HEADER = "time-delta-millis";
export var STR_CLIENT_VERSION = "client-version";
export var STR_CLIENT_ID = "client-id";
export var STR_TIME_DELTA_TO_APPLY = "time-delta-to-apply-millis";
export var STR_UPLOAD_TIME = "upload-time";
export var STR_API_KEY = "apikey";
export var STR_MSA_DEVICE_TICKET = "AuthMsaDeviceTicket";
export var STR_AUTH_WEB_TOKEN = "WebAuthToken";
export var STR_AUTH_XTOKEN = "AuthXToken";
export var STR_SDK_VERSION = "sdk-version";
export var STR_NO_RESPONSE_BODY = "NoResponseBody";
export var STR_MSFPC = "msfpc";
export var STR_TRACE = "trace";
export var STR_USER = "user";
//# sourceMappingURL=InternalConstants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"InternalConstants.js.map","sources":["InternalConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_POST_METHOD = \"POST\";\r\nexport var STR_DISABLED_PROPERTY_NAME = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var STR_DROPPED = \"drop\";\r\nexport var STR_SENDING = \"send\";\r\nexport var STR_REQUEUE = \"requeue\";\r\nexport var STR_RESPONSE_FAIL = \"rspFail\";\r\nexport var STR_OTHER = \"oth\";\r\nexport var DEFAULT_CACHE_CONTROL = \"no-cache, no-store\";\r\nexport var DEFAULT_CONTENT_TYPE = \"application/x-json-stream\";\r\nexport var STR_CACHE_CONTROL = \"cache-control\";\r\nexport var STR_CONTENT_TYPE_HEADER = \"content-type\";\r\nexport var STR_KILL_TOKENS_HEADER = \"kill-tokens\";\r\nexport var STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nexport var STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nexport var STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\nexport var STR_CLIENT_VERSION = \"client-version\";\r\nexport var STR_CLIENT_ID = \"client-id\";\r\nexport var STR_TIME_DELTA_TO_APPLY = \"time-delta-to-apply-millis\";\r\nexport var STR_UPLOAD_TIME = \"upload-time\";\r\nexport var STR_API_KEY = \"apikey\";\r\nexport var STR_MSA_DEVICE_TICKET = \"AuthMsaDeviceTicket\";\r\nexport var STR_AUTH_WEB_TOKEN = \"WebAuthToken\";\r\nexport var STR_AUTH_XTOKEN = \"AuthXToken\";\r\nexport var STR_SDK_VERSION = \"sdk-version\";\r\nexport var STR_NO_RESPONSE_BODY = \"NoResponseBody\";\r\nexport var STR_MSFPC = \"msfpc\";\r\nexport var STR_TRACE = \"trace\";\r\nexport var STR_USER = \"user\";\r\n//# sourceMappingURL=InternalConstants.js.map"],"names":[],"mappings":";;;;;AAA4D;AAC5D;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,69 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* KillSwitch.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
*/
import dynamicProto from "@microsoft/dynamicproto-js";
import { arrForEach, dateNow, strTrim } from "@microsoft/1ds-core-js";
import { _DYN_IS_TENANT_KILLED, _DYN_LENGTH, _DYN_PUSH, _DYN_SET_KILL_SWITCH_TENA11, _DYN_SPLIT } from "./__DynamicConstants";
var SecToMsMultiplier = 1000;
/**
* Class to stop certain tenants sending events.
*/
var KillSwitch = /** @class */ (function () {
function KillSwitch() {
var _killedTokenDictionary = {};
function _normalizeTenants(values) {
var result = [];
if (values) {
arrForEach(values, function (value) {
result[_DYN_PUSH /* @min:%2epush */](strTrim(value));
});
}
return result;
}
dynamicProto(KillSwitch, this, function (_self) {
_self[_DYN_SET_KILL_SWITCH_TENA11 /* @min:%2esetKillSwitchTenants */] = function (killTokens, killDuration) {
if (killTokens && killDuration) {
try {
var killedTokens = _normalizeTenants(killTokens[_DYN_SPLIT /* @min:%2esplit */](","));
if (killDuration === "this-request-only") {
return killedTokens;
}
var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;
for (var i = 0; i < killedTokens[_DYN_LENGTH /* @min:%2elength */]; ++i) {
_killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;
}
}
catch (ex) {
return [];
}
}
return [];
};
_self[_DYN_IS_TENANT_KILLED /* @min:%2eisTenantKilled */] = function (tenantToken) {
var killDictionary = _killedTokenDictionary;
var name = strTrim(tenantToken);
if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {
return true;
}
delete killDictionary[name];
return false;
};
});
}
// Removed Stub for KillSwitch.prototype.setKillSwitchTenants.
// Removed Stub for KillSwitch.prototype.isTenantKilled.
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
KillSwitch.__ieDyn=1;
return KillSwitch;
}());
export { KillSwitch };
//# sourceMappingURL=KillSwitch.js.map
@@ -0,0 +1 @@
{"version":3,"file":"KillSwitch.js.map","sources":["KillSwitch.js"],"sourcesContent":["/**\r\n* KillSwitch.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, dateNow, strTrim } from \"@microsoft/1ds-core-js\";\r\nimport { _DYN_IS_TENANT_KILLED, _DYN_LENGTH, _DYN_PUSH, _DYN_SET_KILL_SWITCH_TENA11, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nvar SecToMsMultiplier = 1000;\r\n/**\r\n* Class to stop certain tenants sending events.\r\n*/\r\nvar KillSwitch = /** @class */ (function () {\r\n function KillSwitch() {\r\n var _killedTokenDictionary = {};\r\n function _normalizeTenants(values) {\r\n var result = [];\r\n if (values) {\r\n arrForEach(values, function (value) {\r\n result[_DYN_PUSH /* @min:%2epush */](strTrim(value));\r\n });\r\n }\r\n return result;\r\n }\r\n dynamicProto(KillSwitch, this, function (_self) {\r\n _self[_DYN_SET_KILL_SWITCH_TENA11 /* @min:%2esetKillSwitchTenants */] = function (killTokens, killDuration) {\r\n if (killTokens && killDuration) {\r\n try {\r\n var killedTokens = _normalizeTenants(killTokens[_DYN_SPLIT /* @min:%2esplit */](\",\"));\r\n if (killDuration === \"this-request-only\") {\r\n return killedTokens;\r\n }\r\n var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;\r\n for (var i = 0; i < killedTokens[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;\r\n }\r\n }\r\n catch (ex) {\r\n return [];\r\n }\r\n }\r\n return [];\r\n };\r\n _self[_DYN_IS_TENANT_KILLED /* @min:%2eisTenantKilled */] = function (tenantToken) {\r\n var killDictionary = _killedTokenDictionary;\r\n var name = strTrim(tenantToken);\r\n if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {\r\n return true;\r\n }\r\n delete killDictionary[name];\r\n return false;\r\n };\r\n });\r\n }\r\n /**\r\n * Set the tenants that are to be killed along with the duration. If the duration is\r\n * a special value identifying that the tokens are too be killed for only this request, then\r\n * a array of tokens is returned.\r\n * @param killedTokens - Tokens that are too be marked to be killed.\r\n * @param killDuration - The duration for which the tokens are to be killed.\r\n * @returns The tokens that are killed only for this given request.\r\n */\r\n KillSwitch.prototype.setKillSwitchTenants = function (killTokens, killDuration) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return [];\r\n };\r\n /**\r\n * Determing if the given tenant token has been killed for the moment.\r\n * @param tenantToken - The token to be checked.\r\n * @returns True if token has been killed, false otherwise.\r\n */\r\n KillSwitch.prototype.isTenantKilled = function (tenantToken) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n return KillSwitch;\r\n}());\r\nexport { KillSwitch };\r\n//# sourceMappingURL=KillSwitch.js.map"],"names":[],"mappings":";;;;;AAAA;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;wDAoBM,CAAC;;;;;sBACe;AACtB;AACA;AACA"}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
import { mathFloor, mathMin } from "@nevware21/ts-utils";
/**
* RetryPolicy.ts
* @author Abhilash Panwar (abpanwar)
* @copyright Microsoft 2018
*/
var RandomizationLowerThreshold = 0.8;
var RandomizationUpperThreshold = 1.2;
var BaseBackoff = 3000;
var MaxBackoff = 600000;
/**
* Determine if the request should be retried for the given status code.
* The below expression reads that we should only retry for:
* - HttpStatusCodes that are smaller than 300.
* - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement
* and 505-HttpVersionNotSupport).
* - HttpStatusCode 408-RequestTimeout.
* - HttpStatusCode 429.
* This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class
* @param httpStatusCode - The status code returned for the request.
* @returns True if request should be retried, false otherwise.
*/
export function retryPolicyShouldRetryForStatus(httpStatusCode) {
/* tslint:disable:triple-equals */
// Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value
return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 429)
|| (httpStatusCode == 501)
|| (httpStatusCode == 505));
/* tslint:enable:triple-equals */
}
/**
* Gets the number of milliseconds to back off before retrying the request. The
* back off duration is exponentially scaled based on the number of retries already
* done for the request.
* @param retriesSoFar - The number of times the request has already been retried.
* @returns The back off duration for the request before it can be retried.
*/
export function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {
var waitDuration = 0;
var minBackoff = BaseBackoff * RandomizationLowerThreshold;
var maxBackoff = BaseBackoff * RandomizationUpperThreshold;
var randomBackoff = mathFloor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;
waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;
return mathMin(waitDuration, MaxBackoff);
}
//# sourceMappingURL=RetryPolicy.js.map
@@ -0,0 +1 @@
{"version":3,"file":"RetryPolicy.js.map","sources":["RetryPolicy.js"],"sourcesContent":["import { mathFloor, mathMin } from \"@nevware21/ts-utils\";\r\n/**\r\n* RetryPolicy.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar RandomizationLowerThreshold = 0.8;\r\nvar RandomizationUpperThreshold = 1.2;\r\nvar BaseBackoff = 3000;\r\nvar MaxBackoff = 600000;\r\n/**\r\n * Determine if the request should be retried for the given status code.\r\n * The below expression reads that we should only retry for:\r\n * - HttpStatusCodes that are smaller than 300.\r\n * - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement\r\n * and 505-HttpVersionNotSupport).\r\n * - HttpStatusCode 408-RequestTimeout.\r\n * - HttpStatusCode 429.\r\n * This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class\r\n * @param httpStatusCode - The status code returned for the request.\r\n * @returns True if request should be retried, false otherwise.\r\n */\r\nexport function retryPolicyShouldRetryForStatus(httpStatusCode) {\r\n /* tslint:disable:triple-equals */\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 429)\r\n || (httpStatusCode == 501)\r\n || (httpStatusCode == 505));\r\n /* tslint:enable:triple-equals */\r\n}\r\n/**\r\n * Gets the number of milliseconds to back off before retrying the request. The\r\n * back off duration is exponentially scaled based on the number of retries already\r\n * done for the request.\r\n * @param retriesSoFar - The number of times the request has already been retried.\r\n * @returns The back off duration for the request before it can be retried.\r\n */\r\nexport function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {\r\n var waitDuration = 0;\r\n var minBackoff = BaseBackoff * RandomizationLowerThreshold;\r\n var maxBackoff = BaseBackoff * RandomizationUpperThreshold;\r\n var randomBackoff = mathFloor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;\r\n waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;\r\n return mathMin(waitDuration, MaxBackoff);\r\n}\r\n//# sourceMappingURL=RetryPolicy.js.map"],"names":[],"mappings":";;;;;AAAA;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,360 @@
/*
* 1DS JS SDK POST plugin, 4.3.11
* Copyright (c) Microsoft and contributors. All rights reserved.
* (Microsoft Internal Only)
*/
/**
* Serializer.ts
* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)
* @copyright Microsoft 2018-2020
*/
// @skip-file-minify
import dynamicProto from "@microsoft/dynamicproto-js";
import { arrIndexOf, doPerf, getCommonSchemaMetaData, getTenantId, isArray, isValueAssigned, objForEachKey, sanitizeProperty, strStartsWith } from "@microsoft/1ds-core-js";
import { EventBatch } from "./EventBatch";
import { STR_EMPTY } from "./InternalConstants";
import { mathMin, strSubstr } from "@nevware21/ts-utils";
/**
* Note: This is an optimization for V8-based browsers. When V8 concatenates a string,
* the strings are only joined logically using a "cons string" or "constructed/concatenated
* string". These containers keep references to one another and can result in very large
* memory usage. For example, if a 2MB string is constructed by concatenating 4 bytes
* together at a time, the memory usage will be ~44MB; so ~22x increase. The strings are
* only joined together when an operation requiring their joining takes place, such as
* substr(). This function is called when adding data to this buffer to ensure these
* types of strings are periodically joined to reduce the memory footprint.
* Setting to every 20 events as the JSON.stringify() may have joined many strings
* and calling this too much causes a minor delay while processing.
*/
var _MAX_STRING_JOINS = 20;
// Max Size set by One Collector: https://msazure.visualstudio.com/OneDsCollector/_git/Collector?path=/Services/Azure/CollectorWorkerRoleAzure/ServiceConfiguration.Cloud.cscfg
var RequestSizeLimitBytes = 3145728; // approx 3.15 Mb
var BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)
var MaxRecordSize = 2000000; // approx 2 Mb
var MaxBeaconRecordSize = mathMin(MaxRecordSize, BeaconRequestSizeLimitBytes);
var metadata = "metadata";
var f = "f";
var rCheckDot = /\./;
/**
* Class to handle serialization of event and request.
* Currently uses Bond for serialization. Please note that this may be subject to change.
*/
var Serializer = /** @class */ (function () {
/**
* Constructs a new instance of the Serializer class
* @param perfManager - The performance manager to use for tracking performance
* @param valueSanitizer - The value sanitizer to use for sanitizing field values
* @param stringifyObjects - Should objects be stringified before being sent
* @param enableCompoundKey - Should compound keys be enabled (defaults to false)
* @param getEncodedTypeOverride - The callback to get the encoded type for a property defaults to ({@link getCommonSchemaMetaData }(...))
* @param excludeCsMetaData - (!DANGER!) Should metadata be populated when encoding the event blob (defaults to false) - PII data will NOT be tagged as PII for backend processing
* @param cfg channel cfg for setting request and record size limit
*/
function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey, getEncodedTypeOverride, excludeCsMetaData, cfg) {
var strData = "data";
var strBaseData = "baseData";
var strExt = "ext";
var _checkForCompoundkey = !!enableCompoundKey;
var _processSubKeys = true;
var _theSanitizer = valueSanitizer;
var _isReservedCache = {};
var _excludeCsMetaData = !!excludeCsMetaData;
var _getEncodedType = getEncodedTypeOverride || getCommonSchemaMetaData;
var _sizeCfg = _getSizeLimtCfg(cfg);
var _requestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, RequestSizeLimitBytes, 0);
var _beaconRequestSizeLimitBytes = _validateSizeLimit(_sizeCfg.requestLimit, BeaconRequestSizeLimitBytes, 1);
var _maxRecordSize = _validateSizeLimit(_sizeCfg.recordLimit, MaxRecordSize, 0);
var _maxBeaconRecordSize = Math.min(_validateSizeLimit(_sizeCfg.recordLimit, MaxBeaconRecordSize, 1), _beaconRequestSizeLimitBytes);
dynamicProto(Serializer, this, function (_self) {
_self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {
return {
apiKeys: [],
payloadBlob: STR_EMPTY,
overflow: null,
sizeExceed: [],
failedEvts: [],
batches: [],
numEvents: 0,
retryCnt: retryCnt,
isTeardown: isTeardown,
isSync: isSync,
isBeacon: isReducedPayload,
sendType: sendType,
sendReason: sendReason
};
};
_self.appendPayload = function (payload, theBatch, maxEventsPerBatch) {
var canAddEvents = payload && theBatch && !payload.overflow;
if (canAddEvents) {
doPerf(perfManager, function () { return "Serializer:appendPayload"; }, function () {
var theEvents = theBatch.events();
var payloadBlob = payload.payloadBlob;
var payloadEvents = payload.numEvents;
var eventsAdded = false;
var sizeExceeded = [];
var failedEvts = [];
var isBeaconPayload = payload.isBeacon;
var requestMaxSize = isBeaconPayload ? _beaconRequestSizeLimitBytes : _requestSizeLimitBytes;
var recordMaxSize = isBeaconPayload ? _maxBeaconRecordSize : _maxRecordSize;
var lp = 0;
var joinCount = 0;
while (lp < theEvents.length) {
var theEvent = theEvents[lp];
if (theEvent) {
if (payloadEvents >= maxEventsPerBatch) {
// Maximum events per payload reached, so don't add any more
payload.overflow = theBatch.split(lp);
break;
}
var eventBlob = _self.getEventBlob(theEvent);
if (eventBlob && eventBlob.length <= recordMaxSize) {
// This event will fit into the payload
var blobLength = eventBlob.length;
var currentSize = payloadBlob.length;
if (currentSize + blobLength > requestMaxSize) {
// Request or batch size exceeded, so don't add any more to the payload
payload.overflow = theBatch.split(lp);
break;
}
if (payloadBlob) {
payloadBlob += "\n";
}
payloadBlob += eventBlob;
joinCount++;
// v8 memory optimization only
if (joinCount > _MAX_STRING_JOINS) {
// this substr() should cause the constructed string to join
strSubstr(payloadBlob, 0, 1);
joinCount = 0;
}
eventsAdded = true;
payloadEvents++;
}
else {
if (eventBlob) {
// Single event size exceeded so remove from the batch
sizeExceeded.push(theEvent);
}
else {
failedEvts.push(theEvent);
}
// We also need to remove this event from the existing array, otherwise a notification will be sent
// indicating that it was successfully sent
theEvents.splice(lp, 1);
lp--;
}
}
lp++;
}
if (sizeExceeded.length > 0) {
payload.sizeExceed.push(EventBatch.create(theBatch.iKey(), sizeExceeded));
// Remove the exceeded events from the batch
}
if (failedEvts.length > 0) {
payload.failedEvts.push(EventBatch.create(theBatch.iKey(), failedEvts));
// Remove the failed events from the batch
}
if (eventsAdded) {
payload.batches.push(theBatch);
payload.payloadBlob = payloadBlob;
payload.numEvents = payloadEvents;
var apiKey = theBatch.iKey();
if (arrIndexOf(payload.apiKeys, apiKey) === -1) {
payload.apiKeys.push(apiKey);
}
}
}, function () { return ({ payload: payload, theBatch: { iKey: theBatch.iKey(), evts: theBatch.events() }, max: maxEventsPerBatch }); });
}
return canAddEvents;
};
_self.getEventBlob = function (eventData) {
try {
return doPerf(perfManager, function () { return "Serializer.getEventBlob"; }, function () {
var serializedEvent = {};
// Adding as dynamic keys for v8 performance
serializedEvent.name = eventData.name;
serializedEvent.time = eventData.time;
serializedEvent.ver = eventData.ver;
serializedEvent.iKey = "o:" + getTenantId(eventData.iKey);
// Assigning local var so usage in part b/c don't throw if there is no ext
var serializedExt = {};
var _addMetadataCallback;
if (!_excludeCsMetaData) {
_addMetadataCallback = function (pathKeys, key, value) {
_addJSONPropertyMetaData(_getEncodedType, serializedExt, pathKeys, key, value);
};
}
// Part A
var eventExt = eventData[strExt];
if (eventExt) {
// Only assign ext if the event had one (There are tests covering this use case)
serializedEvent[strExt] = serializedExt;
objForEachKey(eventExt, function (key, value) {
var data = serializedExt[key] = {};
// Don't include a metadata callback as we don't currently set metadata Part A fields
_processPathKeys(value, data, "ext." + key, true, null, null, true);
});
}
var serializedData = serializedEvent[strData] = {};
serializedData.baseType = eventData.baseType;
var serializedBaseData = serializedData[strBaseData] = {};
// Part B
_processPathKeys(eventData.baseData, serializedBaseData, strBaseData, false, [strBaseData], _addMetadataCallback, _processSubKeys);
// Part C
_processPathKeys(eventData.data, serializedData, strData, false, [], _addMetadataCallback, _processSubKeys);
return JSON.stringify(serializedEvent);
}, function () { return ({ item: eventData }); });
}
catch (e) {
return null;
}
};
function _isReservedField(path, name) {
var result = _isReservedCache[path];
if (result === undefined) {
if (path.length >= 7) {
// Do not allow the changing of fields located in the ext.metadata or ext.web extension
result = strStartsWith(path, "ext.metadata") || strStartsWith(path, "ext.web");
}
_isReservedCache[path] = result;
}
return result;
}
function _processPathKeys(srcObj, target, thePath, checkReserved, metadataPathKeys, metadataCallback, processSubKeys) {
objForEachKey(srcObj, function (key, srcValue) {
var prop = null;
if (srcValue || isValueAssigned(srcValue)) {
var path = thePath;
var name_1 = key;
var theMetaPathKeys = metadataPathKeys;
var destObj = target;
// Handle keys with embedded '.', like "TestObject.testProperty"
if (_checkForCompoundkey && !checkReserved && rCheckDot.test(key)) {
var subKeys = key.split(".");
var keyLen = subKeys.length;
if (keyLen > 1) {
if (theMetaPathKeys) {
// Create a copy of the meta path keys so we can add the extra ones
theMetaPathKeys = theMetaPathKeys.slice();
}
for (var lp = 0; lp < keyLen - 1; lp++) {
var subKey = subKeys[lp];
// Add/reuse the sub key object
destObj = destObj[subKey] = destObj[subKey] || {};
path += "." + subKey;
if (theMetaPathKeys) {
theMetaPathKeys.push(subKey);
}
}
name_1 = subKeys[keyLen - 1];
}
}
var isReserved = checkReserved && _isReservedField(path, name_1);
if (!isReserved && _theSanitizer && _theSanitizer.handleField(path, name_1)) {
prop = _theSanitizer.value(path, name_1, srcValue, stringifyObjects);
}
else {
prop = sanitizeProperty(name_1, srcValue, stringifyObjects);
}
if (prop) {
// Set the value
var newValue = prop.value;
destObj[name_1] = newValue;
if (metadataCallback) {
metadataCallback(theMetaPathKeys, name_1, prop);
}
if (processSubKeys && typeof newValue === "object" && !isArray(newValue)) {
var newPath = theMetaPathKeys;
if (newPath) {
newPath = newPath.slice();
newPath.push(name_1);
}
// Make sure we process sub objects as well (for value sanitization and metadata)
_processPathKeys(srcValue, newValue, path + "." + name_1, checkReserved, newPath, metadataCallback, processSubKeys);
}
}
}
});
}
});
}
// Removed Stub for Serializer.prototype.createPayload.
// Removed Stub for Serializer.prototype.appendPayload.
// Removed Stub for Serializer.prototype.getEventBlob.
// Removed Stub for Serializer.prototype.handleField.
// Removed Stub for Serializer.prototype.getSanitizer.
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
Serializer.__ieDyn=1;
return Serializer;
}());
export { Serializer };
function _validateSizeLimit(cfgVal, defaultVal, idx) {
if (isArray(cfgVal)) {
var val = cfgVal[idx];
if (val > 0 && val <= defaultVal) {
return val;
}
}
return defaultVal;
}
function _getSizeLimtCfg(cfg) {
var defaultCfg = {};
if (cfg && cfg.requestLimit) {
return cfg.requestLimit;
}
return defaultCfg;
}
/**
* @ignore
* @param getEncodedType - The function to get the encoded type for the property
* @param json - The json object to add the metadata to
* @param propKeys - The property keys to add to the metadata
* @param name - The name of the property
* @param propertyValue - The property value
*/
function _addJSONPropertyMetaData(getEncodedType, json, propKeys, name, propertyValue) {
if (propertyValue && json) {
var encodedTypeValue = getEncodedType(propertyValue.value, propertyValue.kind, propertyValue.propertyType);
if (encodedTypeValue > -1) {
// Add the root metadata
var metaData = json[metadata];
if (!metaData) {
// Sets the root 'f'
metaData = json[metadata] = { f: {} };
}
var metaTarget = metaData[f];
if (!metaTarget) {
// This can occur if someone has manually added an ext.metadata object
// Such as ext.metadata.privLevel and ext.metadata.privTags
metaTarget = metaData[f] = {};
}
// Traverse the metadata path and build each object (contains an 'f' key) -- if required
if (propKeys) {
for (var lp = 0; lp < propKeys.length; lp++) {
var key = propKeys[lp];
if (!metaTarget[key]) {
metaTarget[key] = { f: {} };
}
var newTarget = metaTarget[key][f];
if (!newTarget) {
// Not expected, but can occur if the metadata context was pre-created as part of the event
newTarget = metaTarget[key][f] = {};
}
metaTarget = newTarget;
}
}
metaTarget = metaTarget[name] = {};
if (isArray(propertyValue.value)) {
metaTarget["a"] = {
t: encodedTypeValue
};
}
else {
metaTarget["t"] = encodedTypeValue;
}
}
}
}
//# sourceMappingURL=Serializer.js.map
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More