From d4739adfa68c26ebed24183633a53921bc4255fb Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Wed, 20 Sep 2023 04:28:23 +0530 Subject: [PATCH 01/22] added gulp file and webpack config file to compile copresence worker script --- gulpfile.mjs | 14 ++++++++++-- webpack.config.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/gulpfile.mjs b/gulpfile.mjs index 04422778..bf54bc6e 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -34,7 +34,7 @@ import { createRequire } from "node:module"; const require = createRequire(import.meta.url); import webpackConfig from './webpack.config.js'; -const [nodeConfig, webConfig] = webpackConfig; +const [nodeConfig, webConfig, copresenceWorkerConfig] = webpackConfig; const distdir = path.resolve('./dist'); const outdir = path.resolve('./out'); const packagedir = path.resolve('./package'); @@ -81,6 +81,14 @@ function compileWeb() { .pipe(gulp.dest(path.resolve(`${distdir}/web`))); } +// compile the web worker for copresence +function compileWorker() { + return gulp + .src(["src/web/**/*.ts"]) + .pipe(gulpWebpack(copresenceWorkerConfig, webpack)) + .pipe(gulp.dest(path.resolve(`${distdir}/web`))); +} + async function nugetInstall(nugetSource, packageName, version, targetDir) { // https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource const feeds = { @@ -378,7 +386,8 @@ const recompile = gulp.series( translationsImport, setTelemetryTarget, compile, - compileWeb + compileWeb, + compileWorker, ); const dist = gulp.series( @@ -440,6 +449,7 @@ export { clean, compile, compileWeb, + compileWorker, recompile, snapshot, lint, diff --git a/webpack.config.js b/webpack.config.js index 504fb647..b3954b70 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -122,4 +122,58 @@ const webConfig = { }, }; -module.exports = [nodeConfig, webConfig]; +/** @type fluent container scripts web worker config */ +const copresenceWorkerConfig = { + mode: "none", + target: "webworker", // web extensions run in a webworker context + entry: { + main: "./src/web/client/services/copresenceWorker.js", + }, + output: { + filename: "[name].js", + path: path.join(__dirname, "./dist/web"), + libraryTarget: "self", + }, + resolve: { + extensions: [".ts", ".js"], // support ts-files and js-files + alias: {}, + fallback: { + path: require.resolve("path-browserify"), + tty: require.resolve("tty-browserify"), + os: require.resolve("os-browserify/browser"), + stream: require.resolve("stream-browserify"), + http: require.resolve("stream-http"), + zlib: require.resolve("browserify-zlib"), + https: require.resolve("https-browserify"), + }, + }, + module: { + rules: [ + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: "ts-loader", + }, + ], + }, + { + test: /copresenceWorker\.js$/, + use: { + loader: "worker-loader", + options: { inline: "fallback" }, + }, + }, + ], + }, + externals: { + vscode: "commonjs vscode", // ignored because it doesn't exist + }, + performance: { + hints: false, + }, + devtool: "source-map", +}; + +module.exports = [nodeConfig, webConfig, copresenceWorkerConfig]; From b28a5f09e28c316fed7bfe80a3e1a1d03ba0cde1 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Wed, 20 Sep 2023 13:15:30 +0530 Subject: [PATCH 02/22] dependencies installed --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 760266fd..38ec0e53 100644 --- a/package.json +++ b/package.json @@ -993,10 +993,13 @@ "command-exists": "^1.2.9", "find-process": "^1.4.7", "glob": "^7.1.7", + "https-browserify": "^1.0.0", "liquidjs": "^10.2.0", "n-readlines": "^1.0.1", "puppeteer-core": "^14.4.1", "recursive-readdir": "^2.2.3", + "stream-http": "^3.2.0", + "tty-browserify": "^0.0.1", "unzip-stream": "^0.3.1", "uuid": "^8.3.2", "vscode-languageclient": "^7.0.0", From c316abac705107b6ee4fce38372dc3e72c53167b Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 19 Oct 2023 01:10:15 +0530 Subject: [PATCH 03/22] updated gulp file and webpack file to compile webworker script --- gulpfile.mjs | 6 +- package-lock.json | 207 +++++++++++++++++++++++++--------------------- package.json | 1 + webpack.config.js | 8 +- 4 files changed, 121 insertions(+), 101 deletions(-) diff --git a/gulpfile.mjs b/gulpfile.mjs index d22647e7..4e9b1044 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -34,7 +34,7 @@ import { createRequire } from "node:module"; const require = createRequire(import.meta.url); import webpackConfig from './webpack.config.js'; -const [nodeConfig, webConfig, copresenceWorkerConfig] = webpackConfig; +const [nodeConfig, webConfig, webWorkerConfig] = webpackConfig; const distdir = path.resolve('./dist'); const outdir = path.resolve('./out'); const packagedir = path.resolve('./package'); @@ -81,11 +81,11 @@ function compileWeb() { .pipe(gulp.dest(path.resolve(`${distdir}/web`))); } -// compile the web worker for copresence +// compile the web worker for vscode for web function compileWorker() { return gulp .src(["src/web/**/*.ts"]) - .pipe(gulpWebpack(copresenceWorkerConfig, webpack)) + .pipe(gulpWebpack(webWorkerConfig, webpack)) .pipe(gulp.dest(path.resolve(`${distdir}/web`))); } diff --git a/package-lock.json b/package-lock.json index e117e30c..99f8d78c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,15 +20,19 @@ "fluid-framework": "^1.3.7", "glob": "^7.1.7", "gpt-tokenizer": "^2.1.1", + "https-browserify": "^1.0.0", "liquidjs": "^10.2.0", "n-readlines": "^1.0.1", "puppeteer-core": "^14.4.1", "recursive-readdir": "^2.2.3", + "stream-http": "^3.2.0", + "tty-browserify": "^0.0.1", "unzip-stream": "^0.3.1", "uuid": "^8.3.2", "vscode-languageclient": "^7.0.0", "vscode-languageserver": "^7.0.0", "vscode-languageserver-textdocument": "^1.0.1", + "worker-loader": "^3.0.8", "yaml": "^2.2.2" }, "devDependencies": { @@ -2434,7 +2438,6 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -2448,7 +2451,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -2457,7 +2459,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, "engines": { "node": ">=6.0.0" } @@ -2466,7 +2467,6 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", - "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.0", "@jridgewell/trace-mapping": "^0.3.9" @@ -2475,14 +2475,12 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -3086,7 +3084,6 @@ "version": "8.4.10", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", - "dev": true, "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -3096,7 +3093,6 @@ "version": "3.7.4", "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", - "dev": true, "dependencies": { "@types/eslint": "*", "@types/estree": "*" @@ -3105,8 +3101,7 @@ "node_modules/@types/estree": { "version": "0.0.51", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", - "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", - "dev": true + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "node_modules/@types/events": { "version": "3.0.1", @@ -3141,8 +3136,7 @@ "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==" }, "node_modules/@types/jwt-decode": { "version": "2.2.0", @@ -3170,8 +3164,7 @@ "node_modules/@types/node": { "version": "14.18.34", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.34.tgz", - "integrity": "sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA==", - "devOptional": true + "integrity": "sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA==" }, "node_modules/@types/node-fetch": { "version": "2.6.2", @@ -3838,7 +3831,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", - "dev": true, "dependencies": { "@webassemblyjs/helper-numbers": "1.11.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.1" @@ -3847,26 +3839,22 @@ "node_modules/@webassemblyjs/floating-point-hex-parser": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", - "dev": true + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", - "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", - "dev": true + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", - "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", - "dev": true + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", - "dev": true, "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.1", "@webassemblyjs/helper-api-error": "1.11.1", @@ -3876,14 +3864,12 @@ "node_modules/@webassemblyjs/helper-wasm-bytecode": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", - "dev": true + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -3895,7 +3881,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", - "dev": true, "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -3904,7 +3889,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", - "dev": true, "dependencies": { "@xtuc/long": "4.2.2" } @@ -3912,14 +3896,12 @@ "node_modules/@webassemblyjs/utf8": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", - "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", - "dev": true + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -3935,7 +3917,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.1", @@ -3948,7 +3929,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -3960,7 +3940,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-api-error": "1.11.1", @@ -3974,7 +3953,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", - "dev": true, "dependencies": { "@webassemblyjs/ast": "1.11.1", "@xtuc/long": "4.2.2" @@ -4019,14 +3997,12 @@ "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, "node_modules/abbrev": { "version": "1.1.1", @@ -4061,7 +4037,6 @@ "version": "8.8.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", - "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -4073,7 +4048,6 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", - "dev": true, "peerDependencies": { "acorn": "^8" } @@ -4144,7 +4118,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -4160,7 +4133,6 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, "peerDependencies": { "ajv": "^6.9.1" } @@ -4940,6 +4912,14 @@ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "engines": { + "node": "*" + } + }, "node_modules/binary": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", @@ -5034,7 +5014,6 @@ "version": "4.21.4", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", - "dev": true, "funding": [ { "type": "opencollective", @@ -5104,8 +5083,7 @@ "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, "node_modules/buffers": { "version": "0.1.1", @@ -5128,6 +5106,11 @@ "node": ">=6.14.2" } }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" + }, "node_modules/builtins": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", @@ -5366,7 +5349,6 @@ "version": "1.0.30001439", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001439.tgz", "integrity": "sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A==", - "dev": true, "funding": [ { "type": "opencollective", @@ -5529,7 +5511,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", - "dev": true, "engines": { "node": ">=6.0" } @@ -6473,8 +6454,7 @@ "node_modules/electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", - "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", - "dev": true + "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==" }, "node_modules/emitter-listener": { "version": "1.1.2", @@ -6489,6 +6469,14 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, + "node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "engines": { + "node": ">= 4" + } + }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -6559,7 +6547,6 @@ "version": "5.12.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", - "dev": true, "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -6628,8 +6615,7 @@ "node_modules/es-module-lexer": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", - "dev": true + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" }, "node_modules/es5-ext": { "version": "0.10.62", @@ -6695,7 +6681,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, "engines": { "node": ">=6" } @@ -6787,7 +6772,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -6909,7 +6893,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -6921,7 +6904,6 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, "engines": { "node": ">=4.0" } @@ -6930,7 +6912,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, "engines": { "node": ">=4.0" } @@ -7282,8 +7263,7 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { "version": "3.2.12", @@ -7314,8 +7294,7 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -8106,8 +8085,7 @@ "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" }, "node_modules/glob-watcher": { "version": "5.0.5", @@ -9668,6 +9646,11 @@ "node": ">= 6" } }, + "node_modules/https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==" + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -10476,7 +10459,6 @@ "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", - "dev": true, "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -10490,7 +10472,6 @@ "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -10547,8 +10528,7 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -10565,7 +10545,6 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, "bin": { "json5": "lib/cli.js" }, @@ -10962,11 +10941,23 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "dev": true, "engines": { "node": ">=6.11.5" } }, + "node_modules/loader-utils": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", + "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + }, + "engines": { + "node": ">=8.9.0" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -12390,8 +12381,7 @@ "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "node_modules/next-tick": { "version": "1.1.0", @@ -12540,8 +12530,7 @@ "node_modules/node-releases": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", - "dev": true + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==" }, "node_modules/nopt": { "version": "6.0.0", @@ -13607,8 +13596,7 @@ "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -14019,7 +14007,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true, "engines": { "node": ">=6" } @@ -14162,7 +14149,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, "dependencies": { "safe-buffer": "^5.1.0" } @@ -15053,7 +15039,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -15097,7 +15082,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, "dependencies": { "randombytes": "^2.1.0" } @@ -15600,7 +15584,6 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -15623,7 +15606,6 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -15854,6 +15836,30 @@ "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", "dev": true }, + "node_modules/stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "node_modules/stream-http/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -16108,7 +16114,6 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "dev": true, "engines": { "node": ">=6" } @@ -16231,7 +16236,6 @@ "version": "5.16.1", "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz", "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==", - "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -16249,7 +16253,6 @@ "version": "5.3.6", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz", "integrity": "sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==", - "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.14", "jest-worker": "^27.4.5", @@ -16283,7 +16286,6 @@ "version": "0.3.17", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, "dependencies": { "@jridgewell/resolve-uri": "3.1.0", "@jridgewell/sourcemap-codec": "1.4.14" @@ -16292,8 +16294,7 @@ "node_modules/terser/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "node_modules/test-exclude": { "version": "6.0.0", @@ -16720,6 +16721,11 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, + "node_modules/tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" + }, "node_modules/tuf-js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz", @@ -17043,7 +17049,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", - "dev": true, "funding": [ { "type": "opencollective", @@ -17069,7 +17074,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -17366,7 +17370,6 @@ "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "dev": true, "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -17390,7 +17393,6 @@ "version": "5.76.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz", "integrity": "sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==", - "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", @@ -17527,7 +17529,6 @@ "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "dev": true, "engines": { "node": ">=10.13.0" } @@ -17685,6 +17686,25 @@ "node": ">=0.10.0" } }, + "node_modules/worker-loader": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz", + "integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, "node_modules/workerpool": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", @@ -17808,7 +17828,6 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true, "engines": { "node": ">=0.4" } diff --git a/package.json b/package.json index 187645ed..f8d47de6 100644 --- a/package.json +++ b/package.json @@ -1049,6 +1049,7 @@ "vscode-languageclient": "^7.0.0", "vscode-languageserver": "^7.0.0", "vscode-languageserver-textdocument": "^1.0.1", + "worker-loader": "^3.0.8", "yaml": "^2.2.2" }, "__metadata": { diff --git a/webpack.config.js b/webpack.config.js index b3954b70..c27c00a8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -123,11 +123,11 @@ const webConfig = { }; /** @type fluent container scripts web worker config */ -const copresenceWorkerConfig = { +const webWorkerConfig = { mode: "none", target: "webworker", // web extensions run in a webworker context entry: { - main: "./src/web/client/services/copresenceWorker.js", + main: "./src/web/client/common/worker/webworker.js", }, output: { filename: "[name].js", @@ -159,7 +159,7 @@ const copresenceWorkerConfig = { ], }, { - test: /copresenceWorker\.js$/, + test: /webworker\.js$/, use: { loader: "worker-loader", options: { inline: "fallback" }, @@ -176,4 +176,4 @@ const copresenceWorkerConfig = { devtool: "source-map", }; -module.exports = [nodeConfig, webConfig, copresenceWorkerConfig]; +module.exports = [nodeConfig, webConfig, webWorkerConfig]; From 1a1641c764d0bd5947e2c4e0039c72005c093b20 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 19 Oct 2023 10:50:03 +0530 Subject: [PATCH 04/22] passed entity id while loading container & few nit changes --- src/web/client/common/worker/webworker.js | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/web/client/common/worker/webworker.js b/src/web/client/common/worker/webworker.js index ce55678a..ffaebb96 100644 --- a/src/web/client/common/worker/webworker.js +++ b/src/web/client/common/worker/webworker.js @@ -80,7 +80,7 @@ class AzureFluidClient { } } -async function loadContainer(config, id, swpId) { +async function loadContainer(config, swpId, entityId) { try { const { container, audience, map } = await AzureFluidClient.fetchContainerAndService(config, swpId); @@ -101,14 +101,15 @@ async function loadContainer(config, id, swpId) { if (!initial) { existingMembers.forEach(async (value, key) => { const otherUser = value; - const connectionArray = otherUser.connections; - const entityId = []; + const userConnections = otherUser.connections; + + const userEntityIdArray = []; const connectionIdInContainer = await (container.initialObjects.sharedState.get('selection').get()); - connectionArray.forEach((connectionId) => { - entityId.push(connectionIdInContainer.get(connectionId)); + userConnections.forEach((connection) => { + userEntityIdArray.push(connectionIdInContainer.get(connection.id)); }); self.postMessage({ @@ -116,7 +117,7 @@ async function loadContainer(config, id, swpId) { userName: otherUser.userName, userId: key, containerId: swpId, - entityId: entityId, + entityId: userEntityIdArray, }); }); initial = true; @@ -127,14 +128,14 @@ async function loadContainer(config, id, swpId) { return; } else { const otherUser = map.get(changed.key); - const connectionArray = otherUser.connections; + const userConnections = otherUser.connections; - const entityId = []; + const userEntityIdArray = []; const connectionIdInContainer = await (container.initialObjects.sharedState.get('selection').get()); - connectionArray.forEach((connectionId) => { - entityId.push(connectionIdInContainer.get(connectionId)); + userConnections.forEach((connection) => { + userEntityIdArray.push(connectionIdInContainer.get(connection.id)); }); // eslint-disable-next-line no-undef @@ -143,7 +144,7 @@ async function loadContainer(config, id, swpId) { userId: changed.key, userName: otherUser.userName, containerId: swpId, - entityId: entityId, + entityId: userEntityIdArray, }); } }); @@ -160,8 +161,8 @@ function runFluidApp() { await loadContainer( message.afrConfig, - message.containerId, message.afrConfig.swpId, + message.entityId ); }); } From a2602e353327c518c6662290ad613671f622f7fb Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 19 Oct 2023 10:54:53 +0530 Subject: [PATCH 05/22] creating web worker instance get or create sharedworkspace for copresence --- src/web/client/WebExtensionContext.ts | 70 +++++++++++++- src/web/client/common/constants.ts | 7 ++ src/web/client/extension.ts | 103 ++++++++++++++++++++- src/web/client/utilities/urlBuilderUtil.ts | 24 ++++- 4 files changed, 199 insertions(+), 5 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index ec8f8ae6..e20176a9 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -21,7 +21,7 @@ import { getWebsiteIdToLcidMap, getWebsiteLanguageIdToPortalLanguageIdMap, } from "./utilities/schemaHelperUtil"; -import { getCustomRequestURL } from "./utilities/urlBuilderUtil"; +import { getCustomRequestURL, getOrCreateSharedWorkspace } from "./utilities/urlBuilderUtil"; import { schemaKey } from "./schema/constants"; import { telemetryEventNames } from "./telemetry/constants"; import { EntityDataMap } from "./context/entityDataMap"; @@ -29,6 +29,7 @@ import { FileDataMap } from "./context/fileDataMap"; import { IAttributePath, IEntityInfo } from "./common/interfaces"; import { ConcurrencyHandler } from "./dal/concurrencyHandler"; import { isMultifileEnabled } from "./utilities/commonUtil"; +import { UserDataMap } from "./context/userDataMap"; export interface IWebExtensionContext { // From portalSchema properties @@ -82,6 +83,7 @@ class WebExtensionContext implements IWebExtensionContext { private _vscodeWorkspaceState: Map; private _languageIdCodeMap: Map; private _portalLanguageIdCodeMap: Map; + private _sharedWorkSpaceMap: Map; private _websiteLanguageIdToPortalLanguageMap: Map; private _websiteIdToLanguage: Map; private _rootDirectory: vscode.Uri; @@ -92,6 +94,8 @@ class WebExtensionContext implements IWebExtensionContext { private _showMultifileInVSCode: boolean; private _extensionActivationTime: number; private _extensionUri: vscode.Uri; + private _containerId: string; + private _connectedUsers: UserDataMap; private _dataverseAccessToken: string; private _entityDataMap: EntityDataMap; private _isContextSet: boolean; @@ -115,6 +119,9 @@ class WebExtensionContext implements IWebExtensionContext { public get urlParametersMap() { return this._urlParametersMap; } + public get sharedWorkSpaceMap() { + return this._sharedWorkSpaceMap; + } public get vscodeWorkspaceState() { return this._vscodeWorkspaceState; } @@ -148,6 +155,15 @@ class WebExtensionContext implements IWebExtensionContext { public get showMultifileInVSCode() { return this._showMultifileInVSCode; } + public get containerId() { + return this._containerId; + } + public set containerId(containerId: string) { + this._containerId = containerId; + } + public get connectedUsers() { + return this._connectedUsers; + } public get extensionActivationTime() { return this._extensionActivationTime } @@ -193,6 +209,7 @@ class WebExtensionContext implements IWebExtensionContext { this._websiteLanguageIdToPortalLanguageMap = new Map(); this._websiteIdToLanguage = new Map(); this._urlParametersMap = new Map(); + this._sharedWorkSpaceMap = new Map(); this._vscodeWorkspaceState = new Map(); this._entitiesFolderNameMap = new Map(); this._defaultEntityType = ""; @@ -205,6 +222,8 @@ class WebExtensionContext implements IWebExtensionContext { this._showMultifileInVSCode = false; this._extensionActivationTime = new Date().getTime(); this._extensionUri = vscode.Uri.parse(""); + this._containerId = ""; + this._connectedUsers = new UserDataMap(); this._isContextSet = false; this._currentSchemaVersion = ""; this._websiteLanguageCode = ""; @@ -331,6 +350,14 @@ class WebExtensionContext implements IWebExtensionContext { } this._dataverseAccessToken = accessToken; + + const websiteid = this.urlParametersMap.get( + Constants.queryParameters.WEBSITE_ID + ) as string; + + const headers = getCommonHeaders(accessToken); + + await this.populateSharedworkspace(headers, dataverseOrgUrl, websiteid); } public async updateFileDetailsInContext( @@ -574,6 +601,47 @@ class WebExtensionContext implements IWebExtensionContext { } } + private async populateSharedworkspace( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + headers: any, + dataverseOrgUrl: string, + websiteid: string + ) { + const sharedworkspace = await getOrCreateSharedWorkspace({ + headers, + dataverseOrgUrl, + websiteid, + }); + + const sharedWorkSpaceParamsMap = new Map(); + for (const key in sharedworkspace) { + sharedWorkSpaceParamsMap.set( + String(key).trim().toLocaleLowerCase(), + String(sharedworkspace[key]).trim() + ); + } + + this._sharedWorkSpaceMap = sharedWorkSpaceParamsMap; + } + + public async updateConnectedUsersInContext( + containerId: string, + userName: string, + userId: string, + entityId: string[] + ) { + this.connectedUsers.setUserData( + containerId, + userName, + userId, + entityId + ); + } + + public async removeConnectedUserInContext(userId: string) { + this.connectedUsers.removeUser(userId); + } + private async setWebsiteLanguageCode() { const lcid = this.websiteIdToLanguage.get( diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index f11a2358..ad3abdb4 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -53,6 +53,13 @@ export const MULTI_FILE_FEATURE_SETTING_NAME = "enableMultiFileFeature"; // Co-presence feature constants export const CO_PRESENCE_FEATURE_SETTING_NAME = "enableCoPresenceFeature"; +export enum sharedWorkspaceParameters { + SHAREWORKSPACE_ID = "sharedworkspaceid", + TENANT_ID = "tenantid", + ACCESS_TOKEN = "accesstoken", + DISCOVERY_ENDPOINT = "discoveryendpoint", +} + export enum initializationEntityName { WEBSITE = "websites", WEBSITELANGUAGE = "websitelanguages", diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 5608a813..57cc7a45 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -33,6 +33,7 @@ import * as copilot from "../../common/copilot/PowerPagesCopilot"; import { IOrgInfo } from "../../common/copilot/model"; import { copilotNotificationPanel, disposeNotificationPanel } from "../../common/copilot/welcome-notification/CopilotNotificationPanel"; import { COPILOT_NOTIFICATION_DISABLED } from "../../common/copilot/constants"; +import * as Constants from "./common/constants" export function activate(context: vscode.ExtensionContext): void { // setup telemetry @@ -184,7 +185,7 @@ export function activate(context: vscode.ExtensionContext): void { processWillSaveDocument(context); - processWillStartCollaboartion(); + processWillStartCollaboartion(context); showWalkthrough(context, WebExtensionContext.telemetry); } @@ -268,12 +269,108 @@ export function processWillSaveDocument(context: vscode.ExtensionContext) { ); } -export function processWillStartCollaboartion() { +export function processWillStartCollaboartion(context: vscode.ExtensionContext) { if (isCoPresenceEnabled()) { - // TODO: Add copresence logic + processOpenActiveTextEditor(context); + createWebWorkerInstance(context); } } +let worker: Worker; + +export function processOpenActiveTextEditor(context: vscode.ExtensionContext) { + try { + context.subscriptions.push( + vscode.window.onDidChangeTextEditorSelection(async () => { + const activeEditor = vscode.window.activeTextEditor; + + const swpId = WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID + ) as string; + + const swptenantId = WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.TENANT_ID + ) as string; + + const swpAccessToken = + WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.ACCESS_TOKEN + ) as string; + + const discoveryendpoint = + WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT + ) as string; + + if (activeEditor) { + const entityId = + WebExtensionContext.fileDataMap.getFileMap.get( + activeEditor.document.uri.fsPath + )?.entityId as string; + + if (entityId) { + worker.postMessage({ + afrConfig: { + swpId, + swptenantId, + discoveryendpoint, + swpAccessToken, + }, + entityId, + }); + } + } + }) + ); + } catch (error) { + // TODO: add Telemetry + } +} + +export function createWebWorkerInstance( + context: vscode.ExtensionContext +) { + const webworkerMain = vscode.Uri.joinPath( + context.extensionUri, + "dist/web/webworker.worker.js" + ); + + const workerUrl = new URL(webworkerMain.toString()); + + fetch(workerUrl) + .then((response) => response.text()) + .then((workerScript) => { + const workerBlob = new Blob([workerScript], { + type: "application/javascript", + }); + + const workerUrl = URL.createObjectURL(workerBlob); + + worker = new Worker(workerUrl); + + worker.onmessage = (event) => { + const { data } = event; + + WebExtensionContext.containerId = event.data.containerId; + + if (data.type === "member-removed") { + WebExtensionContext.removeConnectedUserInContext( + data.userId + ); + } + if (data.type === "client-data") { + WebExtensionContext.updateConnectedUsersInContext( + data.containerId, + data.userName, + data.userId, + data.entityId + ); + } + }; + }) + // TODO: add Telemetry +} + export async function showSiteVisibilityDialog() { if ( WebExtensionContext.urlParametersMap.get( diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index acbcd80c..f55a5d11 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -17,6 +17,7 @@ import { schemaKey, } from "../schema/constants"; import { getAttributePath, getEntity, getEntityFetchQuery } from "./schemaHelperUtil"; +import { getWorkSpaceName } from "./commonUtil"; export const getParameterizedRequestUrlTemplate = ( useSingleEntityUrl: boolean @@ -242,4 +243,25 @@ export function isWebFileWithLazyLoad(fsPath: string): boolean { fsPath.includes(WebExtensionContext.rootDirectory.fsPath) && fsPath.includes(SCHEMA_WEBFILE_FOLDER_NAME) && !isPreloadedContent; -} \ No newline at end of file +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export async function getOrCreateSharedWorkspace(config: any) { + + const createWorkspaceResponse = await fetch( + `${config.dataverseOrgUrl}/api/data/v9.2/GetOrCreateSharedWorkspace`, + { + headers: { + ...config.headers, + }, + method: "POST", + body: JSON.stringify({ + target: { + name: getWorkSpaceName(config.websiteid), + } + }), + } + ); + + return await createWorkspaceResponse.json(); +} From 046a9c23e2265394f9d67cef0f1b501e2d7b2252 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Mon, 23 Oct 2023 10:14:29 +0530 Subject: [PATCH 06/22] sending message to worker on tab change rather than open active text editor --- src/web/client/extension.ts | 67 +++++++++++++++---------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 57cc7a45..f65177b8 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -271,55 +271,42 @@ export function processWillSaveDocument(context: vscode.ExtensionContext) { export function processWillStartCollaboartion(context: vscode.ExtensionContext) { if (isCoPresenceEnabled()) { - processOpenActiveTextEditor(context); + processOnTabChange(context); createWebWorkerInstance(context); } } let worker: Worker; -export function processOpenActiveTextEditor(context: vscode.ExtensionContext) { +export function processOnTabChange(context: vscode.ExtensionContext) { try { context.subscriptions.push( - vscode.window.onDidChangeTextEditorSelection(async () => { - const activeEditor = vscode.window.activeTextEditor; - - const swpId = WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID - ) as string; - - const swptenantId = WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.TENANT_ID - ) as string; - - const swpAccessToken = - WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.ACCESS_TOKEN - ) as string; - - const discoveryendpoint = - WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT - ) as string; - - if (activeEditor) { - const entityId = - WebExtensionContext.fileDataMap.getFileMap.get( - activeEditor.document.uri.fsPath - )?.entityId as string; - - if (entityId) { - worker.postMessage({ - afrConfig: { - swpId, - swptenantId, - discoveryendpoint, - swpAccessToken, - }, - entityId, - }); + vscode.window.tabGroups.onDidChangeTabs((event) => { + event.opened.concat(event.changed).forEach(tab => { + if (tab.input instanceof vscode.TabInputCustom || tab.input instanceof vscode.TabInputText) { + const document = tab.input; + const entityId = getFileEntityId(document.uri.fsPath); + if (entityId) { + worker.postMessage({ + afrConfig: { + swpId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID + ) as string, + swptenantId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.TENANT_ID + ) as string, + discoveryendpoint: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT + ) as string, + swpAccessToken: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.ACCESS_TOKEN + ) as string, + }, + entityId, + }); + } } - } + }); }) ); } catch (error) { From 43f883c38a4b0720cc0786774b292bd6b6c4df9e Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 26 Oct 2023 18:32:42 +0530 Subject: [PATCH 07/22] moved co-presence on vscode for web related parameters to a single place --- src/web/client/WebExtensionContext.ts | 119 +++++++++++++------------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index e20176a9..85f85c7b 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -83,7 +83,6 @@ class WebExtensionContext implements IWebExtensionContext { private _vscodeWorkspaceState: Map; private _languageIdCodeMap: Map; private _portalLanguageIdCodeMap: Map; - private _sharedWorkSpaceMap: Map; private _websiteLanguageIdToPortalLanguageMap: Map; private _websiteIdToLanguage: Map; private _rootDirectory: vscode.Uri; @@ -94,8 +93,6 @@ class WebExtensionContext implements IWebExtensionContext { private _showMultifileInVSCode: boolean; private _extensionActivationTime: number; private _extensionUri: vscode.Uri; - private _containerId: string; - private _connectedUsers: UserDataMap; private _dataverseAccessToken: string; private _entityDataMap: EntityDataMap; private _isContextSet: boolean; @@ -106,6 +103,10 @@ class WebExtensionContext implements IWebExtensionContext { private _userId: string; private _formsProEligibilityId: string; private _concurrencyHandler: ConcurrencyHandler + // Co-Presence for Power Pages Vscode for web + private _sharedWorkSpaceMap: Map; + private _containerId: string; + private _connectedUsers: UserDataMap; public get schemaDataSourcePropertiesMap() { return this._schemaDataSourcePropertiesMap; @@ -119,9 +120,6 @@ class WebExtensionContext implements IWebExtensionContext { public get urlParametersMap() { return this._urlParametersMap; } - public get sharedWorkSpaceMap() { - return this._sharedWorkSpaceMap; - } public get vscodeWorkspaceState() { return this._vscodeWorkspaceState; } @@ -155,15 +153,6 @@ class WebExtensionContext implements IWebExtensionContext { public get showMultifileInVSCode() { return this._showMultifileInVSCode; } - public get containerId() { - return this._containerId; - } - public set containerId(containerId: string) { - this._containerId = containerId; - } - public get connectedUsers() { - return this._connectedUsers; - } public get extensionActivationTime() { return this._extensionActivationTime } @@ -200,6 +189,18 @@ class WebExtensionContext implements IWebExtensionContext { public get concurrencyHandler() { return this._concurrencyHandler; } + public get sharedWorkSpaceMap() { + return this._sharedWorkSpaceMap; + } + public get connectedUsers() { + return this._connectedUsers; + } + public get containerId() { + return this._containerId; + } + public set containerId(containerId: string) { + this._containerId = containerId; + } constructor() { this._schemaDataSourcePropertiesMap = new Map(); @@ -209,7 +210,6 @@ class WebExtensionContext implements IWebExtensionContext { this._websiteLanguageIdToPortalLanguageMap = new Map(); this._websiteIdToLanguage = new Map(); this._urlParametersMap = new Map(); - this._sharedWorkSpaceMap = new Map(); this._vscodeWorkspaceState = new Map(); this._entitiesFolderNameMap = new Map(); this._defaultEntityType = ""; @@ -222,8 +222,6 @@ class WebExtensionContext implements IWebExtensionContext { this._showMultifileInVSCode = false; this._extensionActivationTime = new Date().getTime(); this._extensionUri = vscode.Uri.parse(""); - this._containerId = ""; - this._connectedUsers = new UserDataMap(); this._isContextSet = false; this._currentSchemaVersion = ""; this._websiteLanguageCode = ""; @@ -232,6 +230,9 @@ class WebExtensionContext implements IWebExtensionContext { this._userId = ""; this._formsProEligibilityId = ""; this._concurrencyHandler = new ConcurrencyHandler(); + this._sharedWorkSpaceMap = new Map(); + this._containerId = ""; + this._connectedUsers = new UserDataMap(); } public setWebExtensionContext( @@ -601,47 +602,6 @@ class WebExtensionContext implements IWebExtensionContext { } } - private async populateSharedworkspace( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - headers: any, - dataverseOrgUrl: string, - websiteid: string - ) { - const sharedworkspace = await getOrCreateSharedWorkspace({ - headers, - dataverseOrgUrl, - websiteid, - }); - - const sharedWorkSpaceParamsMap = new Map(); - for (const key in sharedworkspace) { - sharedWorkSpaceParamsMap.set( - String(key).trim().toLocaleLowerCase(), - String(sharedworkspace[key]).trim() - ); - } - - this._sharedWorkSpaceMap = sharedWorkSpaceParamsMap; - } - - public async updateConnectedUsersInContext( - containerId: string, - userName: string, - userId: string, - entityId: string[] - ) { - this.connectedUsers.setUserData( - containerId, - userName, - userId, - entityId - ); - } - - public async removeConnectedUserInContext(userId: string) { - this.connectedUsers.removeUser(userId); - } - private async setWebsiteLanguageCode() { const lcid = this.websiteIdToLanguage.get( @@ -695,6 +655,47 @@ class WebExtensionContext implements IWebExtensionContext { public getVscodeWorkspaceState(key: string): IEntityInfo | undefined { return this._vscodeWorkspaceState.get(key); } + + private async populateSharedworkspace( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + headers: any, + dataverseOrgUrl: string, + websiteid: string + ) { + const sharedworkspace = await getOrCreateSharedWorkspace({ + headers, + dataverseOrgUrl, + websiteid, + }); + + const sharedWorkSpaceParamsMap = new Map(); + for (const key in sharedworkspace) { + sharedWorkSpaceParamsMap.set( + String(key).trim().toLocaleLowerCase(), + String(sharedworkspace[key]).trim() + ); + } + + this._sharedWorkSpaceMap = sharedWorkSpaceParamsMap; + } + + public async updateConnectedUsersInContext( + containerId: string, + userName: string, + userId: string, + entityId: string[] + ) { + this.connectedUsers.setUserData( + containerId, + userName, + userId, + entityId + ); + } + + public async removeConnectedUserInContext(userId: string) { + this.connectedUsers.removeUser(userId); + } } export default new WebExtensionContext(); From a2922d0493b6a814573bb32a5f9add77e10aa360 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 26 Oct 2023 19:01:15 +0530 Subject: [PATCH 08/22] disabled co-presence feature for users as under development --- src/web/client/extension.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index f65177b8..d7778bba 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -270,7 +270,9 @@ export function processWillSaveDocument(context: vscode.ExtensionContext) { } export function processWillStartCollaboartion(context: vscode.ExtensionContext) { - if (isCoPresenceEnabled()) { + // feature in progress, hence disabling it + // eslint-disable-next-line no-constant-condition + if (false && isCoPresenceEnabled()) { processOnTabChange(context); createWebWorkerInstance(context); } From 64f0fa3923d2cf21021c864bdd64e909ee953ac6 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 26 Oct 2023 19:11:31 +0530 Subject: [PATCH 09/22] update in way of joining path --- src/web/client/extension.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index d7778bba..b970a596 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -321,7 +321,9 @@ export function createWebWorkerInstance( ) { const webworkerMain = vscode.Uri.joinPath( context.extensionUri, - "dist/web/webworker.worker.js" + "dist", + "web", + "webworker.worker.js" ); const workerUrl = new URL(webworkerMain.toString()); From 618928af972a6c8ab8749cb8002a8de8e977a19d Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 26 Oct 2023 19:28:26 +0530 Subject: [PATCH 10/22] added const for worker event messages --- src/web/client/common/constants.ts | 6 ++++++ src/web/client/extension.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index ad3abdb4..0d33de61 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -53,6 +53,7 @@ export const MULTI_FILE_FEATURE_SETTING_NAME = "enableMultiFileFeature"; // Co-presence feature constants export const CO_PRESENCE_FEATURE_SETTING_NAME = "enableCoPresenceFeature"; +// Co-presence constants export enum sharedWorkspaceParameters { SHAREWORKSPACE_ID = "sharedworkspaceid", TENANT_ID = "tenantid", @@ -60,6 +61,11 @@ export enum sharedWorkspaceParameters { DISCOVERY_ENDPOINT = "discoveryendpoint", } +export enum workerMessage { + UPDATE_CONNECTED_USERS = "client-data", + REMOVE_CONNECTED_USER = "member-removed", +} + export enum initializationEntityName { WEBSITE = "websites", WEBSITELANGUAGE = "websitelanguages", diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index b970a596..6f9ec455 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -344,12 +344,12 @@ export function createWebWorkerInstance( WebExtensionContext.containerId = event.data.containerId; - if (data.type === "member-removed") { + if (data.type === Constants.workerMessage.REMOVE_CONNECTED_USER) { WebExtensionContext.removeConnectedUserInContext( data.userId ); } - if (data.type === "client-data") { + if (data.type === Constants.workerMessage.UPDATE_CONNECTED_USERS) { WebExtensionContext.updateConnectedUsersInContext( data.containerId, data.userName, From 1fcfe2e2841eb58e74681c58dc234b5dc6d411e9 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 26 Oct 2023 19:29:06 +0530 Subject: [PATCH 11/22] renamed a worker event mesages --- src/web/client/common/constants.ts | 2 +- src/web/client/extension.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index 0d33de61..d5b18b47 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -61,7 +61,7 @@ export enum sharedWorkspaceParameters { DISCOVERY_ENDPOINT = "discoveryendpoint", } -export enum workerMessage { +export enum workerEventMessages { UPDATE_CONNECTED_USERS = "client-data", REMOVE_CONNECTED_USER = "member-removed", } diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 6f9ec455..100840af 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -344,12 +344,12 @@ export function createWebWorkerInstance( WebExtensionContext.containerId = event.data.containerId; - if (data.type === Constants.workerMessage.REMOVE_CONNECTED_USER) { + if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { WebExtensionContext.removeConnectedUserInContext( data.userId ); } - if (data.type === Constants.workerMessage.UPDATE_CONNECTED_USERS) { + if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { WebExtensionContext.updateConnectedUsersInContext( data.containerId, data.userName, From 6df6477b87bbc533ffa00367a124f8a8fecda90a Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 14:30:38 +0530 Subject: [PATCH 12/22] remove redundant event registery of onDidChangeTabs --- src/web/client/common/worker/webworker.js | 4 +- src/web/client/extension.ts | 59 +++++++++-------------- 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/web/client/common/worker/webworker.js b/src/web/client/common/worker/webworker.js index ffaebb96..f7107740 100644 --- a/src/web/client/common/worker/webworker.js +++ b/src/web/client/common/worker/webworker.js @@ -80,7 +80,7 @@ class AzureFluidClient { } } -async function loadContainer(config, swpId, entityId) { +async function loadContainer(config, swpId, entityInfo) { try { const { container, audience, map } = await AzureFluidClient.fetchContainerAndService(config, swpId); @@ -162,7 +162,7 @@ function runFluidApp() { await loadContainer( message.afrConfig, message.afrConfig.swpId, - message.entityId + message.entityInfo ); }); } diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 100840af..5f44d4f2 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -238,6 +238,28 @@ export function processWorkspaceStateChanges(context: vscode.ExtensionContext) { if (entityInfo.entityId && entityInfo.entityName) { context.workspaceState.update(document.uri.fsPath, entityInfo); WebExtensionContext.updateVscodeWorkspaceState(document.uri.fsPath, entityInfo); + + // sending message to webworker event listener for Co-Presence feature + // eslint-disable-next-line no-constant-condition + if (false && isCoPresenceEnabled()) { + worker.postMessage({ + afrConfig: { + swpId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID + ) as string, + swptenantId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.TENANT_ID + ) as string, + discoveryendpoint: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT + ) as string, + swpAccessToken: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.ACCESS_TOKEN + ) as string, + }, + entityInfo + }); + } } } }); @@ -273,49 +295,12 @@ export function processWillStartCollaboartion(context: vscode.ExtensionContext) // feature in progress, hence disabling it // eslint-disable-next-line no-constant-condition if (false && isCoPresenceEnabled()) { - processOnTabChange(context); createWebWorkerInstance(context); } } let worker: Worker; -export function processOnTabChange(context: vscode.ExtensionContext) { - try { - context.subscriptions.push( - vscode.window.tabGroups.onDidChangeTabs((event) => { - event.opened.concat(event.changed).forEach(tab => { - if (tab.input instanceof vscode.TabInputCustom || tab.input instanceof vscode.TabInputText) { - const document = tab.input; - const entityId = getFileEntityId(document.uri.fsPath); - if (entityId) { - worker.postMessage({ - afrConfig: { - swpId: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID - ) as string, - swptenantId: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.TENANT_ID - ) as string, - discoveryendpoint: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT - ) as string, - swpAccessToken: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.ACCESS_TOKEN - ) as string, - }, - entityId, - }); - } - } - }); - }) - ); - } catch (error) { - // TODO: add Telemetry - } -} - export function createWebWorkerInstance( context: vscode.ExtensionContext ) { From 474ee5dc652fef683911a8831052e808d9d44aa8 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 16:56:41 +0530 Subject: [PATCH 13/22] moved populateSharedWorkSpace to authenticateAndUpdateDataverseProperties as no need to call it again and again with file save, and added concurreny handler to api call and telemetry to track logs --- src/web/client/WebExtensionContext.ts | 30 ++++++--- src/web/client/telemetry/constants.ts | 5 +- src/web/client/utilities/urlBuilderUtil.ts | 76 ++++++++++++++++++---- 3 files changed, 88 insertions(+), 23 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 85f85c7b..8be8f952 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -321,6 +321,28 @@ class WebExtensionContext implements IWebExtensionContext { ); await this.setWebsiteLanguageCode(); + + // Getting website Id to populate shared workspace for Co-Presence + const websiteid = this.urlParametersMap.get( + Constants.queryParameters.WEBSITE_ID + ) as string; + + const headers = getCommonHeaders(this._dataverseAccessToken); + + // Populate shared workspace for Co-Presence + try { + await this.populateSharedworkspace(headers, dataverseOrgUrl, websiteid); + this.telemetry.sendInfoTelemetry( + telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SUCCESS + ); + } catch (error) { + this.telemetry.sendErrorTelemetry( + telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR, + this.populateSharedworkspace.name, + (error as Error)?.message, + error as Error + ); + } } public async dataverseAuthentication(firstTimeAuth = false) { @@ -351,14 +373,6 @@ class WebExtensionContext implements IWebExtensionContext { } this._dataverseAccessToken = accessToken; - - const websiteid = this.urlParametersMap.get( - Constants.queryParameters.WEBSITE_ID - ) as string; - - const headers = getCommonHeaders(accessToken); - - await this.populateSharedworkspace(headers, dataverseOrgUrl, websiteid); } public async updateFileDetailsInContext( diff --git a/src/web/client/telemetry/constants.ts b/src/web/client/telemetry/constants.ts index 34dcfe78..fada8c3e 100644 --- a/src/web/client/telemetry/constants.ts +++ b/src/web/client/telemetry/constants.ts @@ -98,5 +98,8 @@ export enum telemetryEventNames { WEB_EXTENSION_BACK_TO_STUDIO_TRIGGERED = 'webExtensionBackToStudioTriggered', WEB_EXTENSION_PREVIEW_SITE_TRIGGERED = 'webExtensionPreviewSiteTriggered', WEB_EXTENSION_IMAGE_EDIT_SUPPORTED_FILE_EXTENSION = 'webExtensionImageEditSupportedFileExtension', - WEB_EXTENSION_SAVE_IMAGE_FILE_TRIGGERED = 'webExtensionSaveImageFileTriggered' + WEB_EXTENSION_SAVE_IMAGE_FILE_TRIGGERED = 'webExtensionSaveImageFileTriggered', + WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR = 'webExtensionFetchGetOrCreateSharedWorkSpaceError', + WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR = 'webExtensionPopulateSharedWorkSpaceSystemError', + WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SUCCESS = 'webExtensionPopulateSharedWorkSpaceSuccess', } diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index f55a5d11..0dbb19cb 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -18,6 +18,8 @@ import { } from "../schema/constants"; import { getAttributePath, getEntity, getEntityFetchQuery } from "./schemaHelperUtil"; import { getWorkSpaceName } from "./commonUtil"; +import * as Constants from "../common/constants"; +import { telemetryEventNames } from "../telemetry/constants"; export const getParameterizedRequestUrlTemplate = ( useSingleEntityUrl: boolean @@ -247,21 +249,67 @@ export function isWebFileWithLazyLoad(fsPath: string): boolean { // eslint-disable-next-line @typescript-eslint/no-explicit-any export async function getOrCreateSharedWorkspace(config: any) { + let requestSentAtTime = new Date().getTime(); + const requestUrl = `${config.dataverseOrgUrl}/api/data/v9.2/GetOrCreateSharedWorkspace`; - const createWorkspaceResponse = await fetch( - `${config.dataverseOrgUrl}/api/data/v9.2/GetOrCreateSharedWorkspace`, - { - headers: { - ...config.headers, - }, - method: "POST", - body: JSON.stringify({ - target: { - name: getWorkSpaceName(config.websiteid), - } - }), + try { + WebExtensionContext.telemetry.sendAPITelemetry( + requestUrl, + config.entityName, + Constants.httpMethod.POST, + getOrCreateSharedWorkspace.name, + ); + + requestSentAtTime = new Date().getTime(); + + const createWorkspaceResponse = await WebExtensionContext.concurrencyHandler.handleRequest( + requestUrl, + { + headers: { + ...config.headers, + }, + method: "POST", + body: JSON.stringify({ + target: { + name: getWorkSpaceName(config.websiteid), + } + }), + } + ) + + if (!createWorkspaceResponse.ok) { + throw new Error(JSON.stringify(createWorkspaceResponse)); } - ); - return await createWorkspaceResponse.json(); + WebExtensionContext.telemetry.sendAPISuccessTelemetry( + requestUrl, + config.entityName, + Constants.httpMethod.POST, + new Date().getTime() - requestSentAtTime, + getOrCreateSharedWorkspace.name + ); + + return await createWorkspaceResponse.json(); + } catch (error) { + const errorMsg = (error as Error)?.message; + if ((error as Response)?.status > 0) { + WebExtensionContext.telemetry.sendAPIFailureTelemetry( + requestUrl, + config.entityName, + Constants.httpMethod.GET, + new Date().getTime() - requestSentAtTime, + getOrCreateSharedWorkspace.name, + errorMsg, + '', + (error as Response)?.status.toString() + ); + } else { + WebExtensionContext.telemetry.sendErrorTelemetry( + telemetryEventNames.WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR, + getOrCreateSharedWorkspace.name, + (error as Error)?.message, + error as Error + ); + } + } } From b4e93191a91d9033a6271324d1aea945fc27cccd Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 17:45:54 +0530 Subject: [PATCH 14/22] disabling co-presence feature hard coded --- src/web/client/utilities/commonUtil.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/web/client/utilities/commonUtil.ts b/src/web/client/utilities/commonUtil.ts index a6aff10f..040b9ebd 100644 --- a/src/web/client/utilities/commonUtil.ts +++ b/src/web/client/utilities/commonUtil.ts @@ -151,7 +151,9 @@ export function isCoPresenceEnabled() { ); } - return isCoPresenceEnabled as boolean; + // return isCoPresenceEnabled as boolean; + // this feature is under development and will be enabled in future + return false; } /** From b2568e6f21e2e06594b429e8f91af27f0bd4d778 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 17:46:14 +0530 Subject: [PATCH 15/22] added worker in webextension context --- src/web/client/WebExtensionContext.ts | 8 +++ src/web/client/extension.ts | 82 +++++++++++++-------------- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 8be8f952..9fed6a18 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -104,6 +104,7 @@ class WebExtensionContext implements IWebExtensionContext { private _formsProEligibilityId: string; private _concurrencyHandler: ConcurrencyHandler // Co-Presence for Power Pages Vscode for web + private _worker: Worker | undefined; private _sharedWorkSpaceMap: Map; private _containerId: string; private _connectedUsers: UserDataMap; @@ -189,6 +190,9 @@ class WebExtensionContext implements IWebExtensionContext { public get concurrencyHandler() { return this._concurrencyHandler; } + public get worker() { + return this._worker; + } public get sharedWorkSpaceMap() { return this._sharedWorkSpaceMap; } @@ -670,6 +674,10 @@ class WebExtensionContext implements IWebExtensionContext { return this._vscodeWorkspaceState.get(key); } + public setWorker(worker: Worker) { + this._worker = worker; + } + private async populateSharedworkspace( // eslint-disable-next-line @typescript-eslint/no-explicit-any headers: any, diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 5f44d4f2..1c369978 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -240,25 +240,26 @@ export function processWorkspaceStateChanges(context: vscode.ExtensionContext) { WebExtensionContext.updateVscodeWorkspaceState(document.uri.fsPath, entityInfo); // sending message to webworker event listener for Co-Presence feature - // eslint-disable-next-line no-constant-condition - if (false && isCoPresenceEnabled()) { - worker.postMessage({ - afrConfig: { - swpId: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID - ) as string, - swptenantId: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.TENANT_ID - ) as string, - discoveryendpoint: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT - ) as string, - swpAccessToken: WebExtensionContext.sharedWorkSpaceMap.get( - Constants.sharedWorkspaceParameters.ACCESS_TOKEN - ) as string, - }, - entityInfo - }); + if (isCoPresenceEnabled()) { + if (WebExtensionContext.worker !== undefined) { + WebExtensionContext.worker.postMessage({ + afrConfig: { + swpId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.SHAREWORKSPACE_ID + ) as string, + swptenantId: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.TENANT_ID + ) as string, + discoveryendpoint: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.DISCOVERY_ENDPOINT + ) as string, + swpAccessToken: WebExtensionContext.sharedWorkSpaceMap.get( + Constants.sharedWorkspaceParameters.ACCESS_TOKEN + ) as string, + }, + entityInfo + }); + } } } } @@ -293,14 +294,11 @@ export function processWillSaveDocument(context: vscode.ExtensionContext) { export function processWillStartCollaboartion(context: vscode.ExtensionContext) { // feature in progress, hence disabling it - // eslint-disable-next-line no-constant-condition - if (false && isCoPresenceEnabled()) { + if (isCoPresenceEnabled()) { createWebWorkerInstance(context); } } -let worker: Worker; - export function createWebWorkerInstance( context: vscode.ExtensionContext ) { @@ -322,27 +320,29 @@ export function createWebWorkerInstance( const workerUrl = URL.createObjectURL(workerBlob); - worker = new Worker(workerUrl); + WebExtensionContext.setWorker(new Worker(workerUrl)); - worker.onmessage = (event) => { - const { data } = event; + if (WebExtensionContext.worker !== undefined) { + WebExtensionContext.worker.onmessage = (event) => { + const { data } = event; - WebExtensionContext.containerId = event.data.containerId; + WebExtensionContext.containerId = event.data.containerId; - if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { - WebExtensionContext.removeConnectedUserInContext( - data.userId - ); - } - if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { - WebExtensionContext.updateConnectedUsersInContext( - data.containerId, - data.userName, - data.userId, - data.entityId - ); - } - }; + if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { + WebExtensionContext.removeConnectedUserInContext( + data.userId + ); + } + if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { + WebExtensionContext.updateConnectedUsersInContext( + data.containerId, + data.userName, + data.userId, + data.entityId + ); + } + }; + } }) // TODO: add Telemetry } From 5d9d9947be9c09dc53f583169c01b50d5a8376f7 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 18:20:31 +0530 Subject: [PATCH 16/22] used concurrency handler to make fetch call worker script --- src/web/client/WebExtensionContext.ts | 33 ++++++++++++++++ src/web/client/extension.ts | 56 +++++++++++++-------------- src/web/client/telemetry/constants.ts | 3 ++ 3 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 9fed6a18..c25d8172 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -674,6 +674,39 @@ class WebExtensionContext implements IWebExtensionContext { return this._vscodeWorkspaceState.get(key); } + public async getWorkerScript(workerUrl : URL) : Promise { + try { + this.telemetry.sendInfoTelemetry( + telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT, + { workerUrl: workerUrl.toString() } + ); + + const response = await this.concurrencyHandler.handleRequest( + workerUrl + ) + + if (!response.ok) { + throw new Error( + `Failed to fetch worker script '${workerUrl.toString()}': ${response.statusText}` + ); + } + + this.telemetry.sendInfoTelemetry( + telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT_SUCCESS, + { workerUrl: workerUrl.toString() } + ); + + return await response.text(); + } catch (error) { + this.telemetry.sendErrorTelemetry( + telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED, + this.getWorkerScript.name, + (error as Error)?.message, + error as Error + ); + } + } + public setWorker(worker: Worker) { this._worker = worker; } diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 1c369978..28d297ff 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -311,40 +311,38 @@ export function createWebWorkerInstance( const workerUrl = new URL(webworkerMain.toString()); - fetch(workerUrl) - .then((response) => response.text()) - .then((workerScript) => { - const workerBlob = new Blob([workerScript], { - type: "application/javascript", - }); + WebExtensionContext.getWorkerScript(workerUrl) + .then((workerScript) => { + const workerBlob = new Blob([workerScript], { + type: "application/javascript", + }); - const workerUrl = URL.createObjectURL(workerBlob); + const urlObj = URL.createObjectURL(workerBlob); - WebExtensionContext.setWorker(new Worker(workerUrl)); + WebExtensionContext.setWorker(new Worker(urlObj)); - if (WebExtensionContext.worker !== undefined) { - WebExtensionContext.worker.onmessage = (event) => { - const { data } = event; + if (WebExtensionContext.worker !== undefined) { + WebExtensionContext.worker.onmessage = (event) => { + const { data } = event; - WebExtensionContext.containerId = event.data.containerId; + WebExtensionContext.containerId = event.data.containerId; - if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { - WebExtensionContext.removeConnectedUserInContext( - data.userId - ); - } - if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { - WebExtensionContext.updateConnectedUsersInContext( - data.containerId, - data.userName, - data.userId, - data.entityId - ); - } - }; - } - }) - // TODO: add Telemetry + if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { + WebExtensionContext.removeConnectedUserInContext( + data.userId + ); + } + if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { + WebExtensionContext.updateConnectedUsersInContext( + data.containerId, + data.userName, + data.userId, + data.entityId + ); + } + }; + } + }); } export async function showSiteVisibilityDialog() { diff --git a/src/web/client/telemetry/constants.ts b/src/web/client/telemetry/constants.ts index fada8c3e..6f914d8f 100644 --- a/src/web/client/telemetry/constants.ts +++ b/src/web/client/telemetry/constants.ts @@ -102,4 +102,7 @@ export enum telemetryEventNames { WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR = 'webExtensionFetchGetOrCreateSharedWorkSpaceError', WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR = 'webExtensionPopulateSharedWorkSpaceSystemError', WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SUCCESS = 'webExtensionPopulateSharedWorkSpaceSuccess', + WEB_EXTENSION_FETCH_WORKER_SCRIPT = 'webExtensionFetchWorkerScript', + WEB_EXTENSION_FETCH_WORKER_SCRIPT_SUCCESS = 'webExtensionFetchWorkerScriptSuccess', + WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED = 'webExtensionFetchWorkerScriptFailed', } From eacad21bd0a9539ecc2f7ca215262def6df172f0 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Fri, 27 Oct 2023 18:39:46 +0530 Subject: [PATCH 17/22] eslint error fixed --- src/web/client/WebExtensionContext.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index c25d8172..297993a5 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -674,6 +674,7 @@ class WebExtensionContext implements IWebExtensionContext { return this._vscodeWorkspaceState.get(key); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any public async getWorkerScript(workerUrl : URL) : Promise { try { this.telemetry.sendInfoTelemetry( From 231efe4fb348e62ae8e82b63d05f514acf98e6ec Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Mon, 30 Oct 2023 15:29:21 +0530 Subject: [PATCH 18/22] adding telemetry and moving api path in constant --- src/web/client/WebExtensionContext.ts | 54 +++++++-------- src/web/client/common/constants.ts | 2 + src/web/client/extension.ts | 78 ++++++++++++---------- src/web/client/telemetry/constants.ts | 2 + src/web/client/utilities/urlBuilderUtil.ts | 5 +- 5 files changed, 80 insertions(+), 61 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 297993a5..60f57018 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -334,19 +334,7 @@ class WebExtensionContext implements IWebExtensionContext { const headers = getCommonHeaders(this._dataverseAccessToken); // Populate shared workspace for Co-Presence - try { - await this.populateSharedworkspace(headers, dataverseOrgUrl, websiteid); - this.telemetry.sendInfoTelemetry( - telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SUCCESS - ); - } catch (error) { - this.telemetry.sendErrorTelemetry( - telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR, - this.populateSharedworkspace.name, - (error as Error)?.message, - error as Error - ); - } + await this.populateSharedworkspace(headers, dataverseOrgUrl, websiteid); } public async dataverseAuthentication(firstTimeAuth = false) { @@ -718,21 +706,35 @@ class WebExtensionContext implements IWebExtensionContext { dataverseOrgUrl: string, websiteid: string ) { - const sharedworkspace = await getOrCreateSharedWorkspace({ - headers, - dataverseOrgUrl, - websiteid, - }); - - const sharedWorkSpaceParamsMap = new Map(); - for (const key in sharedworkspace) { - sharedWorkSpaceParamsMap.set( - String(key).trim().toLocaleLowerCase(), - String(sharedworkspace[key]).trim() + try { + const sharedworkspace = await getOrCreateSharedWorkspace({ + headers, + dataverseOrgUrl, + websiteid, + }); + + const sharedWorkSpaceParamsMap = new Map(); + for (const key in sharedworkspace) { + sharedWorkSpaceParamsMap.set( + String(key).trim().toLocaleLowerCase(), + String(sharedworkspace[key]).trim() + ); + } + + this._sharedWorkSpaceMap = sharedWorkSpaceParamsMap; + + this.telemetry.sendInfoTelemetry( + telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SUCCESS, + { count: this._sharedWorkSpaceMap.size.toString() } + ); + } catch (error) { + this.telemetry.sendErrorTelemetry( + telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR, + this.populateSharedworkspace.name, + (error as Error)?.message, + error as Error ); } - - this._sharedWorkSpaceMap = sharedWorkSpaceParamsMap; } public async updateConnectedUsersInContext( diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index d5b18b47..fb6e1456 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -54,6 +54,8 @@ export const MULTI_FILE_FEATURE_SETTING_NAME = "enableMultiFileFeature"; export const CO_PRESENCE_FEATURE_SETTING_NAME = "enableCoPresenceFeature"; // Co-presence constants +export const GET_OR_CREATE_SHARED_WORK_SPACE = "/api/data/v9.2/GetOrCreateSharedWorkspace"; + export enum sharedWorkspaceParameters { SHAREWORKSPACE_ID = "sharedworkspaceid", TENANT_ID = "tenantid", diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index 28d297ff..7eca9942 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -302,47 +302,57 @@ export function processWillStartCollaboartion(context: vscode.ExtensionContext) export function createWebWorkerInstance( context: vscode.ExtensionContext ) { - const webworkerMain = vscode.Uri.joinPath( - context.extensionUri, - "dist", - "web", - "webworker.worker.js" - ); + try { + const webworkerMain = vscode.Uri.joinPath( + context.extensionUri, + "dist", + "web", + "webworker.worker.js" + ); - const workerUrl = new URL(webworkerMain.toString()); + const workerUrl = new URL(webworkerMain.toString()); - WebExtensionContext.getWorkerScript(workerUrl) - .then((workerScript) => { - const workerBlob = new Blob([workerScript], { - type: "application/javascript", - }); + WebExtensionContext.getWorkerScript(workerUrl) + .then((workerScript) => { + const workerBlob = new Blob([workerScript], { + type: "application/javascript", + }); - const urlObj = URL.createObjectURL(workerBlob); + const urlObj = URL.createObjectURL(workerBlob); - WebExtensionContext.setWorker(new Worker(urlObj)); + WebExtensionContext.setWorker(new Worker(urlObj)); - if (WebExtensionContext.worker !== undefined) { - WebExtensionContext.worker.onmessage = (event) => { - const { data } = event; + if (WebExtensionContext.worker !== undefined) { + WebExtensionContext.worker.onmessage = (event) => { + const { data } = event; - WebExtensionContext.containerId = event.data.containerId; + WebExtensionContext.containerId = event.data.containerId; - if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { - WebExtensionContext.removeConnectedUserInContext( - data.userId - ); - } - if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { - WebExtensionContext.updateConnectedUsersInContext( - data.containerId, - data.userName, - data.userId, - data.entityId - ); - } - }; - } - }); + if (data.type === Constants.workerEventMessages.REMOVE_CONNECTED_USER) { + WebExtensionContext.removeConnectedUserInContext( + data.userId + ); + } + if (data.type === Constants.workerEventMessages.UPDATE_CONNECTED_USERS) { + WebExtensionContext.updateConnectedUsersInContext( + data.containerId, + data.userName, + data.userId, + data.entityId + ); + } + }; + } + }) + + WebExtensionContext.telemetry.sendInfoTelemetry(telemetryEventNames.WEB_EXTENSION_WEB_WORKER_REGISTERED); + } catch(error) { + WebExtensionContext.telemetry.sendErrorTelemetry( + telemetryEventNames.WEB_EXTENSION_WEB_WORKER_REGISTRATION_FAILED, + createWebWorkerInstance.name, + (error as Error)?.message, + error as Error); + } } export async function showSiteVisibilityDialog() { diff --git a/src/web/client/telemetry/constants.ts b/src/web/client/telemetry/constants.ts index 6f914d8f..d6f0a865 100644 --- a/src/web/client/telemetry/constants.ts +++ b/src/web/client/telemetry/constants.ts @@ -105,4 +105,6 @@ export enum telemetryEventNames { WEB_EXTENSION_FETCH_WORKER_SCRIPT = 'webExtensionFetchWorkerScript', WEB_EXTENSION_FETCH_WORKER_SCRIPT_SUCCESS = 'webExtensionFetchWorkerScriptSuccess', WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED = 'webExtensionFetchWorkerScriptFailed', + WEB_EXTENSION_WEB_WORKER_REGISTERED = 'webExtensionWebWorkerRegistered', + WEB_EXTENSION_WEB_WORKER_REGISTRATION_FAILED = 'webExtensionWebWorkerRegistrationFailed', } diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index 0dbb19cb..08ba66f3 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -20,6 +20,7 @@ import { getAttributePath, getEntity, getEntityFetchQuery } from "./schemaHelper import { getWorkSpaceName } from "./commonUtil"; import * as Constants from "../common/constants"; import { telemetryEventNames } from "../telemetry/constants"; +import path from "path"; export const getParameterizedRequestUrlTemplate = ( useSingleEntityUrl: boolean @@ -250,7 +251,9 @@ export function isWebFileWithLazyLoad(fsPath: string): boolean { // eslint-disable-next-line @typescript-eslint/no-explicit-any export async function getOrCreateSharedWorkspace(config: any) { let requestSentAtTime = new Date().getTime(); - const requestUrl = `${config.dataverseOrgUrl}/api/data/v9.2/GetOrCreateSharedWorkspace`; + const requestUrl = path.join(config.dataverseOrgUrl, Constants.GET_OR_CREATE_SHARED_WORK_SPACE); + + console.log("requestUrl: ", requestUrl); try { WebExtensionContext.telemetry.sendAPITelemetry( From aa1f530c23b974aa410ca3dfe108392b9ea691a9 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Mon, 30 Oct 2023 15:31:28 +0530 Subject: [PATCH 19/22] removed console log --- src/web/client/utilities/urlBuilderUtil.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index 08ba66f3..12c84704 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -253,8 +253,6 @@ export async function getOrCreateSharedWorkspace(config: any) { let requestSentAtTime = new Date().getTime(); const requestUrl = path.join(config.dataverseOrgUrl, Constants.GET_OR_CREATE_SHARED_WORK_SPACE); - console.log("requestUrl: ", requestUrl); - try { WebExtensionContext.telemetry.sendAPITelemetry( requestUrl, From ea971cfb9a7de60a2207fdd61d8378bfe4a86c58 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Tue, 31 Oct 2023 01:15:00 +0530 Subject: [PATCH 20/22] updating telemetry log --- src/web/client/WebExtensionContext.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 60f57018..a6379f47 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -666,8 +666,7 @@ class WebExtensionContext implements IWebExtensionContext { public async getWorkerScript(workerUrl : URL) : Promise { try { this.telemetry.sendInfoTelemetry( - telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT, - { workerUrl: workerUrl.toString() } + telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT ); const response = await this.concurrencyHandler.handleRequest( From 65498f71d9d26723aad0547f94d8f8da6802e233 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 9 Nov 2023 02:27:21 +0530 Subject: [PATCH 21/22] resolving bug of correct api call --- src/web/client/utilities/urlBuilderUtil.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index 12c84704..a25669e7 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -20,7 +20,6 @@ import { getAttributePath, getEntity, getEntityFetchQuery } from "./schemaHelper import { getWorkSpaceName } from "./commonUtil"; import * as Constants from "../common/constants"; import { telemetryEventNames } from "../telemetry/constants"; -import path from "path"; export const getParameterizedRequestUrlTemplate = ( useSingleEntityUrl: boolean @@ -251,11 +250,14 @@ export function isWebFileWithLazyLoad(fsPath: string): boolean { // eslint-disable-next-line @typescript-eslint/no-explicit-any export async function getOrCreateSharedWorkspace(config: any) { let requestSentAtTime = new Date().getTime(); - const requestUrl = path.join(config.dataverseOrgUrl, Constants.GET_OR_CREATE_SHARED_WORK_SPACE); + + const origin = config.dataverseOrgUrl; + const apiName = Constants.GET_OR_CREATE_SHARED_WORK_SPACE; + const requestUrl = new URL(apiName, origin); try { WebExtensionContext.telemetry.sendAPITelemetry( - requestUrl, + requestUrl.href, config.entityName, Constants.httpMethod.POST, getOrCreateSharedWorkspace.name, @@ -283,7 +285,7 @@ export async function getOrCreateSharedWorkspace(config: any) { } WebExtensionContext.telemetry.sendAPISuccessTelemetry( - requestUrl, + requestUrl.href, config.entityName, Constants.httpMethod.POST, new Date().getTime() - requestSentAtTime, @@ -295,7 +297,7 @@ export async function getOrCreateSharedWorkspace(config: any) { const errorMsg = (error as Error)?.message; if ((error as Response)?.status > 0) { WebExtensionContext.telemetry.sendAPIFailureTelemetry( - requestUrl, + requestUrl.href, config.entityName, Constants.httpMethod.GET, new Date().getTime() - requestSentAtTime, From 8fc16f0ecf2b4ef6aafa5e9733c4d0ed61ef7b01 Mon Sep 17 00:00:00 2001 From: ramukaritik Date: Thu, 16 Nov 2023 10:54:46 +0530 Subject: [PATCH 22/22] telemetry error logs hard coded --- src/web/client/WebExtensionContext.ts | 4 ++-- src/web/client/common/constants.ts | 4 ++++ src/web/client/extension.ts | 2 +- src/web/client/utilities/urlBuilderUtil.ts | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/web/client/WebExtensionContext.ts b/src/web/client/WebExtensionContext.ts index 3f48c100..a80167b5 100644 --- a/src/web/client/WebExtensionContext.ts +++ b/src/web/client/WebExtensionContext.ts @@ -707,7 +707,7 @@ class WebExtensionContext implements IWebExtensionContext { this.telemetry.sendErrorTelemetry( telemetryEventNames.WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED, this.getWorkerScript.name, - (error as Error)?.message, + Constants.WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED, error as Error ); } @@ -748,7 +748,7 @@ class WebExtensionContext implements IWebExtensionContext { this.telemetry.sendErrorTelemetry( telemetryEventNames.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR, this.populateSharedworkspace.name, - (error as Error)?.message, + Constants.WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR, error as Error ); } diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index 8e79c053..513c8ccc 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -29,6 +29,10 @@ export const INTELLIGENCE_SCOPE_DEFAULT = "https://text.pai.dynamics.com/.defaul export const BACK_TO_STUDIO_URL_TEMPLATE = "https://make{.region}.powerpages.microsoft.com/e/{environmentId}/sites/{webSiteId}/pages"; export const STUDIO_PROD_REGION = "prod"; export const ARTEMIS_RESPONSE_FAILED = "Artemis response failed" +export const WEB_EXTENSION_FETCH_WORKER_SCRIPT_FAILED = "Web extension fetch worker script failed" +export const WEB_EXTENSION_POPULATE_SHARED_WORKSPACE_SYSTEM_ERROR = "Web extension populate shared workspace system error" +export const WEB_EXTENSION_WEB_WORKER_REGISTRATION_FAILED = "Web extension web worker registration failed" +export const WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR = "Web extension fetch get or create shared workspace error" // Web extension constants export const BASE_64 = 'base64'; diff --git a/src/web/client/extension.ts b/src/web/client/extension.ts index b1608ff5..98d110fe 100644 --- a/src/web/client/extension.ts +++ b/src/web/client/extension.ts @@ -355,7 +355,7 @@ export function createWebWorkerInstance( WebExtensionContext.telemetry.sendErrorTelemetry( telemetryEventNames.WEB_EXTENSION_WEB_WORKER_REGISTRATION_FAILED, createWebWorkerInstance.name, - (error as Error)?.message, + Constants.WEB_EXTENSION_WEB_WORKER_REGISTRATION_FAILED, error as Error); } } diff --git a/src/web/client/utilities/urlBuilderUtil.ts b/src/web/client/utilities/urlBuilderUtil.ts index a25669e7..8ff91c70 100644 --- a/src/web/client/utilities/urlBuilderUtil.ts +++ b/src/web/client/utilities/urlBuilderUtil.ts @@ -310,7 +310,7 @@ export async function getOrCreateSharedWorkspace(config: any) { WebExtensionContext.telemetry.sendErrorTelemetry( telemetryEventNames.WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR, getOrCreateSharedWorkspace.name, - (error as Error)?.message, + Constants.WEB_EXTENSION_FETCH_GET_OR_CREATE_SHARED_WORK_SPACE_ERROR, error as Error ); }