diff --git a/common/config/rush/npm-shrinkwrap.json b/common/config/rush/npm-shrinkwrap.json index fa9c82a6..a0a92cb2 100644 --- a/common/config/rush/npm-shrinkwrap.json +++ b/common/config/rush/npm-shrinkwrap.json @@ -26,6 +26,8 @@ "@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-aisku": "file:./projects/applicationinsights-example-aisku.tgz", + "@rush-temp/applicationinsights-example-dependencies": "file:./projects/applicationinsights-example-dependencies.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", @@ -170,9 +172,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz", + "integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==", "peer": true, "dependencies": { "ajv": "^6.12.4", @@ -192,6 +194,15 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/js": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz", + "integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -270,9 +281,9 @@ } }, "node_modules/@microsoft/dynamicproto-js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.7.tgz", - "integrity": "sha512-SK3D3aVt+5vOOccKPnGaJWB5gQ8FuKfjboUJHedMP7gu54HqSCXX5iFXhktGD8nfJb0Go30eDvs/UDoTnR2kOA==" + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.8.tgz", + "integrity": "sha512-j4ZgOZRtX0LTUgKq+4tRQotgwH03HH/mLkYbcgFBBJ9XKTDc4NIGzZeam2UQMzwz+5IVN0SXexNbbsz5B0b/og==" }, "node_modules/@microsoft/tsdoc": { "version": "0.14.2", @@ -694,6 +705,40 @@ "typescript": "^4.9.3" } }, + "node_modules/@rush-temp/applicationinsights-example-aisku": { + "version": "0.0.0", + "resolved": "file:projects/applicationinsights-example-aisku.tgz", + "integrity": "sha512-EC/ZbXfBE6yiAHzRrZem/76DoObPsNjkH0pyRYhfS3B8goL0phtvn/N0OFUQZG7carWybwTceAATh1ngD7Fe1g==", + "dependencies": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "tslib": "*", + "typescript": "^4.9.3" + } + }, + "node_modules/@rush-temp/applicationinsights-example-dependencies": { + "version": "0.0.0", + "resolved": "file:projects/applicationinsights-example-dependencies.tgz", + "integrity": "sha512-BzXwFKh0+J7Q8a7pk+qWFAhZwSb2JhqpKdWJSBDEBVwFp6U1sJaXW9MXRepEPQ8UdLG/RWJHvYjzTiOsyqjkLg==", + "dependencies": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "tslib": "*", + "typescript": "^4.9.3" + } + }, "node_modules/@rush-temp/applicationinsights-example-shared-worker": { "version": "0.0.0", "resolved": "file:projects/applicationinsights-example-shared-worker.tgz", @@ -1215,14 +1260,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "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==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz", + "integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/type-utils": "5.53.0", - "@typescript-eslint/utils": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/type-utils": "5.54.0", + "@typescript-eslint/utils": "5.54.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -1249,14 +1294,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz", - "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.0.tgz", + "integrity": "sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/typescript-estree": "5.54.0", "debug": "^4.3.4" }, "engines": { @@ -1276,13 +1321,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "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==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", + "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/visitor-keys": "5.53.0" + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/visitor-keys": "5.54.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1293,13 +1338,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz", - "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz", + "integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==", "peer": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.53.0", - "@typescript-eslint/utils": "5.53.0", + "@typescript-eslint/typescript-estree": "5.54.0", + "@typescript-eslint/utils": "5.54.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -1320,9 +1365,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz", - "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", + "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1333,13 +1378,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz", - "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", + "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/visitor-keys": "5.53.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/visitor-keys": "5.54.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1360,16 +1405,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz", - "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz", + "integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==", "peer": true, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/typescript-estree": "5.54.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" @@ -1386,12 +1431,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz", - "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", + "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", "peer": true, "dependencies": { - "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/types": "5.54.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1522,9 +1567,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", @@ -1780,9 +1825,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001457", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz", - "integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==", + "version": "1.0.30001458", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz", + "integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w==", "funding": [ { "type": "opencollective", @@ -1927,9 +1972,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", @@ -2138,9 +2183,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.306", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.306.tgz", - "integrity": "sha512-1zGmLFfpcs2v7ELt/1HgLZF6Gm2CCHaAdNKxd9Ge4INSU/HDYWjs7fcWU6eVMmhkpwmh+52ZrGCUU+Ji9OJihA==" + "version": "1.4.314", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.314.tgz", + "integrity": "sha512-+3RmNVx9hZLlc0gW//4yep0K5SYKmIvB5DXg1Yg6varsuAHlHwTeqeygfS8DWwLCsNOWrgj+p9qgM5WYjw1lXQ==" }, "node_modules/encodeurl": { "version": "1.0.2", @@ -2184,12 +2229,13 @@ } }, "node_modules/eslint": { - "version": "8.34.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", - "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz", + "integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==", "peer": true, "dependencies": { - "@eslint/eslintrc": "^1.4.1", + "@eslint/eslintrc": "^2.0.0", + "@eslint/js": "8.35.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -2203,7 +2249,7 @@ "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", "espree": "^9.4.0", - "esquery": "^1.4.0", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", @@ -3527,9 +3573,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", @@ -4485,9 +4531,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", @@ -5565,9 +5611,9 @@ } }, "@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.0.tgz", + "integrity": "sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==", "peer": true, "requires": { "ajv": "^6.12.4", @@ -5581,6 +5627,12 @@ "strip-json-comments": "^3.1.1" } }, + "@eslint/js": { + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.35.0.tgz", + "integrity": "sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==", + "peer": true + }, "@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -5641,9 +5693,9 @@ } }, "@microsoft/dynamicproto-js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.7.tgz", - "integrity": "sha512-SK3D3aVt+5vOOccKPnGaJWB5gQ8FuKfjboUJHedMP7gu54HqSCXX5iFXhktGD8nfJb0Go30eDvs/UDoTnR2kOA==" + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-1.1.8.tgz", + "integrity": "sha512-j4ZgOZRtX0LTUgKq+4tRQotgwH03HH/mLkYbcgFBBJ9XKTDc4NIGzZeam2UQMzwz+5IVN0SXexNbbsz5B0b/og==" }, "@microsoft/tsdoc": { "version": "0.14.2", @@ -6005,6 +6057,38 @@ "typescript": "^4.9.3" } }, + "@rush-temp/applicationinsights-example-aisku": { + "version": "file:projects\\applicationinsights-example-aisku.tgz", + "integrity": "sha512-EC/ZbXfBE6yiAHzRrZem/76DoObPsNjkH0pyRYhfS3B8goL0phtvn/N0OFUQZG7carWybwTceAATh1ngD7Fe1g==", + "requires": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "tslib": "*", + "typescript": "^4.9.3" + } + }, + "@rush-temp/applicationinsights-example-dependencies": { + "version": "file:projects\\applicationinsights-example-dependencies.tgz", + "integrity": "sha512-BzXwFKh0+J7Q8a7pk+qWFAhZwSb2JhqpKdWJSBDEBVwFp6U1sJaXW9MXRepEPQ8UdLG/RWJHvYjzTiOsyqjkLg==", + "requires": { + "@microsoft/dynamicproto-js": "^1.1.7", + "@rollup/plugin-commonjs": "^18.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-replace": "^2.3.3", + "grunt": "^1.5.3", + "grunt-cli": "^1.4.3", + "rollup": "^2.32.0", + "rollup-plugin-cleanup": "^3.2.1", + "tslib": "*", + "typescript": "^4.9.3" + } + }, "@rush-temp/applicationinsights-example-shared-worker": { "version": "file:projects\\applicationinsights-example-shared-worker.tgz", "integrity": "sha512-aIL4qvg/bjQOniMml+en/LfOa1mNHRaJXtyNFkMu1MqFSsPgH1L6Sg/fWJhkh/+TEPyDt6+QboKMqBeDs4mihQ==", @@ -6497,14 +6581,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "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==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz", + "integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==", "peer": true, "requires": { - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/type-utils": "5.53.0", - "@typescript-eslint/utils": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/type-utils": "5.54.0", + "@typescript-eslint/utils": "5.54.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -6515,53 +6599,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz", - "integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.0.tgz", + "integrity": "sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==", "peer": true, "requires": { - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/typescript-estree": "5.54.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "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==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", + "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", "peer": true, "requires": { - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/visitor-keys": "5.53.0" + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/visitor-keys": "5.54.0" } }, "@typescript-eslint/type-utils": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz", - "integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz", + "integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==", "peer": true, "requires": { - "@typescript-eslint/typescript-estree": "5.53.0", - "@typescript-eslint/utils": "5.53.0", + "@typescript-eslint/typescript-estree": "5.54.0", + "@typescript-eslint/utils": "5.54.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz", - "integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", + "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", "peer": true }, "@typescript-eslint/typescript-estree": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz", - "integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", + "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", "peer": true, "requires": { - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/visitor-keys": "5.53.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/visitor-keys": "5.54.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -6570,28 +6654,28 @@ } }, "@typescript-eslint/utils": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz", - "integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz", + "integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==", "peer": true, "requires": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.53.0", - "@typescript-eslint/types": "5.53.0", - "@typescript-eslint/typescript-estree": "5.53.0", + "@typescript-eslint/scope-manager": "5.54.0", + "@typescript-eslint/types": "5.54.0", + "@typescript-eslint/typescript-estree": "5.54.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.53.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz", - "integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==", + "version": "5.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", + "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", "peer": true, "requires": { - "@typescript-eslint/types": "5.53.0", + "@typescript-eslint/types": "5.54.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -6682,9 +6766,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", @@ -6859,9 +6943,9 @@ "peer": true }, "caniuse-lite": { - "version": "1.0.30001457", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz", - "integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==" + "version": "1.0.30001458", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001458.tgz", + "integrity": "sha512-lQ1VlUUq5q9ro9X+5gOEyH7i3vm+AYVT1WDCVB69XOZ17KZRhnZ9J0Sqz7wTHQaLBJccNCHq8/Ww5LlOIZbB0w==" }, "chalk": { "version": "4.1.2", @@ -6966,9 +7050,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", @@ -7121,9 +7205,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "electron-to-chromium": { - "version": "1.4.306", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.306.tgz", - "integrity": "sha512-1zGmLFfpcs2v7ELt/1HgLZF6Gm2CCHaAdNKxd9Ge4INSU/HDYWjs7fcWU6eVMmhkpwmh+52ZrGCUU+Ji9OJihA==" + "version": "1.4.314", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.314.tgz", + "integrity": "sha512-+3RmNVx9hZLlc0gW//4yep0K5SYKmIvB5DXg1Yg6varsuAHlHwTeqeygfS8DWwLCsNOWrgj+p9qgM5WYjw1lXQ==" }, "encodeurl": { "version": "1.0.2", @@ -7155,12 +7239,13 @@ "peer": true }, "eslint": { - "version": "8.34.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", - "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", + "version": "8.35.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.35.0.tgz", + "integrity": "sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==", "peer": true, "requires": { - "@eslint/eslintrc": "^1.4.1", + "@eslint/eslintrc": "^2.0.0", + "@eslint/js": "8.35.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -7174,7 +7259,7 @@ "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", "espree": "^9.4.0", - "esquery": "^1.4.0", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", @@ -8197,9 +8282,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", @@ -8909,9 +8994,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", diff --git a/examples/AISKU/README.md b/examples/AISKU/README.md new file mode 100644 index 00000000..e52efbe4 --- /dev/null +++ b/examples/AISKU/README.md @@ -0,0 +1,44 @@ +# Application Insights JavaScript SDK + +## AISKU Sample + +This Sample shows how to track [`pageview`](../../API-reference.md#trackpageview), [`event`](../../API-reference.md#trackevent), [`trace`](../../API-reference.md#tracktrace), [`metric`](../../API-reference.md#trackmetric), [`exception`](../../API-reference.md#trackexception), get cookies details by using `cookieMgr` and record event duration manually by using `startTrackEvent` and `stopTrackEvent`. + +## Sample Build + +- Build the repository before running this example. +- Run `npm run serve` under root folder. +- Open `http://localhost:9001/examples/AISKU/`. + +## Description + +- button `Change Config` will change config dynamically. +- button `Create Pageview` will trigger a pageview telemetry. +- button `Create Event` will trigger an event telemetry. +- button `Create Trace` will trigger a trace telemetry. +- button `Create Metric` will trigger a metric telemetry. +- button `Create Exception` will trigger an exception telemetry. +- button `Start Tracking event` will start timing an event with given name `manual_record_event` +- button `Stop Tracking event` will stop timing the previous event with given name `manual_record_event`. + +## 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 . + +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. For more information see the Code of Conduct FAQ or contact 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 [here](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. 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 diff --git a/examples/AISKU/index.html b/examples/AISKU/index.html new file mode 100644 index 00000000..9d3cb800 --- /dev/null +++ b/examples/AISKU/index.html @@ -0,0 +1,32 @@ + + + + + + AISKU Sample + + + + + + + +

Microsoft Application Insights JavaScript SDK - AISKU

+ + + + + + \ No newline at end of file diff --git a/examples/AISKU/package.json b/examples/AISKU/package.json new file mode 100644 index 00000000..a569ba1d --- /dev/null +++ b/examples/AISKU/package.json @@ -0,0 +1,56 @@ +{ + "name": "@microsoft/applicationinsights-example-aisku", + "author": "Microsoft Application Insights Team", + "version": "2.8.10", + "description": "Microsoft Application Insights AISKU Example", + "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme", + "keywords": [ + "azure", + "cloud", + "script errors", + "microsoft", + "application insights", + "browser performance monitoring", + "web analytics", + "example" + ], + "scripts": { + "clean": "grunt clean", + "build": "npm run build:esm && npm run build:browser", + "build:esm": "grunt example-aisku", + "build:browser": "rollup -c rollup.config.js", + "rebuild": "npm run build", + "test": "", + "mintest": "", + "perftest": "", + "lint": "tslint -p tsconfig.json", + "ai-min": "", + "ai-restore": "" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore" + }, + "license": "MIT", + "sideEffects": false, + "devDependencies": { + "@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", + "@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" + }, + "peerDependencies": { + "tslib": "*" + }, + "dependencies": { + "@microsoft/applicationinsights-shims": "2.0.2", + "@microsoft/dynamicproto-js": "^1.1.7", + "@microsoft/applicationinsights-web": "2.8.10" + } +} \ No newline at end of file diff --git a/examples/AISKU/rollup.config.js b/examples/AISKU/rollup.config.js new file mode 100644 index 00000000..5f2f1691 --- /dev/null +++ b/examples/AISKU/rollup.config.js @@ -0,0 +1,98 @@ +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 = "aisku-example-index"; +const banner = [ + "/*!", + ` * Application Insights JavaScript SDK Example - AISKU, ${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: [ "aisku-example-index" ] }), + 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") +]; \ No newline at end of file diff --git a/examples/AISKU/src/aisku-example-index.ts b/examples/AISKU/src/aisku-example-index.ts new file mode 100644 index 00000000..a63cdcc8 --- /dev/null +++ b/examples/AISKU/src/aisku-example-index.ts @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { addTelemetryInitializer, changeConfig, eventItem, getConfig, getCookieMgr, initApplicationInsights, metricItem, pageviewItem, startTrackEvent, stopTrackEvent, traceItem, trackEvent, trackMetric, trackPageView, trackTrace } from "./aisku-init"; +import { ai_session, ai_user, buttonSectionId, clearDetailsList, clearEle, configContainerId, configDetails, cookieWatchList, createButton, createContainers, createDetailList, detailsContainerId, detailsWatchList, manual_event, triggerException } from "./utils"; + +function createPageviewTracks() { + trackPageView(pageviewItem); +} + +function createEventTracks() { + trackEvent(eventItem, {prop2: "prop2"}); +} + +function startEvent() { + startTrackEvent(manual_event); +} + + +function stopEvent() { + stopTrackEvent(manual_event, {prop:"prop"}, {metric: 1}); +} + +function createTraceTracks() { + trackTrace(traceItem); +} + +function createMetricTracks() { + trackMetric(metricItem, {prop2: "prop2"}); +} + +function getCookieMgrdetails() { + let cookieMgr = getCookieMgr(); + if(cookieMgr) { + let details = { + isEnabled: cookieMgr.isEnabled(), + ai_session: cookieMgr.get(ai_session), + ai_user: cookieMgr.get(ai_user) + } as any; + createDetailList(cookieWatchList, details, detailsContainerId, "Cookie"); + } +} + +function addTelemetryListener() { + addTelemetryInitializer((env: any) => { + console.log("The following Event is triggered."); + console.log(env); + + createDetailList(detailsWatchList, env, detailsContainerId, "Telemetry"); + }); +} + +function createConfigDetails() { + let config = getConfig(); + clearEle(configContainerId); + createDetailList(configDetails, config, configContainerId, "Config"); +} + +function changeConfigOnClick() { + changeConfig(); + createConfigDetails(); +} + + +function createButtonSection() { + let container = document.getElementById(buttonSectionId); + let changeConfigBtn = createButton("Change Config", changeConfigOnClick); + let pageviewButton = createButton("Create Pageview", createPageviewTracks); + let eventButton = createButton("Create Event", createEventTracks); + let startButton = createButton("Start Tracking Event", startEvent); + let stopButton = createButton("Stop Tracking Event", stopEvent); + let traceButton = createButton("Create Trace", createTraceTracks); + let metricButton = createButton("Create Metric", createMetricTracks); + let exceptionButton = createButton("Create Exception", triggerException); + let cookieButton = createButton("Get Cookie", getCookieMgrdetails); + let clearButton = createButton("Clear Details", clearDetailsList); + let buttons = [changeConfigBtn, pageviewButton, eventButton, traceButton, metricButton, startButton, stopButton, exceptionButton, cookieButton, clearButton]; + buttons.forEach(ele => { + container?.appendChild(ele); + }); +} + +function analyticsSample() { + initApplicationInsights(); + createContainers(); + addTelemetryListener(); + createButtonSection(); + createConfigDetails(); +} +analyticsSample(); + + diff --git a/examples/AISKU/src/aisku-init.ts b/examples/AISKU/src/aisku-init.ts new file mode 100644 index 00000000..dbd0eeb4 --- /dev/null +++ b/examples/AISKU/src/aisku-init.ts @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { generateNewConfig } from "./utils"; + + +// ****************************************************************************************************************************** +// Snippet Initialization. If you want to use NPM initialization, replace this section with the NPM Initialization section at the end. +let _appInsights: any; + +export function initApplicationInsights() { + + if (!_appInsights) { + _appInsights = (window as any).appInsights; + 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 + */ +export function trackPageView(pageView?: any) { + if (_appInsights) { + _appInsights.trackPageView(pageView); + return true; + } + return false; +} + +/** + * Log a custom event if the SDK has been initialized + */ +export function trackEvent(event?: any, customProperties?: any) { + if (_appInsights) { + _appInsights.trackEvent(event, customProperties); + return true; + } + return false; +} + +/** + * Start timing an event with given name if the SDK has been initialized + */ +export function startTrackEvent(name?: string) { + if (_appInsights) { + _appInsights.startTrackEvent(name); + return true; + } + return false; +} + +/** + * Stop timing an event with given name if the SDK has been initialized + */ +export function stopTrackEvent(name: string, properties?: { [key: string]: string; }, measurements?: { [key: string]: number; }) { + if (_appInsights) { + _appInsights.stopTrackEvent(name, properties, measurements); + return true; + } + return false; +} + +/** + * Log traces if the SDK has been initialized + * Typically used to send regular reports of performance indicators + */ +export function trackTrace(trace: any) { + if (_appInsights) { + _appInsights.trackTrace(trace); + return true; + } + return false; +} + +/** + * Log Metric if the SDK has been initialized + */ +export function trackMetric(metric: any, customProperties?: {[name: string]: any}) { + if (_appInsights) { + _appInsights.trackMetric(metric, customProperties); + return true; + } + return false; +} + +/** + * Adds a telemetry initializer to the collection if the SDK has been initialized + * Telemetry initializers will be called before the telemetry item is pushed for sending + */ +export function addTelemetryInitializer(telemetryInitializer: (item: any) => boolean | void) { + if (_appInsights) { + + _appInsights.addTelemetryInitializer(telemetryInitializer); + return true; + } + return false; +} + +/** + * Use getCookieMgr to get cookie details if the SDK has been initialized + * cookieMgr can be used to del, get, purge, set cookies + */ +export function getCookieMgr() { + if (_appInsights) { + return _appInsights.getCookieMgr(); + } + return null; +} + +/** + * Get current config settings if the SDK has been initialized + */ +export function getConfig() { + if (_appInsights) { + let config = _appInsights["config"]; + console.log("current config"); + console.log(config); + return config; + } + return null; +} + +/** + * Change current config settings dynamically if the SDK has been initialized + */ +export function changeConfig() { + if (_appInsights) { + let newConfig = generateNewConfig(); // generate new config object + _appInsights["config"] = newConfig; // change config + return true; + } + return false; +} + + +/** + * An example of customized pageview item + */ +export const pageviewItem = { + name: "pageviewWithproperities", // Defaults to the document title + uri: "https://pageview", + refUri: "https://sample", + pageType: "type", + isLoggedIn: false, + properties: { + duration: 100, // pre-defined property + prop: "prop", + prop1: {prop1:"prop1"} + }, + measurements: { + metric: 1 + } +}; + +/** + * An example of customized event item + */ +export const eventItem = { + name: "eventWithproperities", + properties: { + prop: {prop1:"prop1"} + }, + measurements: { + metirc: 1 + } +}; + +/** + * An example of customized trace item + */ +export const traceItem = { + message: "trace", + SeverityLevel: 1, + properties: { + prop: {prop1:"prop1"} + }, + measurements: { + metirc: 1 + } +}; + +/** + * An example of customized metric item + */ +export const metricItem = { + name: "metric", + average: 1.2, + //default to 1 + sampleCount: 2, + //default to average + min: 1, + //default to average + max: 2, + // default to 0 + stdDev: 1.23, + properties: { + prop: {prop1:"prop1"} + }, + measurements: { + metirc: 1 + } +}; + + + +// // *********************************************************************************************************** +// // NPM Initialization +// // Use this section to initialize Application Insights with NPM + +// import { ApplicationInsights, IConfiguration } from "@microsoft/applicationinsights-web" + +// // Cache the previously initialized instance to avoid creating multiple instances +// let _appInsights: ApplicationInsights; + +// 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; +// } + +// // ************************************************************************************************************** \ No newline at end of file diff --git a/examples/AISKU/src/utils.ts b/examples/AISKU/src/utils.ts new file mode 100644 index 00000000..16f0bf9a --- /dev/null +++ b/examples/AISKU/src/utils.ts @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +export const detailsContainerId = "details-container"; +export const detailsWatchList = ["baseType", "name", "time", "properties"]; +export const ajaxDetails: string[] = ["disabbleFetchTracking", "disableExceptionTracking", "enableAutoRouteTracking"]; +export const analyticsDetails: string[] = ["autoTrackPageVisitTime", "appId", "enableAjaxPerfTracking", "enableCorsCorrelation"]; +export const configDetails: string[] = ["connectionString", ...ajaxDetails, ...analyticsDetails]; +export const buttonSectionId = "button-section"; +export const configContainerId = "config-details"; +export const containerId = "aisku-container"; +export const ai_session = "ai_session"; +export const ai_user = "ai_user"; +export const manual_event = "manual_record_event"; +export const cookieWatchList = ["isEnabled", ai_session, ai_user]; + + +export function randomBoolean() { + if (Math.random() > 0.5) { + return true; + } + return false; +} + +export function clearEle(id: string) { + let ele = document.getElementById(id); + if (ele) { + ele.innerHTML = ""; + } +} + +export function clearDetailsList() { + clearEle(detailsContainerId); +} + +export function createSubContainer(id: string, className?: string) { + let ele = document.createElement("div"); + ele.className = className || "container-main"; + ele.id = id; + return ele; +} + +export function createButton(buttontextContent: string, buttobuttononclickFn: any, id?: string): HTMLButtonElement { + let btn = document.createElement("button"); + if (id) { + btn.id = id; + } + btn.innerHTML = buttontextContent; + btn.onclick = buttobuttononclickFn; + return btn; +} + +export function generateNewConfig() { + let prefix = Math.random().toString(36).slice(6); + + let newConfig: any = { + connectionString: `InstrumentationKey=newKey${prefix}`, + extensionConfig: { + ApplicationInsightsAnalytics: { + autoTrackPageVisitTime: randomBoolean(), + appId: Math.random().toString(36).slice(8), + enableAjaxPerfTracking: randomBoolean(), + enableCorsCorrelation: randomBoolean() + }, + AjaxDependencyPlugin: { + disabbleFetchTracking: randomBoolean(), // false block fetch tracking + disableExceptionTracking: randomBoolean(), + enableAutoRouteTracking: randomBoolean() + } + } + } + return newConfig; +} + +export function createDetailList(propsToWatch: string[], details: any, id: string, title: string) { + let container = document.getElementById(id); + let ele = document.createElement("div"); + ele.className = "list"; + let list = ""; + if (details) { + list += ` +
${title} Details
+

Not all auto-captured events and details are displayed here.

+

Check console and network trace for complete details

+ `; + + propsToWatch.forEach((prop) => { + let obj; + + if (details["baseData"]) { + obj = details["baseData"][prop] || details[prop] || details["baseData"]; + } else { + obj = details[prop] || details["baseData"]; + } + + if (analyticsDetails.includes(prop)) { + obj = details["extensionConfig"]["ApplicationInsightsAnalytics"][prop]; + } + if (ajaxDetails.includes(prop)) { + obj = details["extensionConfig"]["AjaxDependencyPlugin"][prop]; + } + if (prop === "item") { + obj = {name: obj.name, target: obj.target}; + } + + obj = (obj === undefined)? "undefined" : obj; + + if (typeof obj === "object") { + obj = JSON.stringify(obj); + } + list += `
  • ${prop}: ${obj}
  • `; + }); + list += "
    -------------------------
    "; + ele.innerHTML = list; + container?.appendChild(ele); + } +} + +export function createContainers() { + let container = document.createElement("div"); + container.className = "container"; + container.id = containerId; + let buttonSection = createSubContainer(buttonSectionId, "container"); + container.appendChild(buttonSection); + let configSection = createSubContainer(configContainerId); + container.appendChild(configSection); + let detailsSection = createSubContainer(detailsContainerId); + container.appendChild(detailsSection); + document.body.append(container); +} + +export function triggerException() { + // This will trigger exception telemetry automatically + throw new Error("error is triggered"); +} diff --git a/examples/AISKU/style/style.css b/examples/AISKU/style/style.css new file mode 100644 index 00000000..b4466f1b --- /dev/null +++ b/examples/AISKU/style/style.css @@ -0,0 +1,90 @@ +body { + margin: 0; +} + +h1 { + font-size: 1.875rem; + margin: 0.67rem 0; +} + +h2 { + font-size: 1.5rem; + margin: 0.83rem 0; +} + +h3 { + font-size: 1.25rem; + margin: 1rem 0; +} + +h4 { + font-size: 1.05rem; + margin: 1.33rem 0; +} + +h5 { + font-size: 1rem; + margin: 1.5rem 0; +} + +h6 { + font-size: 0.875rem; + margin: 0.3rem 0; +} + +.uppercase { + text-transform: uppercase; +} + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +ol, +ul { + margin: 1em 0; +} + +.container { + max-width: 1600px; + padding: 0 2rem; +} + +.container-main { + justify-content: space-between; + font-size: 0.9rem; + position: relative; + margin: 1rem auto; + padding-left: 1rem; + background-color: azure; + overflow: auto; + max-height: 350px; +} + + +body { + font-family: "Segoe UI", sans-serif; + font-size: 16px; + padding-left: 1rem; +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; +} +button { + font-family: "Segoe UI", sans-serif; + margin: 0.5rem; + padding: 0.2em; +} + +p{ + font-size: 12px; + margin: 0; +} \ No newline at end of file diff --git a/examples/AISKU/tsconfig.json b/examples/AISKU/tsconfig.json new file mode 100644 index 00000000..18c5361a --- /dev/null +++ b/examples/AISKU/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es6", + "sourceMap": true, + "inlineSources": true, + "moduleResolution": "node", + "outDir": "./dist-esm", + "rootDir": "./src", + "strict": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noImplicitAny": false, + "importHelpers": true, + "declaration": true, + "declarationDir": "./types", + "allowJs": true, + "resolveJsonModule": true + }, + "include": [ + "./src" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 6a9799ef..3ed5e8c8 100644 --- a/examples/README.md +++ b/examples/README.md @@ -7,6 +7,10 @@ but may not be executed as part of any automated test pass -- this may change/va [Shared Worker](./shared-worker/README.md) +[AISKU](./AISKU/README.md) + +[Dependency](./dependency/README.md) + ## Contributing This project welcomes contributions and suggestions. Most contributions require you to diff --git a/examples/dependency/README.md b/examples/dependency/README.md new file mode 100644 index 00000000..1a068046 --- /dev/null +++ b/examples/dependency/README.md @@ -0,0 +1,62 @@ +# Application Insights JavaScript SDK + +## Dependency Sample + +This Sample shows how to filter, modify, block and disable dependency data with [`addDependencyListener`](../../API-reference.md#adddependencylistener) and [`addDependencyInitializer`](../../API-reference.md#adddependencyinitializer). + +## Sample Build + +- Build the repository before running this example. +- Run `npm run serve` under root folder. +- Open `http://localhost:9001/examples/dependency/`. + +## Description + +- button `change-config` will change config dynamically. + +- button `add-handlers` will add a dependencyListener with the following changes: + + ```javascript + context.listener = "dependency-listener-context"; + traceFlags = 0; + ``` + + and a dependencyInitializer with the following changes: + + ```javascript + item.name = "dependency-name"; + item.properties.url = item.target; + context.initializer = "dependency-initializer-context"; + ``` + +- button `stop-dependency-event` will block all dependency events. + +- button `remove-all-handlers` will remove all previously added dependency initializers and listeners. + +- button `create-fetch-request` will trigger a fetch request. + +- button `create-xhr-request` will trigger a xhr request. + +- button `untrack-fetch-request` will trigger a fetch request that will be blocked. + +## 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 . + +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. For more information see the Code of Conduct FAQ or contact 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 [here](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. 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 diff --git a/examples/dependency/index.html b/examples/dependency/index.html new file mode 100644 index 00000000..2eed272f --- /dev/null +++ b/examples/dependency/index.html @@ -0,0 +1,20 @@ + + + + + + Dependency Sample + + + +

    Microsoft Application Insights JavaScript SDK - Dependencies

    + + + + + \ No newline at end of file diff --git a/examples/dependency/package.json b/examples/dependency/package.json new file mode 100644 index 00000000..e964f35f --- /dev/null +++ b/examples/dependency/package.json @@ -0,0 +1,57 @@ +{ + "name": "@microsoft/applicationinsights-example-dependencies", + "author": "Microsoft Application Insights Team", + "version": "2.8.10", + "description": "Microsoft Application Insights Dependencies Example", + "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme", + "keywords": [ + "azure", + "cloud", + "script errors", + "microsoft", + "application insights", + "browser performance monitoring", + "web analytics", + "example" + ], + "scripts": { + "clean": "grunt clean", + "build": "npm run build:esm && npm run build:browser", + "build:esm": "grunt example-dependency", + "build:browser": "rollup -c rollup.config.js", + "rebuild": "npm run build", + "test": "", + "mintest": "", + "perftest": "", + "lint": "tslint -p tsconfig.json", + "ai-min": "", + "ai-restore": "" + }, + "repository": { + "type": "git", + "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore" + }, + "license": "MIT", + "sideEffects": false, + "devDependencies": { + "@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", + "@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" + }, + "peerDependencies": { + "tslib": "*" + }, + "dependencies": { + "@microsoft/applicationinsights-shims": "2.0.2", + "@microsoft/dynamicproto-js": "^1.1.7", + "@microsoft/applicationinsights-web": "2.8.10", + "@microsoft/applicationinsights-dependencies-js": "2.8.10" + } +} \ No newline at end of file diff --git a/examples/dependency/rollup.config.js b/examples/dependency/rollup.config.js new file mode 100644 index 00000000..d5e50ff9 --- /dev/null +++ b/examples/dependency/rollup.config.js @@ -0,0 +1,98 @@ +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 = "dependencies-example-index"; +const banner = [ + "/*!", + ` * Application Insights JavaScript SDK Example - AISKU, ${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: [ "dependencies-example-index" ] }), + 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") +]; \ No newline at end of file diff --git a/examples/dependency/src/appinsights-init.ts b/examples/dependency/src/appinsights-init.ts new file mode 100644 index 00000000..83caf06c --- /dev/null +++ b/examples/dependency/src/appinsights-init.ts @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { ApplicationInsights, IConfiguration } from "@microsoft/applicationinsights-web"; +import { generateNewConfig } from "./utils"; +import { DependencyListenerFunction, DependencyInitializerFunction, IDependencyInitializerHandler, IDependencyListenerHandler } from "@microsoft/applicationinsights-dependencies-js"; + +// Cache the previously initialized instance to avoid creating multiple instances +let _appInsights: ApplicationInsights; + +export function initApplicationInsights(config?: IConfiguration) { + + if (!_appInsights) { + // Make sure we have a configuration object + config = config || {}; + if (!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; +} + +/** + * Use addDependencyListener to modify dependencyDetails if the SDK has been initialized + */ +export function addDependencyListener(dependencyListener: DependencyListenerFunction): IDependencyInitializerHandler | null { + if (_appInsights) { + return _appInsights.addDependencyListener(dependencyListener); + } + return null; +} + +/** + * Use addDependencyInitializer to modify dependencyInitializerDetails if the SDK has been initialized + */ +export function addDependencyInitializer(dependencyInitializer: DependencyInitializerFunction): IDependencyListenerHandler | null { + if (_appInsights) { + return _appInsights.addDependencyInitializer(dependencyInitializer); + } + return null; +} + +/** + * Use addDependencyInitializer to block any event from being reported + */ +export function stopDependencyEvent() { + if (_appInsights) { + _appInsights.addDependencyInitializer((details: any) => { + // Check console to view details + console.log("dependency event tracking is stopped, the following event will not be reported"); + console.log(details); + // To stop any event from being reported + return false; + }); + return true; + } + return false; + +} + +/** + * Get current config settings if the SDK has been initialized + */ +export function getConfig() { + if (_appInsights) { + let config = _appInsights["config"]; + console.log("current config"); + console.log(config); + return config; + } + return null; +} + +/** + * Change current config settings dynamically if the SDK has been initialized + */ +export function changeConfig() { + if (_appInsights) { + let newConfig = generateNewConfig(); // generate new config object + _appInsights["config"] = newConfig; // change config + return true; + } + return false; +} + + + +// // ****************************************************************************************************************************** +// // Snippet Initialization +// let _appInsights: any; + +// export function initApplicationInsights() { + +// if (!_appInsights) { +// _appInsights = (window as any).appInsights; +// return _appInsights; +// } + +// return _appInsights; +// } + +// // *********************************************************************************************************************************** + + diff --git a/examples/dependency/src/dependencies-example-index.ts b/examples/dependency/src/dependencies-example-index.ts new file mode 100644 index 00000000..3c9f1947 --- /dev/null +++ b/examples/dependency/src/dependencies-example-index.ts @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { addDependencyListener, addDependencyInitializer, stopDependencyEvent, changeConfig, initApplicationInsights, getConfig } from "./appinsights-init"; +import { addHandlersButtonId, buttonSectionId, changeConfigButtonId, clearDetailsButtonId, clearDetailsList, clearEle, configContainerId, configDetails, createButton, createContainers, createDetailList, createFetchRequest, createUnTrackRequest, createXhrRequest, dependencyInitializerDetails, dependencyInitializerDetailsContainerId, dependencyListenerButtonId, dependencyListenerDetails, dependencyListenerDetailsContainerId, fetchCallId, fetchXhrId, removeAllHandlersId, stopDependencyEventButtonId, untrackFetchRequestId } from "./utils"; + +let dependencyListenerHandler: any = null; +let dependencyInitializerHandler: any = null; + +// This function is an example of using addDependencyListener to modify dependencyDetails +function addDependencyListenerOnclick() { + dependencyListenerHandler = addDependencyListener((details: any) => { + // Check console to view details + console.log("The folloing event is passed to addDependencyListener"); + console.log(details); + // Add additional context values (any) that can be used by other listeners and is also passed to any dependency initializers + details.context.listener = "dependency-listener-context"; + details.traceFlags = 0; + + createDetailList(dependencyListenerDetails, details, dependencyListenerDetailsContainerId, "Listener"); + }); +} + +// This function is an example of using addDependencyInitializer to modify dependencyInitializerDetails +function addDependencyInitializerOnClick() { + dependencyInitializerHandler = addDependencyInitializer((details: any) => { + // Check console to view details + console.log("The folloing event is passed to addDependencyInitializer"); + console.log(details); + // Events from https://api.npms.io/v2/search?q=angular&size=1 will not be reported + if (details.item?.target === "https://api.npms.io/v2/search?q=angular&size=1") { + return false; + } + // Change properties of telemetry event "before" it's been processed + details.item.name = "dependency-name"; + details.item.properties.url = details.item?.target; + details.context.initializer = "dependency-initializer-context"; + + createDetailList(dependencyInitializerDetails, details, dependencyInitializerDetailsContainerId, "Initializer"); + }); +} + +// This function is an example of removing addDependencyInitializer and addDependencyListener +function removeAllHandlers() { + if (dependencyInitializerHandler) { + // Remove the dependency initializer + dependencyInitializerHandler.remove(); + console.log("dependencyInitializerHandler is removed"); + } + + if (dependencyListenerHandler) { + // Remove the dependency Listener + dependencyListenerHandler.remove(); + console.log("dependencyListenerHandler is removed"); + } +} + +function createConfigDetails() { + let config = getConfig(); + clearEle(configContainerId); + createDetailList(configDetails, config, configContainerId, "Config"); +} + +function changeConfigOnClick() { + changeConfig(); + createConfigDetails(); +} + +function onAddHandlersClick() { + addDependencyListenerOnclick(); + addDependencyInitializerOnClick(); +} + +function createButtonSection() { + let container = document.getElementById(buttonSectionId); + let changeConfigBtn = createButton(changeConfigButtonId, changeConfigOnClick, changeConfigButtonId); + let handlersBtn = createButton(addHandlersButtonId, onAddHandlersClick, dependencyListenerButtonId); + let fetchButton = createButton(fetchCallId, createFetchRequest); + let xhrButton = createButton(fetchXhrId, createXhrRequest); + let untrackRequestButton = createButton(untrackFetchRequestId, createUnTrackRequest); + let stopEventButton = createButton(stopDependencyEventButtonId, stopDependencyEvent); + let removeHandlersButton = createButton(removeAllHandlersId, removeAllHandlers); + let clearBtn = createButton(clearDetailsButtonId, clearDetailsList); + let buttons = [changeConfigBtn, handlersBtn, fetchButton, xhrButton, untrackRequestButton, stopEventButton, removeHandlersButton, clearBtn]; + buttons.forEach(ele => { + container?.appendChild(ele); + }); +} + +function dependencySample() { + initApplicationInsights(); + createContainers(); + createButtonSection(); + createConfigDetails(); +} +dependencySample(); diff --git a/examples/dependency/src/utils.ts b/examples/dependency/src/utils.ts new file mode 100644 index 00000000..9c7cf51d --- /dev/null +++ b/examples/dependency/src/utils.ts @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +export const containerId = "dependency-sample-container"; +export const dependencyListenerButtonId = "dependency-listener-button"; +export const dependencyListenerDetailsContainerId = "dependency-listener-detail-container"; +export const dependencyInitializerDetailsContainerId = "dependency-initializer-detail-container"; +export const stopDependencyEventButtonId = "stop-dependency-events"; +export const changeConfigButtonId = "change-config"; +export const fetchCallId = "create-fetch-request"; +export const fetchXhrId = "create-xhr-request"; +export const untrackFetchRequestId = "create-untrack-fetch-request"; +export const removeAllHandlersId = "remove-all-handlers"; +export const buttonSectionId = "button-section"; +export const clearDetailsButtonId = "clear-all-details"; +export const addHandlersButtonId = "add-handlers"; +export const configContainerId = "config-details"; +export const dependencyListenerDetails: string[] = ["input","traceId","spanId","traceFlags","context"]; // check full details in console +export const dependencyInitializerDetails: string[] = ["item","properties","sysProperties","context"]; // check full details in console +export const ajaxDetails: string[] = ["disabbleFetchTracking", "disableExceptionTracking", "enableAutoRouteTracking"]; +export const analyticsDetails: string[] = ["autoTrackPageVisitTime", "appId", "enableAjaxPerfTracking", "enableCorsCorrelation"]; +export const configDetails: string[] = ["connectionString",...ajaxDetails, ...analyticsDetails]; // check full details in console + +export function createFetchRequest() { + fetch("https://api.npms.io/v2/search?q=react&size=1").then(() =>{ + console.log("a fetch call triggered"); + }); +} + +export function createXhrRequest() { + let xhr = new XMLHttpRequest(); + xhr.open("GET", "https://api.npms.io/v2/search?q=react&size=1"); + xhr.onload = function() { + console.log("a xhr call triggered"); + }; + xhr.send(); +} + +export function createUnTrackRequest() { + fetch("https://api.npms.io/v2/search?q=angular&size=1").then(() =>{ + console.log("a untracked fetch call triggered"); + }); +} + +export function randomBoolean() { + if (Math.random() > 0.5) { + return true; + } + return false; +} + +export function createDetailList(propsToWatch: string[], details: any, id: string, title: string) { + let container = document.getElementById(id); + let ele = document.createElement("div"); + ele.className = "list"; + let date = new Date(); + let list = ""; + if (details) { + list += ` +
    Dependency ${title} Details After Modifications
    +
    Check console for details before modifications and network trace for complete details
    +
    Date: ${date}
    + `; + + propsToWatch.forEach((prop) => { + + let obj = details[prop]; + if (prop === "item") { + obj = {name: obj.name, target: obj.target}; + } + if (analyticsDetails.includes(prop)) { + obj = details["extensionConfig"]["ApplicationInsightsAnalytics"][prop]; + } + if (ajaxDetails.includes(prop)) { + obj = details["extensionConfig"]["AjaxDependencyPlugin"][prop]; + } + obj = (obj === undefined)? "undefined" : obj; + if (typeof obj === "object") { + obj = JSON.stringify(obj); + } + list += `
  • ${prop}: ${obj}
  • `; + }); + list += "
    -------------------------
    "; + ele.innerHTML = list; + container?.appendChild(ele); + } +} + +export function createContainers() { + let container = document.createElement("div"); + container.className = "container"; + container.id = containerId; + let buttonSection = createSubContainer(buttonSectionId, "container"); + container.appendChild(buttonSection); + let configSection = createSubContainer(configContainerId); + container.appendChild(configSection); + let ListenerSection = createSubContainer(dependencyListenerDetailsContainerId); + container.appendChild(ListenerSection); + let initializerSection = createSubContainer(dependencyInitializerDetailsContainerId); + container.appendChild(initializerSection); + document.body.appendChild(container); +} + +export function createSubContainer(id: string, className?: string) { + let ele = document.createElement("div"); + ele.className = className || "container-main"; + ele.id = id; + return ele +} + +export function createButton(buttonTextContent: string, buttonOnclickFn: any, id?: string): HTMLButtonElement { + let btn = document.createElement("button"); + if (id) { + btn.id = id; + } + btn.innerHTML = buttonTextContent + btn.onclick = buttonOnclickFn; + return btn; +} + +export function generateNewConfig() { + let prefix = Math.random().toString(36).slice(6); + + let newConfig: any = { + connectionString: `InstrumentationKey=newKey${prefix}`, + extensionConfig: { + ApplicationInsightsAnalytics: { + autoTrackPageVisitTime: randomBoolean(), + appId: Math.random().toString(36).slice(8), + enableAjaxPerfTracking: randomBoolean(), + enableCorsCorrelation: randomBoolean() + }, + AjaxDependencyPlugin: { + disabbleFetchTracking: randomBoolean(), // if true, fetch tracking will be blocked + disableExceptionTracking: randomBoolean(), + enableAutoRouteTracking: randomBoolean() + } + } + } + return newConfig; +} + +export function clearEle(id: string) { + let ele = document.getElementById(id); + if (ele) { + ele.innerHTML = ""; + } +} + +export function clearDetailsList() { + clearEle(dependencyListenerDetailsContainerId); + clearEle(dependencyInitializerDetailsContainerId); +} + diff --git a/examples/dependency/style/style.css b/examples/dependency/style/style.css new file mode 100644 index 00000000..2115d002 --- /dev/null +++ b/examples/dependency/style/style.css @@ -0,0 +1,87 @@ +body { + margin: 0; + font-family: "Segoe UI", sans-serif; + font-size: 16px; + padding-left: 1rem; +} + +h1 { + font-size: 1.875rem; + margin: 0.67rem 0; +} + +h2 { + font-size: 1.5rem; + margin: 0.83rem 0; +} + +h3 { + font-size: 1.25rem; + margin: 1rem 0; +} + +h4 { + font-size: 1.05rem; + margin: 1.33rem 0; +} + +h5 { + font-size: 1rem; + margin: 0.67rem 0; +} + +h6 { + font-size: 0.875rem; + margin: 0.3rem 0; +} + +.uppercase { + text-transform: uppercase; +} + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +ol, +ul { + margin: 1em 0; +} + +.container { + max-width: 1600px; + padding: 0 0.5rem; +} + +.container-main { + justify-content: space-between; + font-size: 0.9rem; + position: relative; + margin: 1.5rem auto; + padding-left: 0.5rem; + max-height: 200px; + overflow: auto; + background-color: azure; +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + padding: 0.2em; + margin: 0; + font-size: 0.875rem; + border-radius: 0.8em; +} + +button { + font-family: "Segoe UI", sans-serif; + margin: 0.5rem; + padding: 0.2em; +} + +.time { + font-weight: bold; + font-size: 0.8rem; +} \ No newline at end of file diff --git a/examples/dependency/tsconfig.json b/examples/dependency/tsconfig.json new file mode 100644 index 00000000..18c5361a --- /dev/null +++ b/examples/dependency/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es6", + "sourceMap": true, + "inlineSources": true, + "moduleResolution": "node", + "outDir": "./dist-esm", + "rootDir": "./src", + "strict": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noImplicitAny": false, + "importHelpers": true, + "declaration": true, + "declarationDir": "./types", + "allowJs": true, + "resolveJsonModule": true + }, + "include": [ + "./src" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/gruntfile.js b/gruntfile.js index 3705b6c4..ae9addbf 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -445,6 +445,18 @@ module.exports = function (grunt) { path: "./examples/shared-worker", testHttp: false }, + + "example-aisku": { + autoMinify: false, + path: "./examples/AISKU", + testHttp: false + }, + + "example-dependency": { + autoMinify: false, + path: "./examples/dependency", + testHttp: false + }, // Tools "rollupuglify": { @@ -502,7 +514,7 @@ module.exports = function (grunt) { "./common/Tests/Framework/src/*.ts" ] } - } + }, })); function tsBuildActions(name, addTests, replaceName) { @@ -768,6 +780,10 @@ module.exports = function (grunt) { grunt.registerTask("tst-framework", tsBuildActions("tst-framework")); grunt.registerTask("serve", ["connect:server:keepalive"]); + + + grunt.registerTask("example-aisku", tsBuildActions("example-aisku")); + grunt.registerTask("example-dependency", tsBuildActions("example-dependency")); } catch (e) { console.error(e); console.error("stack: '" + e.stack + "', message: '" + e.message + "', name: '" + e.name + "'"); diff --git a/rush.json b/rush.json index e701eda0..c5e62689 100644 --- a/rush.json +++ b/rush.json @@ -104,6 +104,16 @@ "projectFolder": "tools/config", "shouldPublish": false }, + { + "packageName": "@microsoft/applicationinsights-example-aisku", + "projectFolder": "examples/AISKU", + "shouldPublish": false + }, + { + "packageName": "@microsoft/applicationinsights-example-dependencies", + "projectFolder": "examples/dependency", + "shouldPublish": false + }, { "packageName": "@microsoft/applicationinsights-example-shared-worker", "projectFolder": "examples/shared-worker",