diff --git a/clientlibs/libTesters/client-lib-tester-frontend/README.md b/clientlibs/libTesters/client-lib-tester-frontend/README.md index ced5b7e7fc..a55715995c 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/README.md +++ b/clientlibs/libTesters/client-lib-tester-frontend/README.md @@ -92,7 +92,7 @@ The default is to have `any` as the type for the upgrade client. This is because // There's probably a clever way to do this, but getting the right types automatically is tricky // import { UpgradeClient } from 'upgrade_client_local'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/package-lock.json b/clientlibs/libTesters/client-lib-tester-frontend/package-lock.json index fa383a1ccd..54c218be45 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/package-lock.json +++ b/clientlibs/libTesters/client-lib-tester-frontend/package-lock.json @@ -20,7 +20,8 @@ "@angular/router": "^14.1.0", "rxjs": "~7.5.0", "tslib": "^2.3.0", - "upgrade_client_1_1_17": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_7": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_8": "npm:upgrade_client_lib@1.1.8", "upgrade_client_3_0_18": "npm:upgrade_client_lib@3.0.18", "upgrade_client_4_2_0": "npm:upgrade_client_lib@4.2.0", "upgrade_types_1_0_5": "npm:upgrade_types@1.0.5", @@ -3710,6 +3711,11 @@ "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", "dev": true }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/autoprefixer": { "version": "10.4.14", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", @@ -3743,6 +3749,16 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-loader": { "version": "8.2.5", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", @@ -4328,6 +4344,17 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -5030,6 +5057,14 @@ "node": ">=8" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -6023,7 +6058,6 @@ "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "dev": true, "funding": [ { "type": "individual", @@ -6039,6 +6073,19 @@ } } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -7549,7 +7596,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "engines": { "node": ">= 0.6" } @@ -7558,7 +7604,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "dependencies": { "mime-db": "1.52.0" }, @@ -9415,6 +9460,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -11120,7 +11170,7 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/upgrade_client_1_1_17": { + "node_modules/upgrade_client_1_1_7": { "name": "upgrade_client_lib", "version": "1.1.7", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.7.tgz", @@ -11131,6 +11181,17 @@ "upgrade_types": "1.0.3" } }, + "node_modules/upgrade_client_1_1_8": { + "name": "upgrade_client_lib", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.8.tgz", + "integrity": "sha512-A5lIu6C9G0rZSO1PG/eXp14he1CtbqtoCFdts+E2vDpKuqJpZT7LpABr45cz/KIP32CXGWr9JyeO6J39K+uKsg==", + "dependencies": { + "axios": "^1.4.0", + "es6-promise": "^4.2.8", + "uuid": "^8.3.2" + } + }, "node_modules/upgrade_client_3_0_18": { "name": "upgrade_client_lib", "version": "3.0.18", @@ -14447,6 +14508,11 @@ "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "autoprefixer": { "version": "10.4.14", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", @@ -14461,6 +14527,16 @@ "postcss-value-parser": "^4.2.0" } }, + "axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-loader": { "version": "8.2.5", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", @@ -14889,6 +14965,14 @@ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -15400,6 +15484,11 @@ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -16075,8 +16164,17 @@ "follow-redirects": { "version": "1.15.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "dev": true + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } }, "forwarded": { "version": "0.2.0", @@ -17203,14 +17301,12 @@ "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" }, "mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "requires": { "mime-db": "1.52.0" } @@ -18502,6 +18598,11 @@ } } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -19776,7 +19877,7 @@ "picocolors": "^1.0.0" } }, - "upgrade_client_1_1_17": { + "upgrade_client_1_1_7": { "version": "npm:upgrade_client_lib@1.1.7", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.7.tgz", "integrity": "sha512-lT7igTp81nx6FCUyu/730qYBbHcFLWhReJfxZatUmP851Diog6jsRfXgoNlQ6c46CMBn/QOQRJP26F9S8X4cXg==", @@ -19786,6 +19887,16 @@ "upgrade_types": "1.0.3" } }, + "upgrade_client_1_1_8": { + "version": "npm:upgrade_client_lib@1.1.8", + "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.8.tgz", + "integrity": "sha512-A5lIu6C9G0rZSO1PG/eXp14he1CtbqtoCFdts+E2vDpKuqJpZT7LpABr45cz/KIP32CXGWr9JyeO6J39K+uKsg==", + "requires": { + "axios": "^1.4.0", + "es6-promise": "^4.2.8", + "uuid": "^8.3.2" + } + }, "upgrade_client_3_0_18": { "version": "npm:upgrade_client_lib@3.0.18", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-3.0.18.tgz", diff --git a/clientlibs/libTesters/client-lib-tester-frontend/package.json b/clientlibs/libTesters/client-lib-tester-frontend/package.json index aea3d1319d..d0c0967a14 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/package.json +++ b/clientlibs/libTesters/client-lib-tester-frontend/package.json @@ -24,7 +24,8 @@ "@angular/router": "^14.1.0", "rxjs": "~7.5.0", "tslib": "^2.3.0", - "upgrade_client_1_1_17": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_7": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_8": "npm:upgrade_client_lib@1.1.8", "upgrade_client_3_0_18": "npm:upgrade_client_lib@3.0.18", "upgrade_client_4_2_0": "npm:upgrade_client_lib@4.2.0", "upgrade_types_1_0_5": "npm:upgrade_types@1.0.5", diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/app-config.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/app-config.ts index 6ce81834df..e0cf7103f8 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/app-config.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/app-config.ts @@ -1,6 +1,7 @@ import * as UpgradeClient_Local from 'upgrade_client_local/dist/browser'; -// import { UpgradeClient as UpgradeClient_Local } from 'upgrade_client_1_1_17'; -import { UpgradeClient as UpgradeClient_1_1_17 } from 'upgrade_client_1_1_17'; +// import { UpgradeClient as UpgradeClient_Local } from 'upgrade_client_1_1_7'; +import { UpgradeClient as UpgradeClient_1_1_7 } from 'upgrade_client_1_1_7'; +import * as UpgradeClient_1_1_8 from "upgrade_client_1_1_8/dist/browser" import { UpgradeClient as UpgradeClient_3_0_18 } from 'upgrade_client_3_0_18'; import { UpgradeClient as UpgradeClient_4_2_0 } from 'upgrade_client_4_2_0'; import { MOCK_APP_NAMES } from '../../../shared/constants'; @@ -23,7 +24,12 @@ export const availableClientLibraries: ClientLibraryRef[] = [ { version: '1.1.7', language: 'ts', - client: UpgradeClient_1_1_17, + client: UpgradeClient_1_1_7, + }, + { + version: '1.1.8', + language: 'ts', + client: UpgradeClient_1_1_8, }, { version: '3.0.18', diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/birthday-present-app.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/birthday-present-app.service.ts index de4fcf91e6..0116c0e727 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/birthday-present-app.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/birthday-present-app.service.ts @@ -6,7 +6,7 @@ import { ClientAppHook, CodeLanguage, MockAppType, MockClientAppInterfaceModel } // There's probably a clever way to do this, but getting the right types automatically is tricky // import { UpgradeClient } from 'upgrade_client_local'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version1.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version1.service.ts index a5669e7c15..d3fc1485f1 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version1.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version1.service.ts @@ -12,7 +12,8 @@ import { // There's probably a clever way to do this, but getting the right types automatically is tricky // import UpgradeClient from 'upgrade_client_local/dist/browser'; -import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; +import UpgradeClient from "upgrade_client_1_1_8/dist/browser" // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version3.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version3.service.ts index bd09e934d4..5bd59ad55d 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version3.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version3.service.ts @@ -12,7 +12,7 @@ import { // There's probably a clever way to do this, but getting the right types automatically is tricky // import UpgradeClient from 'upgrade_client_local/dist/browser'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version4-1.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version4-1.service.ts index 80399167d5..65ce553ed8 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version4-1.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version4-1.service.ts @@ -13,7 +13,7 @@ import { CaliperEnvelope } from '../../../../../../types/src'; // There's probably a clever way to do this, but getting the right types automatically is tricky // import UpgradeClient from 'upgrade_client_local/dist/browser'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; // import { UpgradeClient } from 'upgrade_client_3_0_18'; import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version5.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version5.service.ts index df9621a6a6..54e817d8ca 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version5.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/general-test-for-version5.service.ts @@ -13,7 +13,8 @@ import { CaliperEnvelope } from '../../../../../../types/src'; // There's probably a clever way to do this, but getting the right types automatically is tricky import UpgradeClient from 'upgrade_client_local/dist/browser'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; +// import * as UpgradeClient_1_1_8 from "upgrade_client_1_1_8/dist/browser" // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; @@ -30,8 +31,8 @@ export enum MARKED_DECISION_POINT_STATUS { providedIn: 'root', }) export class GeneralTestForVersion5Service extends AbstractMockAppService { - public override upgradeClient!: UpgradeClient; - // public upgradeClient: any; + // public override upgradeClient!: UpgradeClient; + public upgradeClient: any; /******************* required metadata to describe the mock app and its callable hooks ********************/ public NAME = MOCK_APP_NAMES.GENERAL_TS_FRONTEND_5_0; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-mathstream-browser.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-mathstream-browser.service.ts index 5bed9d9ff6..d368a5bddc 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-mathstream-browser.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-mathstream-browser.service.ts @@ -12,7 +12,8 @@ import { // There's probably a clever way to do this, but getting the right types automatically is tricky // import UpgradeClient from 'upgrade_client_local/dist/browser'; -import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; +import UpgradeClient from "upgrade_client_1_1_8/dist/browser" // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-portal.service.ts b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-portal.service.ts index cf762613a3..db9acf5de4 100644 --- a/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-portal.service.ts +++ b/clientlibs/libTesters/client-lib-tester-frontend/src/app/mockFrontendClientAppComponents/mock-portal.service.ts @@ -8,7 +8,7 @@ import { AbstractMockAppService } from './abstract-mock-app.service'; // There's probably a clever way to do this, but getting the right types automatically is tricky // import { UpgradeClient } from 'upgrade_client_local'; -// import { UpgradeClient } from 'upgrade_client_1_1_17'; +// import { UpgradeClient } from 'upgrade_client_1_1_7'; // import { UpgradeClient } from 'upgrade_client_3_0_18'; // import { UpgradeClient } from 'upgrade_client_4_2_0'; diff --git a/clientlibs/libTesters/shared/constants.ts b/clientlibs/libTesters/shared/constants.ts index 352d149144..d6928a8578 100644 --- a/clientlibs/libTesters/shared/constants.ts +++ b/clientlibs/libTesters/shared/constants.ts @@ -1,10 +1,11 @@ export const MOCK_APP_NAMES = { - GENERAL_TS_BACKEND_5: 'General TS Backend v5.0', - GENERAL_TS_FRONTEND_1_1: 'General TS Frontend v1.1', - GENERAL_TS_FRONTEND_3_0: 'General TS Frontend v3.0', - GENERAL_TS_FRONTEND_4_1: 'General TS Frontend v4.1', - GENERAL_TS_FRONTEND_5_0: 'General TS Frontend v5.0', - BDAY_APP: 'Birthday App Frontend', + GENERAL_TS_BACKEND_1: 'General TS Node v1.0', + GENERAL_TS_BACKEND_5: 'General TS Node v5.0', + GENERAL_TS_FRONTEND_1_1: 'General TS Browser v1.1', + GENERAL_TS_FRONTEND_3_0: 'General TS Browser v3.0', + GENERAL_TS_FRONTEND_4_1: 'General TS Browser v4.1', + GENERAL_TS_FRONTEND_5_0: 'General TS Browser v5.0', + BDAY_APP: 'Birthday App Browser', PORTAL_APP: 'Mock Portal', MATHSTREAM_AdaptiveSegmentSwapExperiment: 'Mathstream: AdaptiveSegmentSwapExperiment', }; diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/package-lock.json b/clientlibs/libTesters/ts-lib-tester-backend-server/package-lock.json index eff27f4734..f5c13c85d4 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/package-lock.json +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/package-lock.json @@ -12,7 +12,8 @@ "dependencies": { "cors": "^2.8.5", "express": "^4.18.2", - "upgrade_client_1_1_17": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_7": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_8": "npm:upgrade_client_lib@1.1.8", "upgrade_client_3_0_18": "npm:upgrade_client_lib@3.0.18", "upgrade_client_4_2_0": "npm:upgrade_client_lib@4.2.0", "upgrade_types_1_0_5": "npm:upgrade_types@1.0.5", @@ -286,6 +287,21 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -453,6 +469,17 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -560,6 +587,14 @@ "ms": "2.0.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -721,6 +756,38 @@ "node": ">= 0.8" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1195,6 +1262,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -1585,7 +1657,7 @@ "node": ">= 0.8" } }, - "node_modules/upgrade_client_1_1_17": { + "node_modules/upgrade_client_1_1_7": { "name": "upgrade_client_lib", "version": "1.1.7", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.7.tgz", @@ -1596,6 +1668,17 @@ "upgrade_types": "1.0.3" } }, + "node_modules/upgrade_client_1_1_8": { + "name": "upgrade_client_lib", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.8.tgz", + "integrity": "sha512-A5lIu6C9G0rZSO1PG/eXp14he1CtbqtoCFdts+E2vDpKuqJpZT7LpABr45cz/KIP32CXGWr9JyeO6J39K+uKsg==", + "dependencies": { + "axios": "^1.4.0", + "es6-promise": "^4.2.8", + "uuid": "^8.3.2" + } + }, "node_modules/upgrade_client_3_0_18": { "name": "upgrade_client_lib", "version": "3.0.18", @@ -2033,6 +2116,21 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2160,6 +2258,14 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2238,6 +2344,11 @@ "ms": "2.0.0" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2370,6 +2481,21 @@ "unpipe": "~1.0.0" } }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -2709,6 +2835,11 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -2988,7 +3119,7 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, - "upgrade_client_1_1_17": { + "upgrade_client_1_1_7": { "version": "npm:upgrade_client_lib@1.1.7", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.7.tgz", "integrity": "sha512-lT7igTp81nx6FCUyu/730qYBbHcFLWhReJfxZatUmP851Diog6jsRfXgoNlQ6c46CMBn/QOQRJP26F9S8X4cXg==", @@ -2998,6 +3129,16 @@ "upgrade_types": "1.0.3" } }, + "upgrade_client_1_1_8": { + "version": "npm:upgrade_client_lib@1.1.8", + "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-1.1.8.tgz", + "integrity": "sha512-A5lIu6C9G0rZSO1PG/eXp14he1CtbqtoCFdts+E2vDpKuqJpZT7LpABr45cz/KIP32CXGWr9JyeO6J39K+uKsg==", + "requires": { + "axios": "^1.4.0", + "es6-promise": "^4.2.8", + "uuid": "^8.3.2" + } + }, "upgrade_client_3_0_18": { "version": "npm:upgrade_client_lib@3.0.18", "resolved": "https://registry.npmjs.org/upgrade_client_lib/-/upgrade_client_lib-3.0.18.tgz", diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/package.json b/clientlibs/libTesters/ts-lib-tester-backend-server/package.json index 656c9c7b9c..8a265644e3 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/package.json +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/package.json @@ -19,7 +19,8 @@ "dependencies": { "cors": "^2.8.5", "express": "^4.18.2", - "upgrade_client_1_1_17": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_7": "npm:upgrade_client_lib@1.1.7", + "upgrade_client_1_1_8": "npm:upgrade_client_lib@1.1.8", "upgrade_client_3_0_18": "npm:upgrade_client_lib@3.0.18", "upgrade_client_4_2_0": "npm:upgrade_client_lib@4.2.0", "upgrade_types_1_0_5": "npm:upgrade_types@1.0.5", diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/src/app-config.ts b/clientlibs/libTesters/ts-lib-tester-backend-server/src/app-config.ts index 03f56b7aab..15f77795a7 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/src/app-config.ts +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/src/app-config.ts @@ -1,29 +1,16 @@ import { MOCK_APP_NAMES } from '../../shared/constants.js'; import UpgradeClient_Local from 'upgrade_client_local/dist/node'; -// import * as UpgradeClient_1_1_17 from 'upgrade_client_1_1_17'; -// import * as UpgradeClient_3_0_18 from 'upgrade_client_3_0_18'; -// import * as UpgradeClient_4_2_0 from 'upgrade_client_4_2_0'; +import UpgradeClient_1_1_8 from 'upgrade_client_1_1_8/dist/node' export const availableClientLibraries: any[] = [ { version: 'local', client: UpgradeClient_Local, }, - // { - // version: '1.1.7', - // // client: UpgradeClient_1_1_17, - // client: {}, - // }, - // { - // version: '3.0.18', - // // client: UpgradeClient_3_0_18, - // client: {}, - // }, - // { - // version: '4.2.0', - // // client: UpgradeClient_4_2_0, - // client: {}, - // }, + { + version: '1.1.8', + client: UpgradeClient_1_1_8, + }, ]; -export const availableBackendMockApps = [MOCK_APP_NAMES.GENERAL_TS_BACKEND_5]; +export const availableBackendMockApps = [MOCK_APP_NAMES.GENERAL_TS_BACKEND_1, MOCK_APP_NAMES.GENERAL_TS_BACKEND_5]; diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/src/app.ts b/clientlibs/libTesters/ts-lib-tester-backend-server/src/app.ts index 7b03edb378..d50523aa82 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/src/app.ts +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/src/app.ts @@ -4,6 +4,7 @@ import { getUpgradeClientConstructor, validateHook } from './utils.js'; import routeHookToMockApp from './routeHookToMockApp.js'; import cors from 'cors'; import { GeneralTSBackendVersion5 } from './mockBackendTSServerApps/GeneralTSBackendVersion5.js'; +import { GeneralTSBackendVersion1 } from './mockBackendTSServerApps/GeneralTSBackendVersion1.js'; // import dotenv from 'dotenv'; // dotenv.config(); @@ -24,7 +25,10 @@ app.get('/api', (req: Request, res: Response) => { app.get('/api/mock-app-models', (req: Request, res: Response) => { // get the models from the mock apps themselves - const models = [new GeneralTSBackendVersion5().getAppInterfaceModel()]; + const models = [ + new GeneralTSBackendVersion1().getAppInterfaceModel(), + new GeneralTSBackendVersion5().getAppInterfaceModel(), + ]; res.json({ models }); }); diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/src/mockBackendTSServerApps/GeneralTSBackendVersion1.ts b/clientlibs/libTesters/ts-lib-tester-backend-server/src/mockBackendTSServerApps/GeneralTSBackendVersion1.ts new file mode 100644 index 0000000000..db2115a978 --- /dev/null +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/src/mockBackendTSServerApps/GeneralTSBackendVersion1.ts @@ -0,0 +1,364 @@ +import { AbstractTSBackendMockApp } from './AbstractTSBackendMockApp'; +import UpgradeClient from 'upgrade_client_1_1_8/dist/node'; + +import { MOCK_APP_NAMES } from '../../../shared/constants'; + +import { + MockAppType, + CodeLanguage, + MockClientAppInterfaceModel, + HookRequestBody, + HookResponse, +} from '../../../shared/models.js'; + +export enum MARKED_DECISION_POINT_STATUS { + CONDITION_APPLIED = 'condition applied', + CONDITION_FAILED_TO_APPLY = 'condition not applied', + NO_CONDITION_ASSIGNED = 'no condition assigned', +} + +export class GeneralTSBackendVersion1 extends AbstractTSBackendMockApp { + // implement required abstract properties + public override upgradeClient!: UpgradeClient; + // public upgradeClient: any; + + /******************* required metadata to describe the mock app and its callable hooks ********************/ + public NAME = MOCK_APP_NAMES.GENERAL_TS_BACKEND_1; + public DESCRIPTION = 'Regression testing for lib version 1'; + public TYPE: MockAppType = 'frontend'; + public LANGUAGE: CodeLanguage = 'ts'; + public SITES = { + TEST: 'test', + }; + public TARGETS = { + TARGET_1: 'target_1', + TARGET_2: 'target_2', + }; + public GROUPS = ['schoolId', 'classId', 'instructorId']; + public CONTEXT = 'assign-prog'; // what should this be really? + public HOOKNAMES = { + INIT: 'init', + ASSIGN: 'assign', + MARK_EXPERIMENT_POINT: 'markExperimentPoint', + GROUP_MEMBERSHIP: 'setGroupMembership', + WORKING_GROUPS: 'setWorkingGroup', + SET_ALT_USER_IDS: 'setAltUserIds', + LOG: 'log', + }; + public DECISION_POINTS = [ + { site: this.SITES.TEST, target: this.TARGETS.TARGET_1 }, + { site: this.SITES.TEST, target: this.TARGETS.TARGET_2 }, + ]; + + constructor(UpgradeClientConstructor?: any) { + super(UpgradeClientConstructor); + } + + public getAppInterfaceModel(): MockClientAppInterfaceModel { + return { + name: this.NAME, + description: this.DESCRIPTION, + type: this.TYPE, + language: this.LANGUAGE, + hooks: [ + { + name: this.HOOKNAMES.INIT, + description: 'Dispatches .init()', + }, + { + name: this.HOOKNAMES.ASSIGN, + description: 'Dispatches .getAllExperimentConditions()', + }, + { + name: this.HOOKNAMES.MARK_EXPERIMENT_POINT, + description: 'Dispatches .markExperimentPoint() for target 1, control condition', + }, + { + name: this.HOOKNAMES.SET_ALT_USER_IDS, + description: 'Dispatches .setAltUserIds() for user', + }, + { + name: this.HOOKNAMES.GROUP_MEMBERSHIP, + description: 'Dispatches .setGroupMembership() for user', + }, + { + name: this.HOOKNAMES.WORKING_GROUPS, + description: 'Dispatches .setWorkingGroup() for user', + }, + { + name: this.HOOKNAMES.LOG, + description: 'Dispatches .log() for user', + }, + ], + decisionPoints: this.DECISION_POINTS, + groups: this.GROUPS, + buttons: [ + { + label: this.HOOKNAMES.INIT, + hookName: this.HOOKNAMES.INIT, + }, + { + label: this.HOOKNAMES.ASSIGN, + hookName: this.HOOKNAMES.ASSIGN, + }, + { + label: this.HOOKNAMES.MARK_EXPERIMENT_POINT, + hookName: this.HOOKNAMES.MARK_EXPERIMENT_POINT, + }, + { + label: this.HOOKNAMES.SET_ALT_USER_IDS, + hookName: this.HOOKNAMES.SET_ALT_USER_IDS, + }, + { + label: this.HOOKNAMES.WORKING_GROUPS, + hookName: this.HOOKNAMES.WORKING_GROUPS, + }, + { + label: this.HOOKNAMES.GROUP_MEMBERSHIP, + hookName: this.HOOKNAMES.GROUP_MEMBERSHIP, + }, + { + label: this.HOOKNAMES.LOG, + hookName: this.HOOKNAMES.LOG, + }, + ], + }; + } + + /******************* "routeHook" required to route requests from tester-app to simulated client code snippets ********************/ + public async routeHook(hookEvent: HookRequestBody): Promise { + const { name, user } = hookEvent; + if (name === '') + return { + hookReceived: hookEvent, + response: { + error: 'No hook name provided', + }, + }; + + if (!user || !user.id) { + return { + hookReceived: hookEvent, + response: { + error: 'No user id provided', + }, + }; + } + + if (name === this.HOOKNAMES.INIT && user?.id) { + return await this.doInit(hookEvent); + } else if (name === this.HOOKNAMES.ASSIGN) { + return await this.doAssign(hookEvent); + } else if (name === this.HOOKNAMES.MARK_EXPERIMENT_POINT) { + return await this.doMark(hookEvent); + } else if (name === this.HOOKNAMES.SET_ALT_USER_IDS) { + return await this.doUserAliases(hookEvent); + } else if (name === this.HOOKNAMES.GROUP_MEMBERSHIP) { + return await this.doGroupMembership(hookEvent); + } else if (name === this.HOOKNAMES.WORKING_GROUPS) { + return await this.doWorkingGroupMembership(hookEvent); + } else if (name === this.HOOKNAMES.LOG) { + return await this.doLog(hookEvent); + } else { + return { + hookReceived: hookEvent, + response: { + error: `No hook found for hookName: ${name}`, + }, + }; + } + } + + /******************* simulated client app code ****************************************************/ + + private async doInit(hookEvent: HookRequestBody): Promise { + console.log(`'doInit called:'`, hookEvent); + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + console.log({ upgradeClient: this.upgradeClient }); + + try { + const initResponse = await this.upgradeClient.init(); + console.log({ initResponse }); + return { + hookReceived: hookEvent, + response: initResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doAssign(hookEvent: HookRequestBody): Promise { + console.log('doAssign called:', hookEvent); + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + try { + const assignmentsResponse = await this.upgradeClient.getAllExperimentConditions(this.CONTEXT); + console.log({ assignmentsResponse }); + return { + hookReceived: hookEvent, + response: assignmentsResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doMark(hookEvent: HookRequestBody): Promise { + console.log('doMark called:', hookEvent); + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + try { + const markResponse = await this.upgradeClient.markExperimentPoint( + this.SITES.TEST, + 'control', + this.TARGETS.TARGET_1, + ); + console.log({ markResponse }); + return { + hookReceived: hookEvent, + response: markResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doUserAliases(hookEvent: HookRequestBody): Promise { + console.log('doUserAliases called:', hookEvent); + + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + try { + const useraliasesResponse = await this.upgradeClient.setAltUserIds(hookEvent.user.userAliases); + console.log({ useraliasesResponse }); + return { + hookReceived: hookEvent, + response: useraliasesResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doGroupMembership(hookEvent: HookRequestBody): Promise { + console.log('doGroupMembership called:', hookEvent); + + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + if (!hookEvent.user || !hookEvent.user.groups) { + console.error('User info is missing groups:', hookEvent.user); + } + + const groupMap = new Map>(); + for (const group in hookEvent.user.groups) { + groupMap.set(group, hookEvent.user.groups[group]); + } + + try { + const groupMembershipResponse = await this.upgradeClient.setGroupMembership(groupMap); + console.log({ groupMembershipResponse }); + return { + hookReceived: hookEvent, + response: groupMembershipResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doWorkingGroupMembership(hookEvent: HookRequestBody): Promise { + console.log('doWorkingGroupMembership', hookEvent); + + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + const workingGroupMap = new Map(); + + + try { + const workingGroupMembershipResponse = await this.upgradeClient.setWorkingGroup(workingGroupMap); + console.log({ workingGroupMembershipResponse }); + return { + hookReceived: hookEvent, + response: workingGroupMembershipResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } + + private async doLog(hookEvent: HookRequestBody): Promise { + console.log('doLog', hookEvent); + this.upgradeClient = this.constructUpgradeClient(hookEvent.user.id, hookEvent.apiHostUrl); + + const logRequest = [ + { + userId: hookEvent.user.id, + timestamp: '2022-03-03T19:49:00.496', + metrics: { + attributes: { + totalTimeSeconds: 41834, + totalMasteryWorkspacesCompleted: 15, + totalConceptBuildersCompleted: 17, + totalMasteryWorkspacesGraduated: 15, + totalSessions: 50, + totalProblemsCompleted: 249, + }, + groupedMetrics: [ + { + groupClass: 'conceptBuilderWorkspace', + groupKey: 'graphs_of_functions', + groupUniquifier: '2022-02-03T19:48:53.861Z', + attributes: { + timeSeconds: 488, + hintCount: 2, + errorCount: 15, + completionCount: 1, + workspaceCompletionStatus: 'GRADUATED', + problemsCompleted: 4, + }, + }, + ], + }, + }, + ]; + try { + const logResponse = await this.upgradeClient.log(logRequest); + console.log({ logResponse }); + return { + hookReceived: hookEvent, + response: logResponse, + }; + } catch (err) { + console.error(err); + return { + hookReceived: hookEvent, + response: err, + }; + } + } +} diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/src/routeHookToMockApp.ts b/clientlibs/libTesters/ts-lib-tester-backend-server/src/routeHookToMockApp.ts index 7bcda32878..ffbdcb10fc 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/src/routeHookToMockApp.ts +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/src/routeHookToMockApp.ts @@ -1,13 +1,14 @@ import { MOCK_APP_NAMES } from '../../shared/constants.js'; import { HookRequestBody, HookResponse } from '../../shared/models.js'; -// import { availableBackendMockApps } from './app-config.js'; +import { GeneralTSBackendVersion1 } from './mockBackendTSServerApps/GeneralTSBackendVersion1.js'; import { GeneralTSBackendVersion5 } from './mockBackendTSServerApps/GeneralTSBackendVersion5.js'; -// import BirthdayApp from './mockBackendTSServerApps/BirthdayApp.js'; export default async function (clientConstructor: any, hookRequest: HookRequestBody): Promise { const { mockApp } = hookRequest; - if (mockApp === MOCK_APP_NAMES.GENERAL_TS_BACKEND_5) { + if (mockApp === MOCK_APP_NAMES.GENERAL_TS_BACKEND_1) { + return new GeneralTSBackendVersion1(clientConstructor).routeHook(hookRequest); + } else if (mockApp === MOCK_APP_NAMES.GENERAL_TS_BACKEND_5) { return new GeneralTSBackendVersion5(clientConstructor).routeHook(hookRequest); } else { return {