From 925f18b4f3eab761d15fced3e3f491ea4425d0af Mon Sep 17 00:00:00 2001 From: Nev Wylie <54870357+MSNev@users.noreply.github.com> Date: Wed, 22 Feb 2023 18:51:26 -0800 Subject: [PATCH 1/2] [Beta] [BUG] SharedWorker does not Instrument fetch correctly #1996 - Also add a Shared Worker example --- README.md | 8 +- examples/README.md | 31 +++ examples/shared-worker/README.md | 49 +++++ examples/shared-worker/SharedWorker.html | 124 +++++++++++ examples/shared-worker/package.json | 71 ++++++ examples/shared-worker/rollup.config.js | 102 +++++++++ .../src/example-shared-worker.ts | 208 ++++++++++++++++++ .../src/interfaces/IExampleMessage.ts | 31 +++ examples/shared-worker/src/worker-npm-init.ts | 61 +++++ examples/shared-worker/src/worker.ts | 173 +++++++++++++++ examples/shared-worker/src/worker2.ts | 83 +++++++ examples/shared-worker/tsconfig.json | 26 +++ rush.json | 5 + shared/AppInsightsCore/README.md | 3 +- .../src/JavaScriptSDK/InstrumentHooks.ts | 19 +- tools/release-tools/setVersion.js | 4 + 16 files changed, 985 insertions(+), 13 deletions(-) create mode 100644 examples/README.md create mode 100644 examples/shared-worker/README.md create mode 100644 examples/shared-worker/SharedWorker.html create mode 100644 examples/shared-worker/package.json create mode 100644 examples/shared-worker/rollup.config.js create mode 100644 examples/shared-worker/src/example-shared-worker.ts create mode 100644 examples/shared-worker/src/interfaces/IExampleMessage.ts create mode 100644 examples/shared-worker/src/worker-npm-init.ts create mode 100644 examples/shared-worker/src/worker.ts create mode 100644 examples/shared-worker/src/worker2.ts create mode 100644 examples/shared-worker/tsconfig.json diff --git a/README.md b/README.md index 42bd8c80..9104b2f1 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ ms.topic="article" ms.date="08/24/2015"/> -[![Build Status](https://dev.azure.com/mseng/AppInsights/_apis/build/status/AppInsights%20-%20DevTools/1DS%20JavaScript%20SDK%20web%20SKU%20vNext?branchName=master)](https://dev.azure.com/mseng/AppInsights/_build/latest?definitionId=8184&branchName=master) -[![Build Status](https://travis-ci.org/microsoft/ApplicationInsights-JS.svg?branch=master)](https://travis-ci.org/microsoft/ApplicationInsights-JS) +![GitHub Workflow Status (main)](https://img.shields.io/github/actions/workflow/status/microsoft/ApplicationInsights-JS/ci.yml?branch=master) [![npm version](https://badge.fury.io/js/%40microsoft%2Fapplicationinsights-web.svg)](https://badge.fury.io/js/%40microsoft%2Fapplicationinsights-web) -[![minified size size](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?label=minified%20size)](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?label=minified%20size) -[![gzip size](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?compression=gzip&softmax=30000&max=35000)](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?compression=gzip&softmax=30000&max=35000) +[![Build Status](https://dev.azure.com/mseng/AppInsights/_apis/build/status/AppInsights%20-%20DevTools/1DS%20JavaScript%20SDK%20web%20SKU%20vNext?branchName=master)](https://dev.azure.com/mseng/AppInsights/_build/latest?definitionId=8184&branchName=master) +[![minified size size](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?label=minified%20size)](https://js.monitor.azure.com/scripts/b/ai.2.min.js) +[![gzip size](https://img.badgesize.io/https://js.monitor.azure.com/scripts/b/ai.2.min.js.svg?compression=gzip&softmax=30000&max=35000)](https://js.monitor.azure.com/scripts/b/ai.2.min.js) > ***Note:*** The documentation for `applicationinsights-js@1.0.20` has moved [here](./legacy/README.md). If you are looking to upgrade to the new version of the SDK, please see the [Upgrade Guide](#upgrading-from-the-old-version-of-application-insights). diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..6a9799ef --- /dev/null +++ b/examples/README.md @@ -0,0 +1,31 @@ +# Microsoft Application Insights JavaScript SDK Examples + +A collection of examples using the ApplicationInsights SDK, these examples are compiled as part of every build (unless otherwise stated), +but may not be executed as part of any automated test pass -- this may change/vary. + +## Examples + +[Shared Worker](./shared-worker/README.md) + +## 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. + +## 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 [Microsoft’s 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-party’s policies. + +## License + +[MIT](LICENSE) diff --git a/examples/shared-worker/README.md b/examples/shared-worker/README.md new file mode 100644 index 00000000..520ee0a7 --- /dev/null +++ b/examples/shared-worker/README.md @@ -0,0 +1,49 @@ +# Microsoft Application Insights JavaScript SDK Example - Shared Worker + +![GitHub Workflow Status (main)](https://img.shields.io/github/actions/workflow/status/microsoft/ApplicationInsights-JS/ci.yml?branch=master) + +Example to instrument a Shared-Worker + +## Simple Instrumented Shared Worker Example + +This is a simple example that uses 2 Shared Workers as defined by +- [worker.ts](./src/worker.ts) +- [worker2.ts](./src/worker2.ts) + +You WILL NEED to have compiled the repository before running this example as it loads the compiled scripts, and you will also NEED to start the +local web server via `npm run serve` from the root of repository. + +You can load the Shared Worker example via the [SharedWorker.html](SharedWorker.html). + +This implements a VERY simple Shared Worker example that passes messages between the +current page and the workers using the type in the [IExampleMessage](./src/interfaces/IExampleMessage.ts), +And the support functions for the Web page are located in [example-shared-worker.ts](./src/example-shared-worker.ts) + +## 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. + +## 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 Microsoft’s 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 [Microsoft’s 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-party’s policies. + +## License + +[MIT](LICENSE) diff --git a/examples/shared-worker/SharedWorker.html b/examples/shared-worker/SharedWorker.html new file mode 100644 index 00000000..87ff6660 --- /dev/null +++ b/examples/shared-worker/SharedWorker.html @@ -0,0 +1,124 @@ + + + + + +

Simple Instrumented Shared Worker Example

+

Please make sure that you have compiled the repository before running this example as it loads the compiled scripts.

+

This script also needs to be run from the hosted `localhost` instance which can be started by running
> npm run serve
+ from the root folder of the repository. +

+

+ And then re-laoding this page from http://localhost:9001/examples/shared-worker/SharedWorker.html +

+

+ Work is sent to the worker(s) and any responses are returned and displayed on the main console, if you want to inspect + the console of the workers you can access and debug the worker code via these links. You will need to manually open as accessing + local resources is generally prohibited. +

+

+
+

Worker 1 - Instrumented

+

You must use the Initialize SDK button at least once to initialize Application Insights within the worker. + The Unload SDK will cause the SDK instance in the worker to unload and this will disable the reporting of fetch calls.
+ Once the SDK in initialized it will report back when events are sent from the Workers SDK instance. +

+
+
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+ +
+ +
+
+
+
+
+
+ This will cause the worker (if the SDK is initialized) to send a RemoteDependency event. +
+ (Contents will be sent to the main page console via a post) +
+
+
+
+
+
+
+ This will cause the worker (if the SDK is initialized) to send a new PageView event. +
+ +
+
+
+
+
+
+
+ Send an invalid request to the worker +
+ +
+
+
+
+

This is the information returned by the worker, when the SDK is initialized you will see an "Events Sent" + message when the SDK has sent the events to Azure Monitor, if the connection string is valid you will + see the generated events in the Azure Monitor Portal. +

+ + +
+
+
+

Worker 2 - Not Instrumented

+
+
+
+
+ +
+ +
+
+
+
+ (Contents will be sent to the main page console via a post) +
+
+
+
+
+
+ Send an invalid request to the worker +
+ +
+
+
+
+

This is the information returned by the worker 2. +

+ + +
+
+ + \ No newline at end of file diff --git a/examples/shared-worker/package.json b/examples/shared-worker/package.json new file mode 100644 index 00000000..3f936302 --- /dev/null +++ b/examples/shared-worker/package.json @@ -0,0 +1,71 @@ +{ + "name": "@microsoft/applicationinsights-example-shared-worker", + "author": "Microsoft Application Insights Team", + "version": "2.8.10", + "description": "Microsoft Application Insights Shared Worker Example", + "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme", + "keywords": [ + "azure", + "cloud", + "script errors", + "microsoft", + "application insights", + "browser performance monitoring", + "web analytics", + "example" + ], + "main": "dist/applicationinsights-example-shared-worker.js", + "module": "dist-esm/applicationinsights-example-shared-worker.js", + "types": "types/applicationinsights-example-shared-worker.d.ts", + "scripts": { + "clean": "grunt clean", + "build": "npm run build:esm && npm run build:browser", + "build:esm": "grunt example-shared-worker", + "build:browser": "rollup -c rollup.config.js", + "rebuild": "npm run build", + "test": "", + "mintest": "", + "perftest": "", + "lint": "tslint -p tsconfig.json", + "ai-min": "grunt example-shared-worker-min", + "ai-restore": "grunt example-shared-worker-restore" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore" + }, + "license": "MIT", + "sideEffects": false, + "devDependencies": { + "@microsoft/ai-test-framework": "0.0.1", + "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0", + "@microsoft/applicationinsights-rollup-es5": "1.0.0", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "grunt-contrib-qunit": "^6.2.1", + "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/grunt-eslint-ts": "^0.2.2", + "globby": "^11.0.0", + "magic-string": "^0.25.7", + "pako": "^2.0.3", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "rollup-plugin-cleanup": "^3.2.1", + "rollup": "^2.32.0", + "typescript": "^4.9.3", + "tslib": "^2.0.0", + "qunit": "^2.11.2", + "sinon": "^7.3.1" + }, + "peerDependencies": { + "tslib": "*" + }, + "dependencies": { + "@microsoft/applicationinsights-shims": "2.0.2", + "@microsoft/dynamicproto-js": "^1.1.7", + "@microsoft/applicationinsights-web": "2.8.10", + "@microsoft/applicationinsights-web-snippet": "1.0.1", + "@nevware21/ts-utils": ">= 0.7 < 2.x" + } +} diff --git a/examples/shared-worker/rollup.config.js b/examples/shared-worker/rollup.config.js new file mode 100644 index 00000000..fb5c8534 --- /dev/null +++ b/examples/shared-worker/rollup.config.js @@ -0,0 +1,102 @@ +import nodeResolve from "@rollup/plugin-node-resolve"; +import { uglify } from "@microsoft/applicationinsights-rollup-plugin-uglify3-js"; +import replace from "@rollup/plugin-replace"; +import cleanup from "rollup-plugin-cleanup"; +import dynamicRemove from "@microsoft/dynamicproto-js/tools/rollup/node/removedynamic"; +import { es5Poly, es5Check, importCheck } from "@microsoft/applicationinsights-rollup-es5"; +import { updateDistEsmFiles } from "../../tools/updateDistEsm/updateDistEsm"; + +const version = require("./package.json").version; +const workerName = "example-shared-worker"; +const workerModule = "worker"; +const worker2Module = "worker2"; +const banner = [ + "/*!", + ` * Application Insights JavaScript SDK Example - Shared Worker, ${version}`, + " * Copyright (c) Microsoft and contributors. All rights reserved.", + " */" +].join("\n"); + +const replaceValues = { + "// Copyright (c) Microsoft Corporation. All rights reserved.": "", + "// Licensed under the MIT License.": "" +}; + +function doCleanup() { + return cleanup({ + comments: [ + 'some', + /^.\s*@DynamicProtoStub/i, + /^\*\*\s*@class\s*$/ + ] + }) +} + +const browserRollupConfigFactory = (name, isProduction, format = "umd", extension = "") => { + const browserRollupConfig = { + input: `dist-esm/${name}.js`, + output: { + file: `browser/${name}${extension ? "." +extension : ""}.js`, + banner: banner, + format: format, + name: "Microsoft.ApplicationInsights.Example", + extend: true, + freeze: false, + sourcemap: true + }, + treeshake: { + propertyReadSideEffects: false, + moduleSideEffects: false, + tryCatchDeoptimization: false, + correctVarValueBeforeDeclaration: false + }, + plugins: [ + dynamicRemove(), + replace({ + preventAssignment: true, + delimiters: ["", ""], + values: replaceValues + }), + // This just makes sure we are importing the example dependencies correctly + importCheck({ exclude: [ "applicationinsights-example-shared-worker" ] }), + nodeResolve({ + module: true, + browser: true, + preferBuiltins: false + }), + doCleanup(), + es5Poly(), + es5Check() + ] + }; + + if (isProduction) { + browserRollupConfig.output.file = `browser/${name}${extension ? "." +extension : ""}.min.js`; + browserRollupConfig.plugins.push( + uglify({ + ie8: false, + ie: true, + compress: { + ie: true, + passes:3, + unsafe: true, + }, + output: { + ie: true, + preamble: banner, + webkit:true + } + }) + ); + } + + return browserRollupConfig; +}; + +updateDistEsmFiles(replaceValues, banner); + +export default [ + browserRollupConfigFactory(workerName, false, "iife", "gbl"), + browserRollupConfigFactory(workerModule, false, "esm"), + browserRollupConfigFactory(worker2Module, false, "esm") +]; diff --git a/examples/shared-worker/src/example-shared-worker.ts b/examples/shared-worker/src/example-shared-worker.ts new file mode 100644 index 00000000..ec9ae50c --- /dev/null +++ b/examples/shared-worker/src/example-shared-worker.ts @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { getDocument } from "@nevware21/ts-utils"; +import { ExampleMessageType, IExampleRequest } from "./interfaces/IExampleMessage"; + + +let _logContainers = { + log: "", + log2: "" +}; +let _worker: SharedWorker; +let _worker2: SharedWorker; + + +//------------------------------------------------------------------------------------- +// Main Page Helper functions +//------------------------------------------------------------------------------------- + +/** + * Log details to the named HTML Text Area + * @param message + * @param dest + */ +function logMessage(message: string, dest: keyof typeof _logContainers) { + var dateTime = new Date().toLocaleString(); + var target = "_logContainer-" + dest || "log"; + var elm = document.getElementById(target); + _logContainers[target] = dateTime + ": " + message + "\n" + (_logContainers[target] ||""); + if (_logContainers[target].length > 4096) { + _logContainers[target] = _logContainers[target].substring(0, 4090) + "...\n"; + } + + if (elm) { + elm.innerHTML = _logContainers[target]; + } + + console.log(message); +} + +/** + * Clear the log and the named HTML Text Area + * @param dest + */ +export function clearLog(dest: keyof typeof _logContainers) { + var target = "_logContainer-" + dest || "log"; + var elm = document.getElementById(target); + _logContainers[target] = ""; + + if (elm) { + elm.innerHTML = _logContainers[target]; + } +} + +//------------------------------------------------------------------------------------- +// Worker 1 functions for main page +//------------------------------------------------------------------------------------- + +/** + * Cause Worker 1 to be loaded and started or return the previous loaded / started reference + * @returns + */ +export function loadSharedWorker() { + if (!_worker) { + _worker = new SharedWorker("./browser/worker.js"); + _worker.port.onmessage = (evt) => { + let resp = evt.data; + if (resp) { + logMessage(JSON.stringify(resp), "log"); + } + } + } + + return _worker; +} + +/** + * Send a message to Worker 1, this will initialize the worker if has not already been started + * @param message + */ +export function sendWorkerMessage(message: IExampleRequest) { + let worker = loadSharedWorker(); + worker.port.postMessage(message); +} + +/** + * Ask Worker 1 to initialize the SDK + * @param connectionStringId + */ +export function loadSdk(connectionStringId: string) { + let doc = getDocument(); + let elm = doc.getElementById(connectionStringId) as HTMLInputElement; + let connectionString: string; + + if (elm) { + connectionString = elm.value; + } + + sendWorkerMessage({ + type: ExampleMessageType.Load, + connectionString: connectionString + }); +} + +/** + * Ask Worker 1 to unload the SDK + */ +export function unloadSdk() { + sendWorkerMessage({ + type: ExampleMessageType.Unload + }); +} + +/** + * Ask Worker 1 to fetch the provided URL (this will cause the worker fetch to trigger a Dependency Request) + * @param urlId + */ +export function fetchUrl(urlId: string) { + let doc = getDocument(); + let elm = doc.getElementById(urlId) as HTMLInputElement; + let theUrl: string; + + if (elm) { + theUrl = elm.value; + } + + sendWorkerMessage({ + type: ExampleMessageType.Fetch, + url: theUrl + }); +} + +/** + * Ask Worker 1 to perform a track Page view + */ +export function trackPageView() { + sendWorkerMessage({ + type: ExampleMessageType.TrackPageView + }); +} + +/** + * Send an invalid request to Worker 1 + */ +export function sendInvalidRequest() { + sendWorkerMessage({ + type: 9999 + }); +} + +//------------------------------------------------------------------------------------- +// Worker 2 functions for main page +//------------------------------------------------------------------------------------- + +/** + * Cause Worker 2 to be loaded and started or return the previous loaded / started reference + * @returns + */ +export function loadSharedWorker2() { + if (!_worker2) { + _worker2 = new SharedWorker("./browser/worker2.js"); + _worker2.port.onmessage = (evt) => { + let resp = evt.data; + if (resp) { + logMessage(JSON.stringify(resp), "log2"); + } + } + } + + return _worker2; +} + +/** + * Send a message to Worker 2, this will initialize the worker if has not already been started + * @param message + */ +export function sendWorker2Message(message: IExampleRequest) { + let worker = loadSharedWorker2(); + worker.port.postMessage(message); +} + +/** + * Ask Worker 2 to fetch the provided URL (this will cause the worker fetch to trigger a Dependency Request) + * @param urlId + */ +export function fetch2Url(urlId: string) { + let doc = getDocument(); + let elm = doc.getElementById(urlId) as HTMLInputElement; + let theUrl: string; + + if (elm) { + theUrl = elm.value; + } + + sendWorker2Message({ + type: ExampleMessageType.Fetch, + url: theUrl + }); +} + +/** + * Send an invalid request to Worker 2 + */ +export function sendInvalidRequest2() { + sendWorker2Message({ + type: 9999 + }); +} diff --git a/examples/shared-worker/src/interfaces/IExampleMessage.ts b/examples/shared-worker/src/interfaces/IExampleMessage.ts new file mode 100644 index 00000000..7be60c7d --- /dev/null +++ b/examples/shared-worker/src/interfaces/IExampleMessage.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Enum to identify the examples support messages + */ +export const enum ExampleMessageType { + Invalid = 0, + Load = 1, + Unload = 2, + Fetch = 3, + TrackPageView = 4 +} + +/** + * The format of a request to the example workers + */ +export interface IExampleRequest { + type: ExampleMessageType; + connectionString?: string; + url?: string; +} + +/** + * The format of the response returned from the workers + */ +export interface IExampleResponse { + success: boolean; + message?: string; + resp?: string; +} \ No newline at end of file diff --git a/examples/shared-worker/src/worker-npm-init.ts b/examples/shared-worker/src/worker-npm-init.ts new file mode 100644 index 00000000..79a95640 --- /dev/null +++ b/examples/shared-worker/src/worker-npm-init.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { ApplicationInsights, IConfiguration } from "@microsoft/applicationinsights-web" + +// Cache the previously initialized instance to avoid creating multiple instances +let _appInsights: ApplicationInsights; + +/** + * Initialize (or return the previously initialized) SDK instance for the worker + * @param config + * @returns + */ +export function initApplicationInsights(config: IConfiguration) { + + if (!_appInsights) { + // Make sure we have a configuration object + config = config || {}; + if (!config.instrumentationKey || !config.connectionString) { + config.connectionString = "InstrumentationKey=YOUR_INSTRUMENTATION_KEY_GOES_HERE"; + } + + _appInsights = new ApplicationInsights({ + config: config + }); + + _appInsights.loadAppInsights(); + _appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview + + return _appInsights; + } + + return _appInsights; +} + +/** + * Unload the SDK if it has been initialized + * @returns + */ +export function unloadApplicationInsights() { + if (_appInsights) { + _appInsights.unload(); + _appInsights = null; + return true; + } + + return false; +} + +/** + * Request a page view request if the SDK has been initialized + * @returns + */ +export function trackPageView() { + if (_appInsights) { + _appInsights.trackPageView(); + return true; + } + + return false; +} \ No newline at end of file diff --git a/examples/shared-worker/src/worker.ts b/examples/shared-worker/src/worker.ts new file mode 100644 index 00000000..a601fb70 --- /dev/null +++ b/examples/shared-worker/src/worker.ts @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { initApplicationInsights, trackPageView, unloadApplicationInsights } from "./worker-npm-init"; +import { ExampleMessageType, IExampleRequest, IExampleResponse } from "./interfaces/IExampleMessage"; +import { IConfiguration, INotificationListener } from "@microsoft/applicationinsights-web"; +import { dumpObj, objAssign } from "@nevware21/ts-utils"; + +/** + * Default base configuration, add your defaults here. + * Or simply specify your entire configuration and don't have the main page pass + * the connection string. + */ +const defaultApplicationInsightsConfig: IConfiguration = { + +}; + +/** + * Simple lookup table which matches the request type to the function that will process the request + */ +const EventHandlers: { [key: number]: (request: IExampleRequest, port: MessagePort) => IExampleResponse } = { + [ExampleMessageType.Invalid]: workerInvalid, + [ExampleMessageType.Load]: workerLoadSdk, + [ExampleMessageType.Unload]: workerUnloadSdk, + [ExampleMessageType.Fetch]: workerFetch, + [ExampleMessageType.TrackPageView]: workerTrackPageView +}; + +/** + * The main shared worker entry point + */ +addEventListener("connect", (evt: MessageEvent) => { + const port = evt.ports[0]; + + // Add the message listener + port.addEventListener("message", (evt: MessageEvent) => { + const request = evt.data; + if (!request || !request.type) { + // doesn't look correct + port.postMessage(workerInvalid(request)); + return; + } + + console.log(`Worker: Received message [${request.type}] from main script`); + let handler: (request: IExampleRequest, port: MessagePort) => IExampleResponse = EventHandlers[request.type]; + if (!handler) { + handler = workerInvalid; + } + + try { + let response = handler(request, port); + if (response) { + port.postMessage(response); + } + } catch (e) { + port.postMessage({ + success: false, + message: dumpObj(e) + }); + } + }); + + port.start(); +}); + +/** + * Handle "Invalid" (Unknown) request + * @param request + * @returns + */ +function workerInvalid(request: IExampleRequest) { + return { + success: false, + message: `Unsupported command - ${request ? request.type : "Invalid Request"}` + } +} + +/** + * Internal hook to listen to the events send notification from the Application Insights Sender + * @param port + * @returns + */ +function notificationListener(port: MessagePort): INotificationListener { + return { + eventsSendRequest: function () { + port.postMessage({ + success: true, + message: `Events Sent: ${dumpObj(arguments)}` + }); + } + }; +} + +/** + * Initialize the SDK using the passed connection string from the request (if supplied) + * @param request + * @param port + * @returns + */ +function workerLoadSdk(request: IExampleRequest, port: MessagePort) { + let theConfig = objAssign({}, defaultApplicationInsightsConfig); + theConfig.connectionString = request.connectionString; + let appInsights = initApplicationInsights(theConfig); + if (appInsights && appInsights.core.isInitialized()) { + appInsights.core.getNotifyMgr().addNotificationListener(notificationListener(port)); + return { + success: true, + message: `SDK Loaded and Initialized with - ${appInsights.config.connectionString}` + }; + } + + return { + success: true, + message: "SDK Failed to initialize" + }; +} + +/** + * Unload the SDK instance + * @param request + * @returns + */ +function workerUnloadSdk(request: IExampleRequest) { + if (unloadApplicationInsights()) { + return { + success: true, + message: "SDK Unloading" + }; + } + + return { + success: true, + message: "SDK Already unloaded" + }; +} + + +/** + * Perform a "fetch" request for the provided URL + * @param request + * @param port + * @returns + */ +function workerFetch(request: IExampleRequest, port: MessagePort) { + function fetchFailed(reason: any) { + port.postMessage({ success: false, message: dumpObj(reason) }); + } + + fetch(request.url).then((value) => { + value.text().then((theResponse) => { + port.postMessage({ success: true, resp: theResponse }); + }, fetchFailed); + }, fetchFailed); + + // Will return message asynchronously + return { + success: true, + message: "Fetch request received" + }; +} + +/** + * Attempt to send a PageView event (if the SDK is initialized) + * @param request + * @param port + * @returns + */ +function workerTrackPageView(request: IExampleRequest, port: MessagePort) { + return { + success: trackPageView(), + message: "TrackPageView requested" + }; +} diff --git a/examples/shared-worker/src/worker2.ts b/examples/shared-worker/src/worker2.ts new file mode 100644 index 00000000..ec4d7e5f --- /dev/null +++ b/examples/shared-worker/src/worker2.ts @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { ExampleMessageType, IExampleRequest, IExampleResponse } from "./interfaces/IExampleMessage"; +import { dumpObj } from "@nevware21/ts-utils"; + +const EventHandlers: { [key: number]: (request: IExampleRequest, port: MessagePort) => IExampleResponse } = { + [ExampleMessageType.Invalid]: workerInvalid, + [ExampleMessageType.Fetch]: workerFetch +}; + +/** + * The main shared worker entry point + */ +addEventListener("connect", (evt: MessageEvent) => { + const port = evt.ports[0]; + + // Add the message listener + port.addEventListener("message", (evt: MessageEvent) => { + const request = evt.data; + if (!request || !request.type) { + // doesn't look correct + console.log("Worker2: Invalid message received -- ignoring!"); + return; + } + + console.log(`Worker2: Received message [${request.type}] from main script`); + let handler: (request: IExampleRequest, port: MessagePort) => IExampleResponse = EventHandlers[request.type]; + if (!handler) { + handler = workerInvalid; + } + + try { + let response = handler(request, port); + if (response) { + port.postMessage(response); + } + } catch (e) { + port.postMessage({ + success: false, + message: dumpObj(e) + }); + } + }); + + port.start(); +}); + +/** + * Handle "Invalid" (Unknown) request + * @param request + * @returns + */ +function workerInvalid(request: IExampleRequest) { + return { + success: false, + message: `Unsupported commend - ${request.type}` + } +} + +/** + * Perform a "fetch" request for the provided URL + * @param request + * @param port + * @returns + */ +function workerFetch(request: IExampleRequest, port: MessagePort) { + function fetchFailed(reason: any) { + port.postMessage({ success: false, message: dumpObj(reason) }); + } + + fetch(request.url).then((value) => { + value.text().then((theResponse) => { + port.postMessage({ success: true, resp: theResponse }); + }, fetchFailed); + }, fetchFailed); + + // Will return message asynchronously + return { + success: true, + message: "Worker2: Fetch request received" + }; +} diff --git a/examples/shared-worker/tsconfig.json b/examples/shared-worker/tsconfig.json new file mode 100644 index 00000000..fc59e55c --- /dev/null +++ b/examples/shared-worker/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "sourceMap": true, + "inlineSources": true, + "noImplicitAny": true, + "module": "es6", + "moduleResolution": "node", + "target": "es5", + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "noEmitHelpers": true, + "skipLibCheck": false, + "alwaysStrict": true, + "skipDefaultLibCheck": true, + "declaration": true, + "declarationDir": "./types", + "outDir": "./dist-esm", + "rootDir": "./src", + "suppressImplicitAnyIndexErrors": true, + "allowSyntheticDefaultImports": true + }, + "include": [ + "src/**/*" + ], + "exclude": ["node_modules/"] +} diff --git a/rush.json b/rush.json index 93a5803b..273a63e0 100644 --- a/rush.json +++ b/rush.json @@ -98,6 +98,11 @@ "packageName": "applicationinsights-web-config", "projectFolder": "tools/config", "shouldPublish": false + }, + { + "packageName": "@microsoft/applicationinsights-example-shared-worker", + "projectFolder": "examples/shared-worker", + "shouldPublish": false } ] } diff --git a/shared/AppInsightsCore/README.md b/shared/AppInsightsCore/README.md index 5ac7e7bf..10adafcf 100644 --- a/shared/AppInsightsCore/README.md +++ b/shared/AppInsightsCore/README.md @@ -2,7 +2,8 @@ # Microsoft Application Insights JavaScript SDK - Core -[![Build Status](https://travis-ci.org/microsoft/applicationinsights-core-js.svg?branch=master)](https://travis-ci.org/microsoft/applicationinsights-core-js) [![Build status](https://dev.azure.com/mseng/AppInsights/_apis/build/status/AppInsights%20-%20DevTools/1DS%20JavaScript%20SDK%20-%20Core)](https://dev.azure.com/mseng/AppInsights/_build/latest?definitionId=7605) +![GitHub Workflow Status (main)](https://img.shields.io/github/actions/workflow/status/microsoft/ApplicationInsights-JS/ci.yml?branch=master) +[![npm version](https://badge.fury.io/js/%40microsoft%2Fapplicationinsights-core-js.svg)](https://badge.fury.io/js/%40microsoft%2Fapplicationinsights-core-js) Core SDK layer for next version of application insights javascript SDK. diff --git a/shared/AppInsightsCore/src/JavaScriptSDK/InstrumentHooks.ts b/shared/AppInsightsCore/src/JavaScriptSDK/InstrumentHooks.ts index 533f2aac..82ee063a 100644 --- a/shared/AppInsightsCore/src/JavaScriptSDK/InstrumentHooks.ts +++ b/shared/AppInsightsCore/src/JavaScriptSDK/InstrumentHooks.ts @@ -131,13 +131,13 @@ function _createFunctionHook(aiHook:IInstrumentHooks) { /** @ignore */ -function _getOwner(target:any, name:string, checkPrototype: boolean): any { +function _getOwner(target:any, name:string, checkPrototype: boolean, checkParentProto: boolean): any { let owner = null; if (target) { if (hasOwnProperty(target, name)) { owner = target; } else if (checkPrototype) { - owner = _getOwner(_getObjProto(target), name, false); + owner = _getOwner(_getObjProto(target), name, checkParentProto, false); } } @@ -219,10 +219,11 @@ function _createInstrumentHook(owner: any, funcName: string, fn: any, callbacks: * @param funcName - The function name * @param callbacks - The callbacks to configure and call whenever the function is called * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function + * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype */ -export function InstrumentFunc(target:any, funcName:string, callbacks: IInstrumentHooksCallbacks, checkPrototype:boolean = true): IInstrumentHook { +export function InstrumentFunc(target:any, funcName:string, callbacks: IInstrumentHooksCallbacks, checkPrototype: boolean = true, checkParentProto?: boolean): IInstrumentHook { if (target && funcName && callbacks) { - let owner = _getOwner(target, funcName, checkPrototype); + let owner = _getOwner(target, funcName, checkPrototype, checkParentProto); if (owner) { let fn = owner[funcName] if (typeof fn === strShimFunction) { @@ -240,11 +241,12 @@ export function InstrumentFunc(target:any, funcName:string, callbacks: IInstrume * @param funcNames - The function names to intercept and call * @param callbacks - The callbacks to configure and call whenever the function is called * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function + * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype */ -export function InstrumentFuncs(target:any, funcNames:string[], callbacks: IInstrumentHooksCallbacks, checkPrototype:boolean = true): IInstrumentHook[] { +export function InstrumentFuncs(target:any, funcNames:string[], callbacks: IInstrumentHooksCallbacks, checkPrototype:boolean = true, checkParentProto?: boolean): IInstrumentHook[] { let hooks: IInstrumentHook[] = null; _arrLoop(funcNames, (funcName) => { - let hook = InstrumentFunc(target, funcName, callbacks, checkPrototype); + let hook = InstrumentFunc(target, funcName, callbacks, checkPrototype, checkParentProto); if (hook) { if (!hooks) { hooks = []; @@ -264,10 +266,11 @@ export function InstrumentFuncs(target:any, funcNames:string[], callbacks: IInst * @param evtName - The name of the event * @param callbacks - The callbacks to configure and call whenever the function is called * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function + * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype */ -export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook { +export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean, checkParentProto?: boolean): IInstrumentHook { if (target && evtName && callbacks) { - let owner = _getOwner(target, evtName, checkPrototype) || target; + let owner = _getOwner(target, evtName, checkPrototype, checkParentProto) || target; if (owner) { return _createInstrumentHook(owner, evtName, owner[evtName], callbacks); } diff --git a/tools/release-tools/setVersion.js b/tools/release-tools/setVersion.js index 6b13d229..7078e9dc 100644 --- a/tools/release-tools/setVersion.js +++ b/tools/release-tools/setVersion.js @@ -365,6 +365,10 @@ function shouldProcess(name) { return updateDefPkgs; } + if (name.indexOf("examples/") !== -1) { + return updateDefPkgs; + } + if (name.indexOf("extensions/") !== -1) { return updateDefPkgs; } From 245a69062eb359e01bc95a46a30206d0d619069b Mon Sep 17 00:00:00 2001 From: Nev Wylie <54870357+MSNev@users.noreply.github.com> Date: Fri, 24 Feb 2023 15:13:29 -0800 Subject: [PATCH 2/2] [BUG] App Insights not auto-capturing from a Web Worker #1995 --- common/config/rush/npm-shrinkwrap.json | 701 ++++++++---------- examples/shared-worker/package.json | 2 +- examples/shared-worker/rollup.config.js | 6 +- examples/shared-worker/src/worker-npm-init.ts | 8 +- examples/shared-worker/src/worker.ts | 41 +- .../Telemetry/PageViewManager.ts | 29 +- .../src/ajax.ts | 19 +- gruntfile.js | 10 +- 8 files changed, 421 insertions(+), 395 deletions(-) diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index 722708cc..3d05ad69 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -13,6 +13,7 @@ "@nevware21/grunt-eslint-ts": "^0.2.2", "@nevware21/grunt-ts-plugin": "^0.4.3", "@nevware21/ts-async": "^0.1.0", + "@nevware21/ts-utils": ">= 0.7 < 2.x", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "@rollup/plugin-replace": "^2.3.3", @@ -25,6 +26,7 @@ "@rush-temp/applicationinsights-core-js": "file:./projects/applicationinsights-core-js.tgz", "@rush-temp/applicationinsights-debugplugin-js": "file:./projects/applicationinsights-debugplugin-js.tgz", "@rush-temp/applicationinsights-dependencies-js": "file:./projects/applicationinsights-dependencies-js.tgz", + "@rush-temp/applicationinsights-example-shared-worker": "file:./projects/applicationinsights-example-shared-worker.tgz", "@rush-temp/applicationinsights-js-release-tools": "file:./projects/applicationinsights-js-release-tools.tgz", "@rush-temp/applicationinsights-perfmarkmeasure-js": "file:./projects/applicationinsights-perfmarkmeasure-js.tgz", "@rush-temp/applicationinsights-properties-js": "file:./projects/applicationinsights-properties-js.tgz", @@ -223,16 +225,16 @@ "peer": true }, "node_modules/@microsoft/api-extractor": { - "version": "7.34.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.2.tgz", - "integrity": "sha512-oREyUU7p3JgjrqapJxEHe83gA1SXOWgaA4XCiY9PvsiLkgGHtn2ibTRgw9GCI/4kZzcb+OQv5waUDxsnQSKfwQ==", + "version": "7.34.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.4.tgz", + "integrity": "sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ==", "dependencies": { - "@microsoft/api-extractor-model": "7.26.2", + "@microsoft/api-extractor-model": "7.26.4", "@microsoft/tsdoc": "0.14.2", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.0", - "@rushstack/rig-package": "0.3.17", - "@rushstack/ts-command-line": "4.13.1", + "@rushstack/node-core-library": "3.55.2", + "@rushstack/rig-package": "0.3.18", + "@rushstack/ts-command-line": "4.13.2", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.22.1", @@ -245,97 +247,13 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.2.tgz", - "integrity": "sha512-V9tTHbYTNelTrNDXBzeDlszq29nQcjJdP6s27QJiATbqSRjEbKTeztlSVsCRHL2Wkkv5IN5jT4xkYjnFFPbK0A==", + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.4.tgz", + "integrity": "sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ==", "dependencies": { "@microsoft/tsdoc": "0.14.2", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.0" - } - }, - "node_modules/@microsoft/api-extractor-model/node_modules/@rushstack/node-core-library": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.0.tgz", - "integrity": "sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==", - "dependencies": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - }, - "peerDependencies": { - "@types/node": "^14.18.36" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - } - } - }, - "node_modules/@microsoft/api-extractor-model/node_modules/@types/node": { - "version": "14.18.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", - "integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==", - "optional": true, - "peer": true - }, - "node_modules/@microsoft/api-extractor-model/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@rushstack/node-core-library": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.0.tgz", - "integrity": "sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==", - "dependencies": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - }, - "peerDependencies": { - "@types/node": "^14.18.36" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - } - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@types/node": { - "version": "14.18.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", - "integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==", - "optional": true, - "peer": true - }, - "node_modules/@microsoft/api-extractor/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" + "@rushstack/node-core-library": "3.55.2" } }, "node_modules/@microsoft/api-extractor/node_modules/typescript": { @@ -415,19 +333,20 @@ } }, "node_modules/@nevware21/ts-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.1.0.tgz", - "integrity": "sha512-O8tHb7bl7+QBaPNPQFaFONAxAdPhuAmE4rvjWKxb2VKikAl6h/WlNuXd0F/4jwZx57LdWflUokh8G2cWTRf24Q==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.1.2.tgz", + "integrity": "sha512-NCXzmG+HnkvyduMypWjMn1nZcQLMp3b2nZdt3RJuKZgRrcwCI2ZWcNt3XAfTEMiT+FbZx6htTs/JgWu3m0yZAw==", + "dependencies": { + "@nevware21/ts-utils": ">= 0.7 < 2.x" + }, "peerDependencies": { - "@nevware21/ts-utils": ">= 0.7 < 2.x", "typescript": ">=1" } }, "node_modules/@nevware21/ts-utils": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.7.0.tgz", - "integrity": "sha512-IUAjuaIekPVnLlzprfOnppE8vPTtstI4ESHz6JEzboX+BlI8WLc76PhNtxAzhkBs1glGQ5zot4L8sA8tMNgmTQ==", - "peer": true, + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.8.0.tgz", + "integrity": "sha512-MKDEZakdmPT0flCbgYSkXzVrmwqOGTBCmK7AkxvxuOedsekHKPyqUYX2WTKu9SjfnlsNX1DqjTNWcLy8h8g0Xg==", "peerDependencies": { "typescript": ">=1" } @@ -765,6 +684,32 @@ "typescript": "^4.9.3" } }, + "node_modules/@rush-temp/applicationinsights-example-shared-worker": { + "version": "0.0.0", + "resolved": "file:projects/applicationinsights-example-shared-worker.tgz", + "integrity": "sha512-o1I1cJXIk3Fpt5WZ172SZfSZu1glVFqtR9Iz5I+KqCSwpil+KfJk+/rPGg6tNIfi2glHlqHigsS350k4bPGJ2Q==", + "dependencies": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/ts-utils": ">= 0.7 < 2.x", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "globby": "^11.0.0", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "grunt-contrib-qunit": "^6.2.1", + "magic-string": "^0.25.7", + "pako": "^2.0.3", + "qunit": "^2.11.2", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "sinon": "^7.3.1", + "tslib": "^2.0.0", + "typescript": "^4.9.3" + } + }, "node_modules/@rush-temp/applicationinsights-js-release-tools": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-js-release-tools.tgz", @@ -961,30 +906,41 @@ "typescript": "^4.9.3" } }, - "node_modules/@rushstack/rig-package": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.17.tgz", - "integrity": "sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==", + "node_modules/@rushstack/node-core-library": { + "version": "3.55.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz", + "integrity": "sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A==", "dependencies": { - "resolve": "~1.17.0", + "colors": "~1.2.1", + "fs-extra": "~7.0.1", + "import-lazy": "~4.0.0", + "jju": "~1.4.0", + "resolve": "~1.22.1", + "semver": "~7.3.0", + "z-schema": "~5.0.2" + }, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@rushstack/rig-package": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.18.tgz", + "integrity": "sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ==", + "dependencies": { + "resolve": "~1.22.1", "strip-json-comments": "~3.1.1" } }, - "node_modules/@rushstack/rig-package/node_modules/resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dependencies": { - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/@rushstack/ts-command-line": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.1.tgz", - "integrity": "sha512-UTQMRyy/jH1IS2U+6pyzyn9xQ2iMcoUKkTcZUzOP/aaMiKlWLwCTDiBVwhw/M1crDx6apF9CwyjuWO9r1SBdJQ==", + "version": "4.13.2", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.2.tgz", + "integrity": "sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag==", "dependencies": { "@types/argparse": "1.0.38", "argparse": "~1.0.9", @@ -1171,9 +1127,9 @@ } }, "node_modules/@types/react-dom": { - "version": "16.9.17", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.17.tgz", - "integrity": "sha512-qSRyxEsrm5btPXnowDOs5jSkgT8ldAA0j6Qp+otHUh+xHzy3sXmgNfyhucZjAjkgpdAUw9rJe0QRtX/l+yaS4g==", + "version": "16.9.18", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.18.tgz", + "integrity": "sha512-lmNARUX3+rNF/nmoAFqasG0jAA7q6MeGZK/fdeLwY3kAA4NPgHHrG5bNQe2B5xmD4B+x6Z6h0rEJQ7MEEgQxsw==", "dependencies": { "@types/react": "^16" } @@ -1220,14 +1176,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.50.0.tgz", - "integrity": "sha512-vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIwQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz", + "integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/type-utils": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/type-utils": "5.53.0", + "@typescript-eslint/utils": "5.53.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -1254,14 +1210,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.50.0.tgz", - "integrity": "sha512-KCcSyNaogUDftK2G9RXfQyOCt51uB5yqC6pkUYqhYh8Kgt+DwR5M0EwEAxGPy/+DH6hnmKeGsNhiZRQxjH71uQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz", + "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/typescript-estree": "5.53.0", "debug": "^4.3.4" }, "engines": { @@ -1281,13 +1237,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz", + "integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/visitor-keys": "5.53.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1298,13 +1254,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.50.0.tgz", - "integrity": "sha512-dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz", + "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==", "peer": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/utils": "5.53.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1325,9 +1281,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz", + "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==", "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1338,13 +1294,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz", + "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/visitor-keys": "5.53.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1365,16 +1321,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.50.0.tgz", - "integrity": "sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz", + "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==", "peer": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/typescript-estree": "5.53.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1391,12 +1347,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz", + "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.53.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1527,9 +1483,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/archiver-utils/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1785,9 +1741,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001450", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz", - "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==", + "version": "1.0.30001457", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz", + "integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==", "funding": [ { "type": "opencollective", @@ -1932,9 +1888,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/concat-stream/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -2143,9 +2099,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.286", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", - "integrity": "sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==" + "version": "1.4.311", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.311.tgz", + "integrity": "sha512-RoDlZufvrtr2Nx3Yx5MB8jX3aHIxm8nRWPJm3yVvyHmyKaRvn90RjzB6hNnt0AkhS3IInJdyRfQb4mWhPvUjVw==" }, "node_modules/encodeurl": { "version": "1.0.2", @@ -2189,9 +2145,9 @@ } }, "node_modules/eslint": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.33.0.tgz", - "integrity": "sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "peer": true, "dependencies": { "@eslint/eslintrc": "^1.4.1", @@ -2366,9 +2322,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz", + "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==", "peer": true, "dependencies": { "estraverse": "^5.1.0" @@ -2730,11 +2686,11 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, "node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dependencies": { - "graceful-fs": "^4.2.0", + "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" }, @@ -3532,9 +3488,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/lazystream/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3777,9 +3733,9 @@ } }, "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3857,9 +3813,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.9.tgz", - "integrity": "sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==" + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" }, "node_modules/node-watch": { "version": "0.7.3", @@ -4343,7 +4299,7 @@ "version": "9.1.1", "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-9.1.1.tgz", "integrity": "sha512-W+nOulP2tYd/ZG99WuZC/I5ljjQQ7EUw/jQGcIb9eu8mDlZxNY2SgcJXTLG9h5gRvqA3uJOe4hZXYsd3EqioMw==", - "deprecated": "< 18.1.0 is no longer supported", + "deprecated": "< 19.2.0 is no longer supported", "hasInstallScript": true, "dependencies": { "debug": "^4.1.0", @@ -4490,9 +4446,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz", + "integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -4678,6 +4634,19 @@ "node": ">=8.3" } }, + "node_modules/rollup-plugin-copy/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, "node_modules/rollup-plugin-copy/node_modules/globby": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", @@ -5597,16 +5566,16 @@ "peer": true }, "@microsoft/api-extractor": { - "version": "7.34.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.2.tgz", - "integrity": "sha512-oREyUU7p3JgjrqapJxEHe83gA1SXOWgaA4XCiY9PvsiLkgGHtn2ibTRgw9GCI/4kZzcb+OQv5waUDxsnQSKfwQ==", + "version": "7.34.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.4.tgz", + "integrity": "sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ==", "requires": { - "@microsoft/api-extractor-model": "7.26.2", + "@microsoft/api-extractor-model": "7.26.4", "@microsoft/tsdoc": "0.14.2", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.0", - "@rushstack/rig-package": "0.3.17", - "@rushstack/ts-command-line": "4.13.1", + "@rushstack/node-core-library": "3.55.2", + "@rushstack/rig-package": "0.3.18", + "@rushstack/ts-command-line": "4.13.2", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.22.1", @@ -5615,37 +5584,6 @@ "typescript": "~4.8.4" }, "dependencies": { - "@rushstack/node-core-library": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.0.tgz", - "integrity": "sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==", - "requires": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - } - }, - "@types/node": { - "version": "14.18.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", - "integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==", - "optional": true, - "peer": true - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "typescript": { "version": "4.8.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", @@ -5654,46 +5592,13 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.2.tgz", - "integrity": "sha512-V9tTHbYTNelTrNDXBzeDlszq29nQcjJdP6s27QJiATbqSRjEbKTeztlSVsCRHL2Wkkv5IN5jT4xkYjnFFPbK0A==", + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.4.tgz", + "integrity": "sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ==", "requires": { "@microsoft/tsdoc": "0.14.2", "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.0" - }, - "dependencies": { - "@rushstack/node-core-library": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.0.tgz", - "integrity": "sha512-6lSel8w3DeGaD/JCKw64wfezEBijlCQlMwBoYg9Ci5VPy+dZ+FpBkIBrY8mi3Ge4xNzr4gyTbQ5XEt0QP1Kv/w==", - "requires": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - } - }, - "@types/node": { - "version": "14.18.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", - "integrity": "sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==", - "optional": true, - "peer": true - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - } + "@rushstack/node-core-library": "3.55.2" } }, "@microsoft/dynamicproto-js": { @@ -5743,16 +5648,17 @@ "requires": {} }, "@nevware21/ts-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.1.0.tgz", - "integrity": "sha512-O8tHb7bl7+QBaPNPQFaFONAxAdPhuAmE4rvjWKxb2VKikAl6h/WlNuXd0F/4jwZx57LdWflUokh8G2cWTRf24Q==", - "requires": {} + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.1.2.tgz", + "integrity": "sha512-NCXzmG+HnkvyduMypWjMn1nZcQLMp3b2nZdt3RJuKZgRrcwCI2ZWcNt3XAfTEMiT+FbZx6htTs/JgWu3m0yZAw==", + "requires": { + "@nevware21/ts-utils": ">= 0.7 < 2.x" + } }, "@nevware21/ts-utils": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.7.0.tgz", - "integrity": "sha512-IUAjuaIekPVnLlzprfOnppE8vPTtstI4ESHz6JEzboX+BlI8WLc76PhNtxAzhkBs1glGQ5zot4L8sA8tMNgmTQ==", - "peer": true, + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.8.0.tgz", + "integrity": "sha512-MKDEZakdmPT0flCbgYSkXzVrmwqOGTBCmK7AkxvxuOedsekHKPyqUYX2WTKu9SjfnlsNX1DqjTNWcLy8h8g0Xg==", "requires": {} }, "@nodelib/fs.scandir": { @@ -6051,6 +5957,31 @@ "typescript": "^4.9.3" } }, + "@rush-temp/applicationinsights-example-shared-worker": { + "version": "file:projects\\applicationinsights-example-shared-worker.tgz", + "integrity": "sha512-o1I1cJXIk3Fpt5WZ172SZfSZu1glVFqtR9Iz5I+KqCSwpil+KfJk+/rPGg6tNIfi2glHlqHigsS350k4bPGJ2Q==", + "requires": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@nevware21/grunt-eslint-ts": "^0.2.2", + "@nevware21/grunt-ts-plugin": "^0.4.3", + "@nevware21/ts-utils": ">= 0.7 < 2.x", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "globby": "^11.0.0", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "grunt-contrib-qunit": "^6.2.1", + "magic-string": "^0.25.7", + "pako": "^2.0.3", + "qunit": "^2.11.2", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "sinon": "^7.3.1", + "tslib": "^2.0.0", + "typescript": "^4.9.3" + } + }, "@rush-temp/applicationinsights-js-release-tools": { "version": "file:projects\\applicationinsights-js-release-tools.tgz", "integrity": "sha512-6sVB5NMzKj/P9v9UvZlA/IjQSkGeupaDliSt2IZqy+SlR59Hv335Ekz/5f54xMHu+QiARXJATbjX7lDfCMG8qw==", @@ -6237,29 +6168,33 @@ "typescript": "^4.9.3" } }, - "@rushstack/rig-package": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.17.tgz", - "integrity": "sha512-nxvAGeIMnHl1LlZSQmacgcRV4y1EYtgcDIrw6KkeVjudOMonlxO482PhDj3LVZEp6L7emSf6YSO2s5JkHlwfZA==", + "@rushstack/node-core-library": { + "version": "3.55.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz", + "integrity": "sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A==", "requires": { - "resolve": "~1.17.0", + "colors": "~1.2.1", + "fs-extra": "~7.0.1", + "import-lazy": "~4.0.0", + "jju": "~1.4.0", + "resolve": "~1.22.1", + "semver": "~7.3.0", + "z-schema": "~5.0.2" + } + }, + "@rushstack/rig-package": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.18.tgz", + "integrity": "sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ==", + "requires": { + "resolve": "~1.22.1", "strip-json-comments": "~3.1.1" - }, - "dependencies": { - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "requires": { - "path-parse": "^1.0.6" - } - } } }, "@rushstack/ts-command-line": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.1.tgz", - "integrity": "sha512-UTQMRyy/jH1IS2U+6pyzyn9xQ2iMcoUKkTcZUzOP/aaMiKlWLwCTDiBVwhw/M1crDx6apF9CwyjuWO9r1SBdJQ==", + "version": "4.13.2", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.2.tgz", + "integrity": "sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag==", "requires": { "@types/argparse": "1.0.38", "argparse": "~1.0.9", @@ -6437,9 +6372,9 @@ } }, "@types/react-dom": { - "version": "16.9.17", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.17.tgz", - "integrity": "sha512-qSRyxEsrm5btPXnowDOs5jSkgT8ldAA0j6Qp+otHUh+xHzy3sXmgNfyhucZjAjkgpdAUw9rJe0QRtX/l+yaS4g==", + "version": "16.9.18", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.18.tgz", + "integrity": "sha512-lmNARUX3+rNF/nmoAFqasG0jAA7q6MeGZK/fdeLwY3kAA4NPgHHrG5bNQe2B5xmD4B+x6Z6h0rEJQ7MEEgQxsw==", "requires": { "@types/react": "^16" } @@ -6486,14 +6421,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.50.0.tgz", - "integrity": "sha512-vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIwQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz", + "integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==", "peer": true, "requires": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/type-utils": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/type-utils": "5.53.0", + "@typescript-eslint/utils": "5.53.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -6504,53 +6439,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.50.0.tgz", - "integrity": "sha512-KCcSyNaogUDftK2G9RXfQyOCt51uB5yqC6pkUYqhYh8Kgt+DwR5M0EwEAxGPy/+DH6hnmKeGsNhiZRQxjH71uQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz", + "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==", "peer": true, "requires": { - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/typescript-estree": "5.53.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", - "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz", + "integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==", "peer": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0" + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/visitor-keys": "5.53.0" } }, "@typescript-eslint/type-utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.50.0.tgz", - "integrity": "sha512-dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz", + "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==", "peer": true, "requires": { - "@typescript-eslint/typescript-estree": "5.50.0", - "@typescript-eslint/utils": "5.50.0", + "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/utils": "5.53.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", - "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz", + "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==", "peer": true }, "@typescript-eslint/typescript-estree": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", - "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz", + "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==", "peer": true, "requires": { - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/visitor-keys": "5.50.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/visitor-keys": "5.53.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6559,28 +6494,28 @@ } }, "@typescript-eslint/utils": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.50.0.tgz", - "integrity": "sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz", + "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==", "peer": true, "requires": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.50.0", - "@typescript-eslint/types": "5.50.0", - "@typescript-eslint/typescript-estree": "5.50.0", + "@typescript-eslint/scope-manager": "5.53.0", + "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/typescript-estree": "5.53.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", - "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", + "version": "5.53.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz", + "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==", "peer": true, "requires": { - "@typescript-eslint/types": "5.50.0", + "@typescript-eslint/types": "5.53.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -6671,9 +6606,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -6848,9 +6783,9 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001450", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz", - "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==" + "version": "1.0.30001457", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz", + "integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==" }, "chalk": { "version": "4.1.2", @@ -6955,9 +6890,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -7110,9 +7045,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "electron-to-chromium": { - "version": "1.4.286", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", - "integrity": "sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==" + "version": "1.4.311", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.311.tgz", + "integrity": "sha512-RoDlZufvrtr2Nx3Yx5MB8jX3aHIxm8nRWPJm3yVvyHmyKaRvn90RjzB6hNnt0AkhS3IInJdyRfQb4mWhPvUjVw==" }, "encodeurl": { "version": "1.0.2", @@ -7144,9 +7079,9 @@ "peer": true }, "eslint": { - "version": "8.33.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.33.0.tgz", - "integrity": "sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==", + "version": "8.34.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", + "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", "peer": true, "requires": { "@eslint/eslintrc": "^1.4.1", @@ -7276,9 +7211,9 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz", + "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==", "peer": true, "requires": { "estraverse": "^5.1.0" @@ -7574,11 +7509,11 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "requires": { - "graceful-fs": "^4.2.0", + "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } @@ -8186,9 +8121,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -8387,9 +8322,9 @@ } }, "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" }, "mkdirp": { "version": "0.5.6", @@ -8452,9 +8387,9 @@ } }, "node-releases": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.9.tgz", - "integrity": "sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==" + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" }, "node-watch": { "version": "0.7.3", @@ -8898,9 +8833,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz", + "integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -9033,6 +8968,16 @@ "is-plain-object": "^3.0.0" }, "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "globby": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", diff --git a/examples/shared-worker/package.json b/examples/shared-worker/package.json index 3f936302..bf727bb5 100644 --- a/examples/shared-worker/package.json +++ b/examples/shared-worker/package.json @@ -39,7 +39,7 @@ "devDependencies": { "@microsoft/ai-test-framework": "0.0.1", "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0", - "@microsoft/applicationinsights-rollup-es5": "1.0.0", + "@microsoft/applicationinsights-rollup-es3": "1.1.3", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", "grunt-contrib-qunit": "^6.2.1", diff --git a/examples/shared-worker/rollup.config.js b/examples/shared-worker/rollup.config.js index fb5c8534..344142d7 100644 --- a/examples/shared-worker/rollup.config.js +++ b/examples/shared-worker/rollup.config.js @@ -3,7 +3,7 @@ import { uglify } from "@microsoft/applicationinsights-rollup-plugin-uglify3-js" import replace from "@rollup/plugin-replace"; import cleanup from "rollup-plugin-cleanup"; import dynamicRemove from "@microsoft/dynamicproto-js/tools/rollup/node/removedynamic"; -import { es5Poly, es5Check, importCheck } from "@microsoft/applicationinsights-rollup-es5"; +import { es3Poly, es3Check, importCheck } from "@microsoft/applicationinsights-rollup-es3"; import { updateDistEsmFiles } from "../../tools/updateDistEsm/updateDistEsm"; const version = require("./package.json").version; @@ -65,8 +65,8 @@ const browserRollupConfigFactory = (name, isProduction, format = "umd", extensio preferBuiltins: false }), doCleanup(), - es5Poly(), - es5Check() + es3Poly(), + es3Check() ] }; diff --git a/examples/shared-worker/src/worker-npm-init.ts b/examples/shared-worker/src/worker-npm-init.ts index 79a95640..3c3ac2e2 100644 --- a/examples/shared-worker/src/worker-npm-init.ts +++ b/examples/shared-worker/src/worker-npm-init.ts @@ -11,7 +11,7 @@ let _appInsights: ApplicationInsights; * @param config * @returns */ -export function initApplicationInsights(config: IConfiguration) { +export function initApplicationInsights(config: IConfiguration, onInitCallback: (appInsights: ApplicationInsights, port: MessagePort) => void, port: MessagePort) { if (!_appInsights) { // Make sure we have a configuration object @@ -25,7 +25,11 @@ export function initApplicationInsights(config: IConfiguration) { }); _appInsights.loadAppInsights(); - _appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview + if (_appInsights.core.isInitialized()) { + // Call the callback before the trackPageView + onInitCallback(_appInsights, port); + _appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview + } return _appInsights; } diff --git a/examples/shared-worker/src/worker.ts b/examples/shared-worker/src/worker.ts index a601fb70..6dfd13ee 100644 --- a/examples/shared-worker/src/worker.ts +++ b/examples/shared-worker/src/worker.ts @@ -3,7 +3,7 @@ import { initApplicationInsights, trackPageView, unloadApplicationInsights } from "./worker-npm-init"; import { ExampleMessageType, IExampleRequest, IExampleResponse } from "./interfaces/IExampleMessage"; -import { IConfiguration, INotificationListener } from "@microsoft/applicationinsights-web"; +import { ApplicationInsights, IConfiguration, INotificationListener } from "@microsoft/applicationinsights-web"; import { dumpObj, objAssign } from "@nevware21/ts-utils"; /** @@ -12,7 +12,16 @@ import { dumpObj, objAssign } from "@nevware21/ts-utils"; * the connection string. */ const defaultApplicationInsightsConfig: IConfiguration = { - + /** + * 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. + * + * 0: ALL iKey logging off + * 1: logs to iKey: severity >= CRITICAL + * 2: logs to iKey: severity >= WARNING + */ + loggingLevelTelemetry: 2 }; /** @@ -91,6 +100,31 @@ function notificationListener(port: MessagePort): INotificationListener { }; } +/** + * We only want to add any notification listener or telemetry initializer once + * otherwise they WILL get called multiple times during processing. + * @param appInsights + * @param port + */ +function onInitAddInitializers(appInsights: ApplicationInsights, port: MessagePort) { + // This callback is only called once, otherwise we would keep adding listeners and initializers + appInsights.core.getNotifyMgr().addNotificationListener(notificationListener(port)); + + // This is not normally needed, but this provides a view from the worker to the + // main page about errors that the worker is having / seeing + appInsights.addTelemetryInitializer((theEvent) => { + if (theEvent && theEvent.name && theEvent.name["startsWith"]("InternalMessageId") && theEvent.baseData) { + port.postMessage({ + success: true, + message: "Internal Message: " + (theEvent.baseData?.message || "--") + }); + + // Drop ALL internal message from being sent to Azure Monitor portal + return false; + } + }); +} + /** * Initialize the SDK using the passed connection string from the request (if supplied) * @param request @@ -100,9 +134,8 @@ function notificationListener(port: MessagePort): INotificationListener { function workerLoadSdk(request: IExampleRequest, port: MessagePort) { let theConfig = objAssign({}, defaultApplicationInsightsConfig); theConfig.connectionString = request.connectionString; - let appInsights = initApplicationInsights(theConfig); + let appInsights = initApplicationInsights(theConfig, onInitAddInitializers, port); if (appInsights && appInsights.core.isInitialized()) { - appInsights.core.getNotifyMgr().addNotificationListener(notificationListener(port)); return { success: true, message: `SDK Loaded and Initialized with - ${appInsights.config.connectionString}` diff --git a/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/Telemetry/PageViewManager.ts b/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/Telemetry/PageViewManager.ts index 2aa5f532..7e63f114 100644 --- a/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/Telemetry/PageViewManager.ts +++ b/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/Telemetry/PageViewManager.ts @@ -11,6 +11,23 @@ import { } from "@microsoft/applicationinsights-core-js"; import { PageViewPerformanceManager } from "./PageViewPerformanceManager"; +declare let WorkerGlobalScope: any; +declare let self: any; + +let _isWebWorker: boolean = null; + +function isWebWorker() { + if (_isWebWorker == null) { + try { + _isWebWorker = !!(self && self instanceof WorkerGlobalScope); + } catch(e) { + _isWebWorker = false; + } + } + + return _isWebWorker; +} + /** * Internal interface to pass appInsights object to subcomponents without coupling */ @@ -99,11 +116,13 @@ export class PageViewManager { ); _flushChannels(true); - // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing) - _throwInternal(_logger, - eLoggingSeverity.WARNING, - _eInternalMessageId.NavigationTimingNotSupported, - "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info."); + if (!isWebWorker()) { + // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing) + _throwInternal(_logger, + eLoggingSeverity.WARNING, + _eInternalMessageId.NavigationTimingNotSupported, + "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info."); + } return; } diff --git a/extensions/applicationinsights-dependencies-js/src/ajax.ts b/extensions/applicationinsights-dependencies-js/src/ajax.ts index ef7c1193..4b511ff7 100644 --- a/extensions/applicationinsights-dependencies-js/src/ajax.ts +++ b/extensions/applicationinsights-dependencies-js/src/ajax.ts @@ -20,6 +20,9 @@ import { } from "./DependencyListener"; import { IAjaxRecordResponse, ajaxRecord } from "./ajaxRecord"; +declare let WorkerGlobalScope: any; +declare let self: any; + const AJAX_MONITOR_PREFIX = "ai.ajxmn."; const strDiagLog = "diagLog"; const strAjaxData = "ajaxData"; @@ -54,6 +57,20 @@ function _supportsFetch(): (input: RequestInfo, init?: RequestInit) => Promise