diff --git a/.eslintrc.js b/.eslintrc.js index 19ac080824..8f99291add 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,10 +21,12 @@ module.exports = { 'plugins': [ "@typescript-eslint", '@angular-eslint/eslint-plugin', + 'eslint-plugin-tsdoc', 'prettier' ], 'root': true, 'rules': { + 'tsdoc/syntax': 'warn', '@angular-eslint/component-class-suffix': 'error', '@angular-eslint/directive-class-suffix': 'error', '@angular-eslint/no-input-rename': 'error', diff --git a/backend/packages/Upgrade/package-lock.json b/backend/packages/Upgrade/package-lock.json index a10b741d27..66df07fe0a 100644 --- a/backend/packages/Upgrade/package-lock.json +++ b/backend/packages/Upgrade/package-lock.json @@ -652,11 +652,11 @@ "integrity": "sha512-hv+j/vau2oj5CuhY1CrTs48Qu+ZVXpm/56OzKcL2KVN8+yc0ZIMbvTIld1wbrT1RrvAuwfDmUM2s3aSy7veuwg==" }, "node_modules/@grpc/grpc-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.5.1.tgz", - "integrity": "sha512-ItOqQ4ff7JrR9W6KDQm+LdsVjuZtV7Qq64Oy3Hjx8ZPBDDwBx7rD8hOL0Vnde0RbnsqLG86WOgF+tQDzf/nSzQ==", + "version": "1.8.17", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.17.tgz", + "integrity": "sha512-DGuSbtMFbaRsyffMf+VEkVu8HkSXEUfO3UyGJNtqxW9ABdtTIA+2UXAJpwbJS+xfQxuwqLUeELmL6FuZkOqPxw==", "dependencies": { - "@grpc/proto-loader": "^0.6.4", + "@grpc/proto-loader": "^0.7.0", "@types/node": ">=12.12.47" }, "engines": { @@ -664,15 +664,15 @@ } }, "node_modules/@grpc/grpc-js/node_modules/@grpc/proto-loader": { - "version": "0.6.13", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.13.tgz", - "integrity": "sha512-FjxPYDRTn6Ec3V0arm1FtSpmP6V50wuph2yILpyvTKzjc76oDdoihXqM1DzOW5ubvCC8GivfCnNtfaRE8myJ7g==", + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.7.tgz", + "integrity": "sha512-1TIeXOi8TuSCQprPItwoMymZXxWT0CPxUhkrkeCUH+D8U7QDwQ6b7SUz2MaLuWM2llT+J/TVFLmQI5KtML3BhQ==", "dependencies": { "@types/long": "^4.0.1", "lodash.camelcase": "^4.3.0", "long": "^4.0.0", - "protobufjs": "^6.11.3", - "yargs": "^16.2.0" + "protobufjs": "^7.0.0", + "yargs": "^17.7.2" }, "bin": { "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" @@ -681,6 +681,72 @@ "node": ">=6" } }, + "node_modules/@grpc/grpc-js/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@grpc/grpc-js/node_modules/protobufjs": { + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@grpc/grpc-js/node_modules/protobufjs/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, + "node_modules/@grpc/grpc-js/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@grpc/grpc-js/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, "node_modules/@grpc/proto-loader": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.6.tgz", @@ -5412,11 +5478,6 @@ "node": ">=0.6" } }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, "node_modules/http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -16587,25 +16648,80 @@ "integrity": "sha512-hv+j/vau2oj5CuhY1CrTs48Qu+ZVXpm/56OzKcL2KVN8+yc0ZIMbvTIld1wbrT1RrvAuwfDmUM2s3aSy7veuwg==" }, "@grpc/grpc-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.5.1.tgz", - "integrity": "sha512-ItOqQ4ff7JrR9W6KDQm+LdsVjuZtV7Qq64Oy3Hjx8ZPBDDwBx7rD8hOL0Vnde0RbnsqLG86WOgF+tQDzf/nSzQ==", + "version": "1.8.17", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.17.tgz", + "integrity": "sha512-DGuSbtMFbaRsyffMf+VEkVu8HkSXEUfO3UyGJNtqxW9ABdtTIA+2UXAJpwbJS+xfQxuwqLUeELmL6FuZkOqPxw==", "requires": { - "@grpc/proto-loader": "^0.6.4", + "@grpc/proto-loader": "^0.7.0", "@types/node": ">=12.12.47" }, "dependencies": { "@grpc/proto-loader": { - "version": "0.6.13", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.13.tgz", - "integrity": "sha512-FjxPYDRTn6Ec3V0arm1FtSpmP6V50wuph2yILpyvTKzjc76oDdoihXqM1DzOW5ubvCC8GivfCnNtfaRE8myJ7g==", + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.7.tgz", + "integrity": "sha512-1TIeXOi8TuSCQprPItwoMymZXxWT0CPxUhkrkeCUH+D8U7QDwQ6b7SUz2MaLuWM2llT+J/TVFLmQI5KtML3BhQ==", "requires": { "@types/long": "^4.0.1", "lodash.camelcase": "^4.3.0", "long": "^4.0.0", - "protobufjs": "^6.11.3", - "yargs": "^16.2.0" + "protobufjs": "^7.0.0", + "yargs": "^17.7.2" } + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "protobufjs": { + "version": "7.2.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", + "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "dependencies": { + "long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + } + } + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" } } }, @@ -20265,10 +20381,6 @@ } } }, - "http-cache-semantics": { - "version": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", diff --git a/backend/packages/Upgrade/src/api/controllers/ExperimentClientController.v4.ts b/backend/packages/Upgrade/src/api/controllers/ExperimentClientController.v4.ts index 75c6247130..ffcad37ca8 100644 --- a/backend/packages/Upgrade/src/api/controllers/ExperimentClientController.v4.ts +++ b/backend/packages/Upgrade/src/api/controllers/ExperimentClientController.v4.ts @@ -41,6 +41,8 @@ import { env } from '../../env'; import { MonitoredDecisionPointLog } from '../models/MonitoredDecisionPointLog'; import { MarkExperimentValidatorv4 } from './validators/MarkExperimentValidator.v4'; import { Log } from '../models/Log'; +import { flatten } from '@nestjs/common'; +import { CaliperLogEnvelope } from './validators/CaliperLogEnvelope'; interface IMonitoredDecisionPoint { id: string; @@ -633,6 +635,53 @@ export class ExperimentClientController { }); } + /** + * @swagger + * /log/caliper: + * post: + * description: Post Caliper format log data + * consumes: + * - application/json + * parameters: + * - in: body + * name: data + * required: true + * description: User Document + * tags: + * - Client Side SDK + * produces: + * - application/json + * responses: + * '200': + * description: Log data + * '500': + * description: null value in column "id\" of relation \"experiment_user\" violates not-null constraint + */ + @Post('log/caliper') + public async caliperLog( + @Body({ validate: { validationError: { target: false, value: false } } }) + @Req() + request: AppRequest, + envelope: CaliperLogEnvelope + ): Promise { + const result = envelope.data.map(async (log) => { + // getOriginalUserDoc call for alias + const experimentUserDoc = await this.getUserDoc(log.object.assignee.id, request.logger); + if (experimentUserDoc) { + // append userDoc in logger + request.logger.child({ userDoc: experimentUserDoc }); + request.logger.info({ message: 'Got the original user doc' }); + } + return this.experimentAssignmentService.caliperDataLog(log, { + logger: request.logger, + userDoc: experimentUserDoc, + }); + }); + + const logsToReturn = await Promise.all(result); + return flatten(logsToReturn); + } + /** * @swagger * /bloblog: diff --git a/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts b/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts index b290a312c6..7e27a29aa4 100644 --- a/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts +++ b/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts @@ -270,7 +270,7 @@ export class ExperimentAssignmentService { if (!experimentId) { if (filteredExperiments.length > 1) { const random = seedrandom(userId)(); - experimentId = filteredExperiments[Math.floor(random * experiments.length)].id; + experimentId = filteredExperiments[Math.floor(random * filteredExperiments.length)].id; } else { experimentId = filteredExperiments[0]?.id; } diff --git a/clientlibs/java/pom.xml b/clientlibs/java/pom.xml index 5028310ed9..c08ec8baf3 100644 --- a/clientlibs/java/pom.xml +++ b/clientlibs/java/pom.xml @@ -49,7 +49,6 @@ jersey-media-json-jackson 2.30.1 - org.glassfish.jersey.inject jersey-hk2 diff --git a/clientlibs/java/src/main/java/org/upgradeplatform/client/Main.java b/clientlibs/java/src/main/java/org/upgradeplatform/client/Main.java index 1bda54fda0..1203dc2706 100644 --- a/clientlibs/java/src/main/java/org/upgradeplatform/client/Main.java +++ b/clientlibs/java/src/main/java/org/upgradeplatform/client/Main.java @@ -11,110 +11,101 @@ import org.eclipse.jdt.annotation.NonNull; import org.upgradeplatform.interfaces.ResponseCallback; -import org.upgradeplatform.requestbeans.MarkExperimentRequestData; -import org.upgradeplatform.responsebeans.UserAliasResponse; import org.upgradeplatform.responsebeans.Condition; import org.upgradeplatform.responsebeans.ErrorResponse; import org.upgradeplatform.responsebeans.ExperimentUser; import org.upgradeplatform.responsebeans.ExperimentsResponse; import org.upgradeplatform.responsebeans.InitializeUser; import org.upgradeplatform.responsebeans.MarkExperimentPoint; +import org.upgradeplatform.responsebeans.UserAliasResponse; import org.upgradeplatform.utils.Utils.MarkedDecisionPointStatus; public class Main { - public static void main(String[] args) throws InterruptedException, ExecutionException - { - final String baseUrl = "http://localhost:3030"; - final String userId = UUID.randomUUID().toString(); - final String site = "SelectSection"; + public static void main(String[] args) throws InterruptedException, ExecutionException + { + final String baseUrl = "https://upgradeapi.qa-cli.net"; + final String userId = UUID.randomUUID().toString(); + final String site = "SelectSection"; - String target = args.length > 0 ? args[0] : "absolute_value_plot_equality"; + String target = args.length > 0 ? args[0] : "volume_surface_area_cone_vol"; - try(ExperimentClient experimentClient = new ExperimentClient(userId, "BearerToken", baseUrl, Collections.emptyMap())){ - CompletableFuture result = new CompletableFuture<>(); + try(ExperimentClient experimentClient = new ExperimentClient(userId, "BearerToken", baseUrl, Collections.emptyMap())){ + CompletableFuture result = new CompletableFuture<>(); System.out.println(prefix() + "initiating requests"); experimentClient.init(new ResponseCallback() { @Override public void onSuccess(@NonNull InitializeUser t){ - System.out.println("init " + t); - List schools = new ArrayList(); + + List schools = new ArrayList<>(); schools.add("school1"); - Map> group = new HashMap>(); + Map> group = new HashMap<>(); group.put("schoolid", schools); System.out.println(prefix() + "setting group membership"); experimentClient.setGroupMembership(group, new ResponseCallback(){ @Override public void onSuccess(@NonNull ExperimentUser expResult){ - System.out.println("group membership " + expResult); - System.out.println("success updating groups"); - } - @Override - public void onError(@NonNull ErrorResponse error){ - System.out.println("error updating groups " + error); - } - }); - - - System.out.println(prefix() + "setting working group"); - Map workingGroup = new HashMap(); - workingGroup.put("schoolId", "school1"); - experimentClient.setWorkingGroup(workingGroup, new ResponseCallback(){ - @Override - public void onSuccess(@NonNull ExperimentUser expResult){ - System.out.println("working group " + expResult); - System.out.println("success updating working groups"); - } - @Override - public void onError(@NonNull ErrorResponse error){ - System.out.println("error updating working groups " + error); - } - }); + System.out.println(prefix() + "success updating groups; setting working group"); - - System.out.println(prefix() + "setting user aliases"); - List altIds = new ArrayList(); - altIds.add(UUID.randomUUID().toString()); - experimentClient.setAltUserIds(altIds, new ResponseCallback(){ - @Override - public void onSuccess(@NonNull UserAliasResponse t) { - System.out.println("aliases " + t); - System.out.println("success updating user aliases"); - } - @Override - public void onError(@NonNull ErrorResponse error){ - System.out.println("error updating user aliases " + error); - } - - }); - - System.out.println(prefix() + "getting conditions"); - experimentClient.getExperimentCondition("assign-prog", site, target, new ResponseCallback(){ - @Override - public void onSuccess(@NonNull ExperimentsResponse expResult){ - System.out.println("condition " + expResult); - Condition condition = expResult.getAssignedCondition(); - String code = condition == null ? null : condition.getConditionCode(); - MarkExperimentRequestData data = new MarkExperimentRequestData(site, target, condition); - experimentClient.markExperimentPoint(MarkedDecisionPointStatus.CONDITION_APPLIED, data, new ResponseCallback(){ + Map workingGroup = new HashMap<>(); + workingGroup.put("schoolId", "school1"); + experimentClient.setWorkingGroup(workingGroup, new ResponseCallback(){ @Override - public void onSuccess(@NonNull MarkExperimentPoint markResult){ - result.complete("marked " + code + ": " + markResult.toString()); + public void onSuccess(@NonNull ExperimentUser expResult){ + System.out.println(prefix() + "success updating working groups; setting user aliases"); + + List altIds = new ArrayList<>(); + altIds.add(UUID.randomUUID().toString()); + experimentClient.setAltUserIds(altIds, new ResponseCallback(){ + @Override + public void onSuccess(@NonNull UserAliasResponse uar) { + System.out.println(prefix() + "success updating user aliases; getting conditions"); + + experimentClient.getExperimentCondition("assign-prog", site, target, new ResponseCallback(){ + @Override + public void onSuccess(@NonNull ExperimentsResponse expResult){ + System.out.println(prefix() + "success getting condition; marking"); + + Condition condition = expResult.getAssignedCondition(); + String code = condition == null ? null : condition.getConditionCode(); + experimentClient.markExperimentPoint(site, target, code, MarkedDecisionPointStatus.CONDITION_APPLIED, new ResponseCallback(){ + @Override + public void onSuccess(@NonNull MarkExperimentPoint markResult){ + result.complete("marked " + code + ": " + markResult.toString()); + } + + @Override + public void onError(@NonNull ErrorResponse error){ + result.complete("error marking " + code + ": " + error.toString()); + } + }); + } + + @Override + public void onError(@NonNull ErrorResponse error){ + result.complete(error.toString()); + } + + }); + } + @Override + public void onError(@NonNull ErrorResponse error){ + result.complete(error.toString()); + } + + }); } - @Override public void onError(@NonNull ErrorResponse error){ - result.complete("error marking " + code + ": " + error.toString()); + result.complete(error.toString()); } }); } - @Override public void onError(@NonNull ErrorResponse error){ result.complete(error.toString()); } - }); } @@ -127,10 +118,10 @@ public void onError(@NonNull ErrorResponse error){ System.out.println(prefix() + result.getNow("not complete yet")); String rs = result.get(); System.out.println(prefix() + rs); - } - } + } + } - private static final String prefix() { - return "on thread " + Thread.currentThread().getName() + " at " + System.currentTimeMillis() + ": "; - } + private static final String prefix() { + return "on thread " + Thread.currentThread().getName() + " at " + System.currentTimeMillis() + ": "; + } } \ No newline at end of file diff --git a/clientlibs/java/src/main/java/org/upgradeplatform/utils/APIService.java b/clientlibs/java/src/main/java/org/upgradeplatform/utils/APIService.java index 99832ad089..2c7158163c 100644 --- a/clientlibs/java/src/main/java/org/upgradeplatform/utils/APIService.java +++ b/clientlibs/java/src/main/java/org/upgradeplatform/utils/APIService.java @@ -65,4 +65,4 @@ public AsyncInvoker prepareRequest(String apiPath) { public void close() { client.close(); } -} +} \ No newline at end of file diff --git a/clientlibs/js/README.md b/clientlibs/js/README.md index 9ccb362eb5..3526dd116b 100644 --- a/clientlibs/js/README.md +++ b/clientlibs/js/README.md @@ -1,96 +1,467 @@ -# UPGRADE CLIENT SIDE SDK -# Exported Class -UpgradeClient named class is exported from this library - -# Functions - -## Initialize User -Two ways for initializing users -``` const upClient = UpgradeClient('userId', 'hostUrl');``` -``` const upClient = UpgradeClient('userId', 'hostUrl', 'token');``` - -## setAltUserIds(altUserIds: string[]) -Set alternative user ids for current user -``` upClient.setAltUserIds(altUserIds)``` - -## setGroupMembership (group: Map>) -Updates/Set the group membership of the initialized user -```upClient.setGroupMembership(group)``` - -## setWorkingGroup (workingGroup: Map) -Updates/Set the working group of the initialized user -```upClient.setWorkingGroup(workingGroup)``` - -## getAllExperimentConditions(context: string) -Get all the experiment assignments for the initialized user -```upClient.getAllExperimentConditions(context)``` - -## getExperimentCondition (context: string, experimentPoint: string, partitionId?: string) -Returns the Experiment Condition for the partition and point received from the getAllExperimentConditions for the initialized user. If getAllExperimentConditions is not called before this function then it will call it internally and return the result. -```upClient.getExperimentCondition(context, experimentPoint)``` -```upClient.getExperimentCondition(context, experimentPoint, partitionId)``` - -## markExperimentPoint (experimentPoint: string, condition:string|null, partitionId?: string) -Calls markExperimentPoint for experiment point and partitionId. It will use the user definition from initialized user -```upClient.markExperimentPoint(experimentPoint,condition)``` -```upClient.markExperimentPoint(experimentPoint, condition, partitionId)``` - -## failedExperimentPoint(experimentPoint: string, reason: string, experimentId?: string) -Use this function to report failure with given reason -```upClient.failedExperimentPoint(experimentPoint, reason)``` -```upClient.failedExperimentPoint(experimentPoint, reason, experimentId)``` - -## log(value: ILogInput[]) -Use this function to log data +# JavaScript / TypeScript SDK for use with the Upgrade A/B Testing platform. +Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/client-libraries/typescript-js for more documentation. + + +## Installation + +`npm i upgrade_client_lib@4.1.7` + +## Usage + +**`Example`** + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/browser'; +``` + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/node'; +``` + +General UpGrade types can also be accessed as named exports: +```typescript +import UpgradeClient, { IExperimentAssignment } from 'upgrade_client_lib/dist/browser'; ``` -interface ILogMetrics { - attributes: any; - groupedMetrics: ILogGroupMetrics[]; + +SDK-Specific types can be accessed also: +```typescript +import { Interfaces } from 'upgrade_client_lib/dist/clientlibs/js/src/identifiers'; + +const initResponse: Interfaces.IUser = await upgradeClient.init(); +``` +# Class: UpgradeClient + +[UpgradeClient](../modules/UpgradeClient.md).UpgradeClient + +## Table of contents + +### Constructors + +- [constructor](UpgradeClient.UpgradeClient.md#constructor) + +### Methods + +- [getAllExperimentConditions](UpgradeClient.UpgradeClient.md#getallexperimentconditions) +- [getDecisionPointAssignment](UpgradeClient.UpgradeClient.md#getdecisionpointassignment) +- [init](UpgradeClient.UpgradeClient.md#init) +- [log](UpgradeClient.UpgradeClient.md#log) +- [logCaliper](UpgradeClient.UpgradeClient.md#logcaliper) +- [markExperimentPoint](UpgradeClient.UpgradeClient.md#markexperimentpoint) +- [setAltUserIds](UpgradeClient.UpgradeClient.md#setaltuserids) +- [setGroupMembership](UpgradeClient.UpgradeClient.md#setgroupmembership) +- [setWorkingGroup](UpgradeClient.UpgradeClient.md#setworkinggroup) + +## Constructors + +### constructor + +• **new UpgradeClient**(`userId`, `hostUrl`, `context`, `options?`) + +When constructing UpgradeClient, the user id, api host url, and "context" identifier are required. +These will be attached to various API calls for this instance of the client. + +**`Example`** + +```typescript +// required +const hostUrl: "htts://my-hosted-upgrade-api.com"; +const userId: "abc123"; +const context: "my-app-context-name"; + +// not required, each is also optional +const options: { + token: "someToken"; + clientSessionId: "someSessionId"; } -interface ILogGroupMetrics { - groupClass: string; - groupKey: string; - groupUniquifier: string; - attributes: any; +const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context); +const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `userId` | `string` | +| `hostUrl` | `string` | +| `context` | `string` | +| `options?` | `Object` | +| `options.clientSessionId?` | `string` | +| `options.token?` | `string` | + +#### Defined in + +[UpgradeClient.ts:99](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L99) + +## Methods + +### getAllExperimentConditions + +▸ **getAllExperimentConditions**(): `Promise`<`IExperimentAssignmentv4`[]\> + +Will return all the experiment conditions for the user. +Internally this uses the `context` and `userId` to query conditions for all eligible decision points at enrolling experiments for this user. + +**`Example`** + +```typescript +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); +``` + +#### Returns + +`Promise`<`IExperimentAssignmentv4`[]\> + +#### Defined in + +[UpgradeClient.ts:237](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L237) + +___ + +### getDecisionPointAssignment + +▸ **getDecisionPointAssignment**(`site`, `target?`): `Promise`<[`Assignment`](functions_getExperimentCondition.Assignment.md)\> + +Given a site and optional target, return the condition assignment at this decision point +NOTE: If getAllExperimentConditions() has not been called, this will call it first. +NOTE ALSO: If getAllExperimentConditions() has been called, this will return the cached result and not make a network call. + +**`Example`** + +```typescript +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `site` | `string` | +| `target?` | `string` | + +#### Returns + +`Promise`<[`Assignment`](functions_getExperimentCondition.Assignment.md)\> + +#### Defined in + +[UpgradeClient.ts:263](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L263) + +___ + +### init + +▸ **init**(`group?`, `workingGroup?`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +This will initialize user and metadata for the user. It will return the user object with id, group, and working group. +NOTE: A user must be initialized at least once before calling any other methods. +Else, you will see "Experiment user not defined" errors when other SDK methods are called. + +**`Example`** + +```typescript +const group: Record> = { + classId: ['class1', 'class2'], + districtId: ['district1', 'district2'], } -interface ILogInput { - timestamp: string; - metrics: ILogMetrics; +const workingGroup: Record = { + classId: 'class1', + districtId: 'district2', } -upClient.log(value) + +const initResponse: Interfaces.IUser[] = await upgradeClient.init(); +const initResponse: Interfaces.IUser[] = await upgradeClient.init(group); +const initResponse: Interfaces.IUser[] = await upgradeClient.init(group, workingGroup); + +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `group?` | `Record`<`string`, `string`[]\> | +| `workingGroup?` | `Record`<`string`, `string`\> | + +#### Returns + +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +#### Defined in + +[UpgradeClient.ts:157](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L157) + +___ + +### log + +▸ **log**(`value`, `sendAsAnalytics?`): `Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +Will report user outcome metrics to Upgrade. +Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/metrics for more information. + +**`Example`** + +```ts +const metrics: IMetricInput[] = [ + { + "metric": "totalTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "completedAll", + "datatype": "categorical", + "allowedValues": [ "COMPLETE", "INCOMPLETE" ] + }, + { + "groupClass": "quizzes", + "allowedKeys": + [ + "quiz1", + "quiz2", + "quiz3" + ], + "attributes": + [ + { + "metric": "quizTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "score", + "datatype": "continuous" + }, + { + "metric": "passStatus", + "datatype": "categorical", + "allowedValues": [ "PASS", "FAIL" ] + } + ] + }, + { + "groupClass": "polls", + "allowedKeys": + [ + "poll1", + "poll2" + ], + "attributes": + [ + { + "metric": "pollTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "rank", + "datatype": "categorical", + "allowedValues": [ "UNHAPPY", "NEUTRAL", "HAPPY" ] + } + ] + } + ]; + +const logResponse: ILog[] = await upgradeClient.metrics(metrics); ``` -## addMetrics(metrics: Array) -Use this function to add metrics in upgrade system +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `value` | `ILogInput`[] | `undefined` | +| `sendAsAnalytics` | `boolean` | `false` | + +#### Returns + +`Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +#### Defined in + +[UpgradeClient.ts:414](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L414) + +___ + +### logCaliper + +▸ **logCaliper**(`value`, `sendAsAnalytics?`): `Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +Will report Caliper user outcome metrics to Upgrade, same as log() but with Caliper envelope. + +**`Example`** + +```ts +const logRequest: CaliperEnvelope = { + sensor: 'test', + sendTime: 'test', + dataVersion: 'test', + data: [], + }; + + const logCaliperResponse: ILog[] = await upgradeClient.logCaliper(logRequest); ``` -interface IGroupMetric { - groupClass: string; - allowedKeys: string[]; - attributes: Array; + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `value` | `CaliperEnvelope` | `undefined` | +| `sendAsAnalytics` | `boolean` | `false` | + +#### Returns + +`Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +#### Defined in + +[UpgradeClient.ts:436](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L436) + +___ + +### markExperimentPoint + +▸ **markExperimentPoint**(`site`, `condition?`, `status`, `target?`, `clientError?`): `Promise`<[`IMarkExperimentPoint`](../interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md)\> + +Will record ("mark") that a user has "seen" a decision point. + +Marking the decision point will record the user's condition assignment and the time of the decision point, regardless of whether the user is enrolled in an experiment. + +`status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. + Status can be one of the following: + +```ts +export enum MARKED_DECISION_POINT_STATUS { + CONDITION_APPLIED = 'condition applied', + CONDITION_FAILED_TO_APPLY = 'condition not applied', + NO_CONDITION_ASSIGNED = 'no condition assigned', } -interface ISingleMetric { - metric: string; - datatype: IMetricMetaData; - allowedValues?: Array; +``` + +The client can also send along an additional `clientError` string to log context as to why a condition was not applied. + +**`Example`** + +```ts +import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; + +const site = 'dashboard'; +const condition = 'variant_x'; // send null if no condition / no experiment is running / error +const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY +const target = 'experimental button'; // optional +const clientError = 'variant not recognized'; //optional + +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.markExperimentPoint(site, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED, target, clientError); +``` + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `site` | `string` | `undefined` | +| `condition` | `string` | `null` | +| `status` | `MARKED_DECISION_POINT_STATUS` | `undefined` | +| `target?` | `string` | `undefined` | +| `clientError?` | `string` | `undefined` | + +#### Returns + +`Promise`<[`IMarkExperimentPoint`](../interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md)\> + +#### Defined in + +[UpgradeClient.ts:303](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L303) + +___ + +### setAltUserIds + +▸ **setAltUserIds**(`altUserIds`): `Promise`<[`IExperimentUserAliases`](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md)[]\> + +Will set an array of alternate user ids for the user. + +**`Example`** + +```ts +const aliases: string[] = ['alias1', 'alias2']; + +const setAltUserIdsResponse: IExperimentUserAliases[] = await upgradeClient.setAltUserIds(aliases); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `altUserIds` | `string`[] | + +#### Returns + +`Promise`<[`IExperimentUserAliases`](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md)[]\> + +#### Defined in + +[UpgradeClient.ts:451](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L451) + +___ + +### setGroupMembership + +▸ **setGroupMembership**(`group`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +Will set the group membership(s) for the user and return the user object with updated working group. + +**`Example`** + +```typescript +const group: Record> = { + classId: ['class1', 'class2'], + districtId: ['district1', 'district2'], } -enum IMetricMetaData { - CONTINUOUS = 'continuous', - CATEGORICAL = 'categorical' + +const groupMembershipResponse: Interfaces.IUser[] = await upgradeClient.setGroupMembership(group); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `group` | `Record`<`string`, `string`[]\> | + +#### Returns + +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +#### Defined in + +[UpgradeClient.ts:175](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L175) + +___ + +### setWorkingGroup + +▸ **setWorkingGroup**(`workingGroup`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +Will set the working group(s) for the user and return the user object with updated working group. + +**`Example`** + +```typescript +const workingGroup: Record = { + classId: 'class1', + districtId: 'district2', } -upClient.addMetrics(metrics) + +const workingGroupResponse: Interfaces.IUser[] = await upgradeClient.setWorkingGroup(workingGroup); ``` -## getAllFeatureFlags() -Use this function to get feature flags list -```upClient.getAllFeatureFlags()``` +#### Parameters + +| Name | Type | +| :------ | :------ | +| `workingGroup` | `Record`<`string`, `string`\> | + +#### Returns -## getFeatureFlag(key: string) -Use this function to get feature flag matched to given key -```upClient.getFeatureFlag(key)``` +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> -# Example -[Sample Code](https://gist.github.com/JD2455/819b178bd43fc3da376eb2d6ddc55c3b "Sample Code") +#### Defined in +[UpgradeClient.ts:208](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L208) diff --git a/clientlibs/js/docs/.nojekyll b/clientlibs/js/docs/.nojekyll new file mode 100644 index 0000000000..e2ac6616ad --- /dev/null +++ b/clientlibs/js/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/clientlibs/js/docs/README.md b/clientlibs/js/docs/README.md new file mode 100644 index 0000000000..1a172e3575 --- /dev/null +++ b/clientlibs/js/docs/README.md @@ -0,0 +1,25 @@ +## JavaScript / TypeScript SDK for use with the Upgrade A/B Testing platform. + +# Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/client-libraries/typescript-js for the technical specs. + +# Installation + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/browser'; +``` + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/node'; +``` + +General UpGrade types can also be accessed as named exports: +```typescript +import UpgradeClient, { IExperimentAssignment } from 'upgrade_client_lib/dist/browser'; +``` + +SDK-Specific types can be accessed also: +```typescript +import { Interfaces } from 'upgrade_client_lib/dist/clientlibs/js/src/identifiers'; + +const initResponse: Interfaces.IUser = await upgradeClient.init(); +``` diff --git a/clientlibs/js/docs/classes/UpgradeClient.UpgradeClient.md b/clientlibs/js/docs/classes/UpgradeClient.UpgradeClient.md new file mode 100644 index 0000000000..86ddab24b2 --- /dev/null +++ b/clientlibs/js/docs/classes/UpgradeClient.UpgradeClient.md @@ -0,0 +1,460 @@ +# Class: UpgradeClient + +[UpgradeClient](../modules/UpgradeClient.md).UpgradeClient + +UpGradeClient is the main class for interacting with the UpGrade API. + +**`Example`** + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/browser'; +``` + +```typescript +import UpgradeClient from 'upgrade_client_lib/dist/node'; +``` + +General UpGrade types can also be accessed as named exports: +```typescript +import UpgradeClient, { IExperimentAssignment } from 'upgrade_client_lib/dist/browser'; +``` + +SDK-Specific types can be accessed also: +```typescript +import { Interfaces } from 'upgrade_client_lib/dist/clientlibs/js/src/identifiers'; + +const initResponse: Interfaces.IUser = await upgradeClient.init(); +``` + +## Table of contents + +### Constructors + +- [constructor](UpgradeClient.UpgradeClient.md#constructor) + +### Methods + +- [getAllExperimentConditions](UpgradeClient.UpgradeClient.md#getallexperimentconditions) +- [getDecisionPointAssignment](UpgradeClient.UpgradeClient.md#getdecisionpointassignment) +- [init](UpgradeClient.UpgradeClient.md#init) +- [log](UpgradeClient.UpgradeClient.md#log) +- [logCaliper](UpgradeClient.UpgradeClient.md#logcaliper) +- [markExperimentPoint](UpgradeClient.UpgradeClient.md#markexperimentpoint) +- [setAltUserIds](UpgradeClient.UpgradeClient.md#setaltuserids) +- [setGroupMembership](UpgradeClient.UpgradeClient.md#setgroupmembership) +- [setWorkingGroup](UpgradeClient.UpgradeClient.md#setworkinggroup) + +## Constructors + +### constructor + +• **new UpgradeClient**(`userId`, `hostUrl`, `context`, `options?`) + +When constructing UpgradeClient, the user id, api host url, and "context" identifier are required. +These will be attached to various API calls for this instance of the client. + +**`Example`** + +```typescript +// required +const hostUrl: "htts://my-hosted-upgrade-api.com"; +const userId: "abc123"; +const context: "my-app-context-name"; + +// not required, each is also optional +const options: { + token: "someToken"; + clientSessionId: "someSessionId"; +} + +const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context); +const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `userId` | `string` | +| `hostUrl` | `string` | +| `context` | `string` | +| `options?` | `Object` | +| `options.clientSessionId?` | `string` | +| `options.token?` | `string` | + +#### Defined in + +[UpgradeClient.ts:99](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L99) + +## Methods + +### getAllExperimentConditions + +▸ **getAllExperimentConditions**(): `Promise`<`IExperimentAssignmentv4`[]\> + +Will return all the experiment conditions for the user. +Internally this uses the `context` and `userId` to query conditions for all eligible decision points at enrolling experiments for this user. + +**`Example`** + +```typescript +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); +``` + +#### Returns + +`Promise`<`IExperimentAssignmentv4`[]\> + +#### Defined in + +[UpgradeClient.ts:237](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L237) + +___ + +### getDecisionPointAssignment + +▸ **getDecisionPointAssignment**(`site`, `target?`): `Promise`<[`Assignment`](functions_getExperimentCondition.Assignment.md)\> + +Given a site and optional target, return the condition assignment at this decision point +NOTE: If getAllExperimentConditions() has not been called, this will call it first. +NOTE ALSO: If getAllExperimentConditions() has been called, this will return the cached result and not make a network call. + +**`Example`** + +```typescript +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `site` | `string` | +| `target?` | `string` | + +#### Returns + +`Promise`<[`Assignment`](functions_getExperimentCondition.Assignment.md)\> + +#### Defined in + +[UpgradeClient.ts:263](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L263) + +___ + +### init + +▸ **init**(`group?`, `workingGroup?`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +This will initialize user and metadata for the user. It will return the user object with id, group, and working group. +NOTE: A user must be initialized at least once before calling any other methods. +Else, you will see "Experiment user not defined" errors when other SDK methods are called. + +**`Example`** + +```typescript +const group: Record> = { + classId: ['class1', 'class2'], + districtId: ['district1', 'district2'], +} + +const workingGroup: Record = { + classId: 'class1', + districtId: 'district2', +} + +const initResponse: Interfaces.IUser[] = await upgradeClient.init(); +const initResponse: Interfaces.IUser[] = await upgradeClient.init(group); +const initResponse: Interfaces.IUser[] = await upgradeClient.init(group, workingGroup); + +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `group?` | `Record`<`string`, `string`[]\> | +| `workingGroup?` | `Record`<`string`, `string`\> | + +#### Returns + +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +#### Defined in + +[UpgradeClient.ts:157](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L157) + +___ + +### log + +▸ **log**(`value`, `sendAsAnalytics?`): `Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +Will report user outcome metrics to Upgrade. +Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/metrics for more information. + +**`Example`** + +```ts +const metrics: IMetricInput[] = [ + { + "metric": "totalTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "completedAll", + "datatype": "categorical", + "allowedValues": [ "COMPLETE", "INCOMPLETE" ] + }, + { + "groupClass": "quizzes", + "allowedKeys": + [ + "quiz1", + "quiz2", + "quiz3" + ], + "attributes": + [ + { + "metric": "quizTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "score", + "datatype": "continuous" + }, + { + "metric": "passStatus", + "datatype": "categorical", + "allowedValues": [ "PASS", "FAIL" ] + } + ] + }, + { + "groupClass": "polls", + "allowedKeys": + [ + "poll1", + "poll2" + ], + "attributes": + [ + { + "metric": "pollTimeSeconds", + "datatype": "continuous" + }, + { + "metric": "rank", + "datatype": "categorical", + "allowedValues": [ "UNHAPPY", "NEUTRAL", "HAPPY" ] + } + ] + } + ]; + +const logResponse: ILog[] = await upgradeClient.metrics(metrics); +``` + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `value` | `ILogInput`[] | `undefined` | +| `sendAsAnalytics` | `boolean` | `false` | + +#### Returns + +`Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +#### Defined in + +[UpgradeClient.ts:414](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L414) + +___ + +### logCaliper + +▸ **logCaliper**(`value`, `sendAsAnalytics?`): `Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +Will report Caliper user outcome metrics to Upgrade, same as log() but with Caliper envelope. + +**`Example`** + +```ts +const logRequest: CaliperEnvelope = { + sensor: 'test', + sendTime: 'test', + dataVersion: 'test', + data: [], + }; + + const logCaliperResponse: ILog[] = await upgradeClient.logCaliper(logRequest); + +``` + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `value` | `CaliperEnvelope` | `undefined` | +| `sendAsAnalytics` | `boolean` | `false` | + +#### Returns + +`Promise`<[`ILog`](../interfaces/identifiers_Interfaces.Interfaces.ILog.md)[]\> + +#### Defined in + +[UpgradeClient.ts:436](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L436) + +___ + +### markExperimentPoint + +▸ **markExperimentPoint**(`site`, `condition?`, `status`, `target?`, `clientError?`): `Promise`<[`IMarkExperimentPoint`](../interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md)\> + +Will record ("mark") that a user has "seen" a decision point. + +Marking the decision point will record the user's condition assignment and the time of the decision point, regardless of whether the user is enrolled in an experiment. + +`status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. + Status can be one of the following: + +```ts +export enum MARKED_DECISION_POINT_STATUS { + CONDITION_APPLIED = 'condition applied', + CONDITION_FAILED_TO_APPLY = 'condition not applied', + NO_CONDITION_ASSIGNED = 'no condition assigned', +} +``` + +The client can also send along an additional `clientError` string to log context as to why a condition was not applied. + +**`Example`** + +```ts +import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; + +const site = 'dashboard'; +const condition = 'variant_x'; // send null if no condition / no experiment is running / error +const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY +const target = 'experimental button'; // optional +const clientError = 'variant not recognized'; //optional + +const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.markExperimentPoint(site, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED, target, clientError); +``` + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `site` | `string` | `undefined` | +| `condition` | `string` | `null` | +| `status` | `MARKED_DECISION_POINT_STATUS` | `undefined` | +| `target?` | `string` | `undefined` | +| `clientError?` | `string` | `undefined` | + +#### Returns + +`Promise`<[`IMarkExperimentPoint`](../interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md)\> + +#### Defined in + +[UpgradeClient.ts:303](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L303) + +___ + +### setAltUserIds + +▸ **setAltUserIds**(`altUserIds`): `Promise`<[`IExperimentUserAliases`](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md)[]\> + +Will set an array of alternate user ids for the user. + +**`Example`** + +```ts +const aliases: string[] = ['alias1', 'alias2']; + +const setAltUserIdsResponse: IExperimentUserAliases[] = await upgradeClient.setAltUserIds(aliases); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `altUserIds` | `string`[] | + +#### Returns + +`Promise`<[`IExperimentUserAliases`](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md)[]\> + +#### Defined in + +[UpgradeClient.ts:451](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L451) + +___ + +### setGroupMembership + +▸ **setGroupMembership**(`group`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +Will set the group membership(s) for the user and return the user object with updated working group. + +**`Example`** + +```typescript +const group: Record> = { + classId: ['class1', 'class2'], + districtId: ['district1', 'district2'], +} + +const groupMembershipResponse: Interfaces.IUser[] = await upgradeClient.setGroupMembership(group); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `group` | `Record`<`string`, `string`[]\> | + +#### Returns + +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +#### Defined in + +[UpgradeClient.ts:175](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L175) + +___ + +### setWorkingGroup + +▸ **setWorkingGroup**(`workingGroup`): `Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +Will set the working group(s) for the user and return the user object with updated working group. + +**`Example`** + +```typescript +const workingGroup: Record = { + classId: 'class1', + districtId: 'district2', +} + +const workingGroupResponse: Interfaces.IUser[] = await upgradeClient.setWorkingGroup(workingGroup); +``` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `workingGroup` | `Record`<`string`, `string`\> | + +#### Returns + +`Promise`<[`IUser`](../interfaces/identifiers_Interfaces.Interfaces.IUser.md)\> + +#### Defined in + +[UpgradeClient.ts:208](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/UpgradeClient.ts#L208) diff --git a/clientlibs/js/docs/classes/functions_getExperimentCondition.Assignment.md b/clientlibs/js/docs/classes/functions_getExperimentCondition.Assignment.md new file mode 100644 index 0000000000..03271b2d30 --- /dev/null +++ b/clientlibs/js/docs/classes/functions_getExperimentCondition.Assignment.md @@ -0,0 +1,137 @@ +# Class: Assignment + +[functions/getExperimentCondition](../modules/functions_getExperimentCondition.md).Assignment + +## Table of contents + +### Constructors + +- [constructor](functions_getExperimentCondition.Assignment.md#constructor) + +### Accessors + +- [factors](functions_getExperimentCondition.Assignment.md#factors) + +### Methods + +- [getCondition](functions_getExperimentCondition.Assignment.md#getcondition) +- [getExperimentType](functions_getExperimentCondition.Assignment.md#getexperimenttype) +- [getFactorLevel](functions_getExperimentCondition.Assignment.md#getfactorlevel) +- [getFactorPayload](functions_getExperimentCondition.Assignment.md#getfactorpayload) +- [getPayload](functions_getExperimentCondition.Assignment.md#getpayload) + +## Constructors + +### constructor + +• **new Assignment**(`conditionCode`, `payload`, `assignedFactor?`) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `conditionCode` | `string` | +| `payload` | `Object` | +| `payload.type` | `PAYLOAD_TYPE` | +| `payload.value` | `string` | +| `assignedFactor?` | `Record`<`string`, { `level`: `string` ; `payload`: { `type`: `PAYLOAD_TYPE` ; `value`: `string` } }\> | + +#### Defined in + +[functions/getExperimentCondition.ts:10](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L10) + +## Accessors + +### factors + +• `get` **factors**(): `string`[] + +#### Returns + +`string`[] + +#### Defined in + +[functions/getExperimentCondition.ts:34](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L34) + +## Methods + +### getCondition + +▸ **getCondition**(): `string` + +#### Returns + +`string` + +#### Defined in + +[functions/getExperimentCondition.ts:22](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L22) + +___ + +### getExperimentType + +▸ **getExperimentType**(): `EXPERIMENT_TYPE` + +#### Returns + +`EXPERIMENT_TYPE` + +#### Defined in + +[functions/getExperimentCondition.ts:30](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L30) + +___ + +### getFactorLevel + +▸ **getFactorLevel**(`factor`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `factor` | `string` | + +#### Returns + +`string` + +#### Defined in + +[functions/getExperimentCondition.ts:38](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L38) + +___ + +### getFactorPayload + +▸ **getFactorPayload**(`factor`): `IPayload` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `factor` | `string` | + +#### Returns + +`IPayload` + +#### Defined in + +[functions/getExperimentCondition.ts:46](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L46) + +___ + +### getPayload + +▸ **getPayload**(): `IPayload` + +#### Returns + +`IPayload` + +#### Defined in + +[functions/getExperimentCondition.ts:26](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/functions/getExperimentCondition.ts#L26) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IConfig.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IConfig.md new file mode 100644 index 0000000000..7d5cec1a66 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IConfig.md @@ -0,0 +1,41 @@ +# Interface: IConfig + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IConfig + +## Table of contents + +### Properties + +- [api](identifiers_Interfaces.Interfaces.IConfig.md#api) +- [hostURL](identifiers_Interfaces.Interfaces.IConfig.md#hosturl) +- [userId](identifiers_Interfaces.Interfaces.IConfig.md#userid) + +## Properties + +### api + +• **api**: `any` + +#### Defined in + +[identifiers/Interfaces.ts:9](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L9) + +___ + +### hostURL + +• **hostURL**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:7](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L7) + +___ + +### userId + +• **userId**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:8](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L8) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUser.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUser.md new file mode 100644 index 0000000000..e88ecac9f8 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUser.md @@ -0,0 +1,41 @@ +# Interface: IExperimentUser + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IExperimentUser + +## Table of contents + +### Properties + +- [group](identifiers_Interfaces.Interfaces.IExperimentUser.md#group) +- [id](identifiers_Interfaces.Interfaces.IExperimentUser.md#id) +- [workingGroup](identifiers_Interfaces.Interfaces.IExperimentUser.md#workinggroup) + +## Properties + +### group + +• **group**: `object` + +#### Defined in + +[identifiers/Interfaces.ts:66](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L66) + +___ + +### id + +• **id**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:65](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L65) + +___ + +### workingGroup + +• **workingGroup**: `object` + +#### Defined in + +[identifiers/Interfaces.ts:67](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L67) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md new file mode 100644 index 0000000000..3fbc35b125 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md @@ -0,0 +1,30 @@ +# Interface: IExperimentUserAliases + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IExperimentUserAliases + +## Table of contents + +### Properties + +- [aliases](identifiers_Interfaces.Interfaces.IExperimentUserAliases.md#aliases) +- [userId](identifiers_Interfaces.Interfaces.IExperimentUserAliases.md#userid) + +## Properties + +### aliases + +• **aliases**: `string`[] + +#### Defined in + +[identifiers/Interfaces.ts:72](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L72) + +___ + +### userId + +• **userId**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:71](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L71) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md new file mode 100644 index 0000000000..a8b77e1122 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md @@ -0,0 +1,30 @@ +# Interface: IFailedExperimentPoint + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IFailedExperimentPoint + +## Table of contents + +### Properties + +- [message](identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md#message) +- [type](identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md#type) + +## Properties + +### message + +• **message**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:46](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L46) + +___ + +### type + +• **type**: `SERVER_ERROR` + +#### Defined in + +[identifiers/Interfaces.ts:45](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L45) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.ILog.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.ILog.md new file mode 100644 index 0000000000..d4708140ec --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.ILog.md @@ -0,0 +1,74 @@ +# Interface: ILog + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).ILog + +## Table of contents + +### Properties + +- [data](identifiers_Interfaces.Interfaces.ILog.md#data) +- [id](identifiers_Interfaces.Interfaces.ILog.md#id) +- [metrics](identifiers_Interfaces.Interfaces.ILog.md#metrics) +- [timeStamp](identifiers_Interfaces.Interfaces.ILog.md#timestamp) +- [uniquifier](identifiers_Interfaces.Interfaces.ILog.md#uniquifier) +- [user](identifiers_Interfaces.Interfaces.ILog.md#user) + +## Properties + +### data + +• **data**: `any` + +#### Defined in + +[identifiers/Interfaces.ts:51](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L51) + +___ + +### id + +• **id**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:50](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L50) + +___ + +### metrics + +• **metrics**: [`IMetric`](identifiers_Interfaces.Interfaces.IMetric.md)[] + +#### Defined in + +[identifiers/Interfaces.ts:52](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L52) + +___ + +### timeStamp + +• **timeStamp**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:54](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L54) + +___ + +### uniquifier + +• **uniquifier**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:55](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L55) + +___ + +### user + +• **user**: [`IExperimentUser`](identifiers_Interfaces.Interfaces.IExperimentUser.md) + +#### Defined in + +[identifiers/Interfaces.ts:53](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L53) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md new file mode 100644 index 0000000000..a4a8025713 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md @@ -0,0 +1,63 @@ +# Interface: IMarkExperimentPoint + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IMarkExperimentPoint + +## Table of contents + +### Properties + +- [experimentId](identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md#experimentid) +- [id](identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md#id) +- [site](identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md#site) +- [target](identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md#target) +- [userId](identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md#userid) + +## Properties + +### experimentId + +• **experimentId**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:41](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L41) + +___ + +### id + +• **id**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:37](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L37) + +___ + +### site + +• **site**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:38](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L38) + +___ + +### target + +• `Optional` **target**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:39](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L39) + +___ + +### userId + +• **userId**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:40](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L40) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMetric.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMetric.md new file mode 100644 index 0000000000..88a6ac3ddf --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IMetric.md @@ -0,0 +1,41 @@ +# Interface: IMetric + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IMetric + +## Table of contents + +### Properties + +- [allowedData](identifiers_Interfaces.Interfaces.IMetric.md#alloweddata) +- [key](identifiers_Interfaces.Interfaces.IMetric.md#key) +- [type](identifiers_Interfaces.Interfaces.IMetric.md#type) + +## Properties + +### allowedData + +• **allowedData**: `string`[] + +#### Defined in + +[identifiers/Interfaces.ts:61](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L61) + +___ + +### key + +• **key**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:59](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L59) + +___ + +### type + +• **type**: `IMetricMetaData` + +#### Defined in + +[identifiers/Interfaces.ts:60](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L60) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IRequestOptions.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IRequestOptions.md new file mode 100644 index 0000000000..9ced8801b1 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IRequestOptions.md @@ -0,0 +1,52 @@ +# Interface: IRequestOptions + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IRequestOptions + +## Table of contents + +### Properties + +- [body](identifiers_Interfaces.Interfaces.IRequestOptions.md#body) +- [headers](identifiers_Interfaces.Interfaces.IRequestOptions.md#headers) +- [keepalive](identifiers_Interfaces.Interfaces.IRequestOptions.md#keepalive) +- [method](identifiers_Interfaces.Interfaces.IRequestOptions.md#method) + +## Properties + +### body + +• `Optional` **body**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:22](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L22) + +___ + +### headers + +• **headers**: `object` + +#### Defined in + +[identifiers/Interfaces.ts:19](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L19) + +___ + +### keepalive + +• **keepalive**: `boolean` + +#### Defined in + +[identifiers/Interfaces.ts:21](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L21) + +___ + +### method + +• **method**: `REQUEST_TYPES` + +#### Defined in + +[identifiers/Interfaces.ts:20](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L20) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IResponse.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IResponse.md new file mode 100644 index 0000000000..f96ae78ea0 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IResponse.md @@ -0,0 +1,41 @@ +# Interface: IResponse + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IResponse + +## Table of contents + +### Properties + +- [data](identifiers_Interfaces.Interfaces.IResponse.md#data) +- [message](identifiers_Interfaces.Interfaces.IResponse.md#message) +- [status](identifiers_Interfaces.Interfaces.IResponse.md#status) + +## Properties + +### data + +• `Optional` **data**: `any` + +#### Defined in + +[identifiers/Interfaces.ts:14](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L14) + +___ + +### message + +• `Optional` **message**: `any` + +#### Defined in + +[identifiers/Interfaces.ts:15](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L15) + +___ + +### status + +• **status**: `boolean` + +#### Defined in + +[identifiers/Interfaces.ts:13](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L13) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUser.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUser.md new file mode 100644 index 0000000000..21a2fee796 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUser.md @@ -0,0 +1,41 @@ +# Interface: IUser + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IUser + +## Table of contents + +### Properties + +- [group](identifiers_Interfaces.Interfaces.IUser.md#group) +- [id](identifiers_Interfaces.Interfaces.IUser.md#id) +- [workingGroup](identifiers_Interfaces.Interfaces.IUser.md#workinggroup) + +## Properties + +### group + +• `Optional` **group**: `Record`<`string`, `string`[]\> + +#### Defined in + +[identifiers/Interfaces.ts:32](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L32) + +___ + +### id + +• **id**: `string` + +#### Defined in + +[identifiers/Interfaces.ts:31](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L31) + +___ + +### workingGroup + +• `Optional` **workingGroup**: `Record`<`string`, `string`\> + +#### Defined in + +[identifiers/Interfaces.ts:33](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L33) diff --git a/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUserGroup.md b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUserGroup.md new file mode 100644 index 0000000000..15b68e5359 --- /dev/null +++ b/clientlibs/js/docs/interfaces/identifiers_Interfaces.Interfaces.IUserGroup.md @@ -0,0 +1,30 @@ +# Interface: IUserGroup + +[identifiers/Interfaces](../modules/identifiers_Interfaces.md).[Interfaces](../modules/identifiers_Interfaces.Interfaces.md).IUserGroup + +## Table of contents + +### Properties + +- [group](identifiers_Interfaces.Interfaces.IUserGroup.md#group) +- [workingGroup](identifiers_Interfaces.Interfaces.IUserGroup.md#workinggroup) + +## Properties + +### group + +• `Optional` **group**: `Map`<`string`, `string`[]\> + +#### Defined in + +[identifiers/Interfaces.ts:26](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L26) + +___ + +### workingGroup + +• `Optional` **workingGroup**: `Map`<`string`, `string`\> + +#### Defined in + +[identifiers/Interfaces.ts:27](https://github.com/CarnegieLearningWeb/UpGrade/blob/01c083e7/clientlibs/js/src/identifiers/Interfaces.ts#L27) diff --git a/clientlibs/js/docs/modules.md b/clientlibs/js/docs/modules.md new file mode 100644 index 0000000000..8fd187da70 --- /dev/null +++ b/clientlibs/js/docs/modules.md @@ -0,0 +1,10 @@ +# upgrade_client_lib + +## Table of contents + +### Modules + +- [UpgradeClient](modules/UpgradeClient.md) +- [functions/getExperimentCondition](modules/functions_getExperimentCondition.md) +- [identifiers](modules/identifiers.md) +- [identifiers/Interfaces](modules/identifiers_Interfaces.md) diff --git a/clientlibs/js/docs/modules/UpgradeClient.md b/clientlibs/js/docs/modules/UpgradeClient.md new file mode 100644 index 0000000000..330ddaf75a --- /dev/null +++ b/clientlibs/js/docs/modules/UpgradeClient.md @@ -0,0 +1,7 @@ +# Module: UpgradeClient + +## Table of contents + +### Classes + +- [UpgradeClient](../classes/UpgradeClient.UpgradeClient.md) diff --git a/clientlibs/js/docs/modules/functions_getExperimentCondition.md b/clientlibs/js/docs/modules/functions_getExperimentCondition.md new file mode 100644 index 0000000000..5039686336 --- /dev/null +++ b/clientlibs/js/docs/modules/functions_getExperimentCondition.md @@ -0,0 +1,7 @@ +# Module: functions/getExperimentCondition + +## Table of contents + +### Classes + +- [Assignment](../classes/functions_getExperimentCondition.Assignment.md) diff --git a/clientlibs/js/docs/modules/identifiers.md b/clientlibs/js/docs/modules/identifiers.md new file mode 100644 index 0000000000..88f67828b6 --- /dev/null +++ b/clientlibs/js/docs/modules/identifiers.md @@ -0,0 +1,13 @@ +# Module: identifiers + +## Table of contents + +### References + +- [Interfaces](identifiers.md#interfaces) + +## References + +### Interfaces + +Re-exports [Interfaces](identifiers_Interfaces.Interfaces.md) diff --git a/clientlibs/js/docs/modules/identifiers_Interfaces.Interfaces.md b/clientlibs/js/docs/modules/identifiers_Interfaces.Interfaces.md new file mode 100644 index 0000000000..ef33af855b --- /dev/null +++ b/clientlibs/js/docs/modules/identifiers_Interfaces.Interfaces.md @@ -0,0 +1,19 @@ +# Namespace: Interfaces + +[identifiers/Interfaces](identifiers_Interfaces.md).Interfaces + +## Table of contents + +### Interfaces + +- [IConfig](../interfaces/identifiers_Interfaces.Interfaces.IConfig.md) +- [IExperimentUser](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUser.md) +- [IExperimentUserAliases](../interfaces/identifiers_Interfaces.Interfaces.IExperimentUserAliases.md) +- [IFailedExperimentPoint](../interfaces/identifiers_Interfaces.Interfaces.IFailedExperimentPoint.md) +- [ILog](../interfaces/identifiers_Interfaces.Interfaces.ILog.md) +- [IMarkExperimentPoint](../interfaces/identifiers_Interfaces.Interfaces.IMarkExperimentPoint.md) +- [IMetric](../interfaces/identifiers_Interfaces.Interfaces.IMetric.md) +- [IRequestOptions](../interfaces/identifiers_Interfaces.Interfaces.IRequestOptions.md) +- [IResponse](../interfaces/identifiers_Interfaces.Interfaces.IResponse.md) +- [IUser](../interfaces/identifiers_Interfaces.Interfaces.IUser.md) +- [IUserGroup](../interfaces/identifiers_Interfaces.Interfaces.IUserGroup.md) diff --git a/clientlibs/js/docs/modules/identifiers_Interfaces.md b/clientlibs/js/docs/modules/identifiers_Interfaces.md new file mode 100644 index 0000000000..ddf9a8b09a --- /dev/null +++ b/clientlibs/js/docs/modules/identifiers_Interfaces.md @@ -0,0 +1,7 @@ +# Module: identifiers/Interfaces + +## Table of contents + +### Namespaces + +- [Interfaces](identifiers_Interfaces.Interfaces.md) diff --git a/clientlibs/js/package-lock.json b/clientlibs/js/package-lock.json index 3e3aa776c5..c9ae8d389f 100644 --- a/clientlibs/js/package-lock.json +++ b/clientlibs/js/package-lock.json @@ -1,16 +1,19 @@ { "name": "upgrade_client_lib", - "version": "4.3.0", + "version": "4.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "upgrade_client_lib", - "version": "4.3.0", + "version": "4.1.7", "license": "ISC", "dependencies": { "axios": "^1.4.0", "es6-promise": "^4.2.8", + "eslint-plugin-tsdoc": "^0.2.17", + "typedoc": "^0.24.8", + "typedoc-plugin-markdown": "^3.15.3", "uuid": "^8.3.2" }, "devDependencies": { @@ -24,6 +27,7 @@ "ts-loader": "^9.4.1", "ts-node": "^10.9.1", "tslib": "^2.4.1", + "typedoc-plugin-rename-defaults": "^0.6.5", "typescript": "^4.8.4", "webpack": "^5.74.0", "webpack-cli": "^4.10.0" @@ -999,6 +1003,22 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, + "node_modules/@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==" + }, + "node_modules/@microsoft/tsdoc-config": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", + "dependencies": { + "@microsoft/tsdoc": "0.14.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, "node_modules/@sinclair/typebox": { "version": "0.25.24", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", @@ -1436,7 +1456,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", @@ -1481,6 +1500,11 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", + "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==" + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -1633,8 +1657,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/brace-expansion": { "version": "1.1.11", @@ -1736,9 +1759,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001506", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001506.tgz", - "integrity": "sha512-6XNEcpygZMCKaufIcgpQNZNf00GEqc7VQON+9Rd0K1bMYo8xhMZRAo5zpbnbMNizi4YNgIDAFrdykWsvY3H4Hw==", + "version": "1.0.30001507", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001507.tgz", + "integrity": "sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A==", "dev": true, "funding": [ { @@ -2024,9 +2047,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.438", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.438.tgz", - "integrity": "sha512-x94U0FhphEsHsOloCvlsujHCvoir0ZQ73ZAs/QN4PLx98uNvyEU79F75rq1db75Bx/atvuh7KPeuxelh+xfYJw==", + "version": "1.4.439", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.439.tgz", + "integrity": "sha512-BHpErPSNhb9FB25+OwQP6mCAf3ZXfGbmuvc4LzBNVJwpCcXQJm++LerimocYRG9FRxUVRKZqaB7d0+pImSTPSg==", "dev": true }, "node_modules/emittery": { @@ -2110,6 +2133,15 @@ "node": ">=8" } }, + "node_modules/eslint-plugin-tsdoc": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.17.tgz", + "integrity": "sha512-xRmVi7Zx44lOBuYqG8vzTXuL6IdGOeF9nHX17bjJ8+VE6fsxpdGem0/SBTmAwgYMKYB1WBkqRJVQ+n8GK041pA==", + "dependencies": { + "@microsoft/tsdoc": "0.14.2", + "@microsoft/tsdoc-config": "0.16.2" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -2226,14 +2258,12 @@ "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-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/fastest-levenshtein": { "version": "1.0.16", @@ -2333,8 +2363,7 @@ "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "node_modules/gensync": { "version": "1.0.0-beta.2", @@ -2416,11 +2445,30 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -2515,7 +2563,6 @@ "version": "2.12.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", - "dev": true, "dependencies": { "has": "^1.0.3" }, @@ -3019,6 +3066,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-resolve/node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jest-runner": { "version": "29.5.0", "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", @@ -3131,9 +3195,9 @@ } }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -3246,6 +3310,11 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3286,8 +3355,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/json5": { "version": "2.2.3", @@ -3301,6 +3369,11 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -3370,6 +3443,11 @@ "yallist": "^3.0.2" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -3400,6 +3478,17 @@ "tmpl": "1.0.5" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -3459,6 +3548,14 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3474,8 +3571,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/node-int64": { "version": "0.4.0", @@ -3633,8 +3729,7 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/picocolors": { "version": "1.0.0", @@ -3723,7 +3818,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, "engines": { "node": ">=6" } @@ -3781,17 +3875,12 @@ } }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", - "dev": true, + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "dependencies": { - "is-core-module": "^2.11.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3916,6 +4005,17 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.2.tgz", + "integrity": "sha512-ltSZlSLOuSY0M0Y75KA+ieRaZ0Trf5Wl3gutE7jzLuIcWxLp5i/uEnLoQWNvgKXQ5OMpGkJnVMRLAuzjc0LJ2A==", + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -3941,7 +4041,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" } @@ -4264,9 +4363,9 @@ } }, "node_modules/ts-jest/node_modules/semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -4316,9 +4415,9 @@ } }, "node_modules/ts-loader/node_modules/semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -4406,11 +4505,72 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typedoc": { + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", + "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.0", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 14.14" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x" + } + }, + "node_modules/typedoc-plugin-markdown": { + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.15.3.tgz", + "integrity": "sha512-idntFYu3vfaY3eaD+w9DeRd0PmNGqGuNLKihPU9poxFGnATJYGn9dPtEhn2QrTdishFMg7jPXAhos+2T6YCWRQ==", + "dependencies": { + "handlebars": "^4.7.7" + }, + "peerDependencies": { + "typedoc": ">=0.24.0" + } + }, + "node_modules/typedoc-plugin-rename-defaults": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/typedoc-plugin-rename-defaults/-/typedoc-plugin-rename-defaults-0.6.5.tgz", + "integrity": "sha512-DwkgwRMxgu3UrDR3VUAdnF9jYzM6p7rw6UcVIh4MD7yjEmFDR8WWyOlk6oYgELmRYHxTDx0f0GK6iSgoxSh/Qw==", + "dev": true, + "peerDependencies": { + "typedoc": "0.22.x || 0.23.x || 0.24.x" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", + "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4419,6 +4579,18 @@ "node": ">=4.2.0" } }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", @@ -4453,7 +4625,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" } @@ -4492,6 +4663,16 @@ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==" + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==" + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -4660,6 +4841,11 @@ "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -5515,6 +5701,22 @@ } } }, + "@microsoft/tsdoc": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", + "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==" + }, + "@microsoft/tsdoc-config": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", + "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", + "requires": { + "@microsoft/tsdoc": "0.14.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, "@sinclair/typebox": { "version": "0.25.24", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", @@ -5928,7 +6130,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -5958,6 +6159,11 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, + "ansi-sequence-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", + "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==" + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -6080,8 +6286,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "brace-expansion": { "version": "1.1.11", @@ -6151,9 +6356,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001506", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001506.tgz", - "integrity": "sha512-6XNEcpygZMCKaufIcgpQNZNf00GEqc7VQON+9Rd0K1bMYo8xhMZRAo5zpbnbMNizi4YNgIDAFrdykWsvY3H4Hw==", + "version": "1.0.30001507", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001507.tgz", + "integrity": "sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A==", "dev": true }, "chalk": { @@ -6351,9 +6556,9 @@ } }, "electron-to-chromium": { - "version": "1.4.438", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.438.tgz", - "integrity": "sha512-x94U0FhphEsHsOloCvlsujHCvoir0ZQ73ZAs/QN4PLx98uNvyEU79F75rq1db75Bx/atvuh7KPeuxelh+xfYJw==", + "version": "1.4.439", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.439.tgz", + "integrity": "sha512-BHpErPSNhb9FB25+OwQP6mCAf3ZXfGbmuvc4LzBNVJwpCcXQJm++LerimocYRG9FRxUVRKZqaB7d0+pImSTPSg==", "dev": true }, "emittery": { @@ -6416,6 +6621,15 @@ "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true }, + "eslint-plugin-tsdoc": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.17.tgz", + "integrity": "sha512-xRmVi7Zx44lOBuYqG8vzTXuL6IdGOeF9nHX17bjJ8+VE6fsxpdGem0/SBTmAwgYMKYB1WBkqRJVQ+n8GK041pA==", + "requires": { + "@microsoft/tsdoc": "0.14.2", + "@microsoft/tsdoc-config": "0.16.2" + } + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -6500,14 +6714,12 @@ "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==" }, "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==" }, "fastest-levenshtein": { "version": "1.0.16", @@ -6574,8 +6786,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "gensync": { "version": "1.0.0-beta.2", @@ -6633,11 +6844,22 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -6708,7 +6930,6 @@ "version": "2.12.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", - "dev": true, "requires": { "has": "^1.0.3" } @@ -7061,6 +7282,19 @@ "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" + }, + "dependencies": { + "resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "requires": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + } } }, "jest-resolve-dependencies": { @@ -7173,9 +7407,9 @@ } }, "semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -7264,6 +7498,11 @@ } } }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7295,8 +7534,7 @@ "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==" }, "json5": { "version": "2.2.3", @@ -7304,6 +7542,11 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -7358,6 +7601,11 @@ "yallist": "^3.0.2" } }, + "lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -7382,6 +7630,11 @@ "tmpl": "1.0.5" } }, + "marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==" + }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -7426,6 +7679,11 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7441,8 +7699,7 @@ "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-int64": { "version": "0.4.0", @@ -7557,8 +7814,7 @@ "path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "picocolors": { "version": "1.0.0", @@ -7624,8 +7880,7 @@ "punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" }, "pure-rand": { "version": "6.0.2", @@ -7664,14 +7919,12 @@ "dev": true }, "resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", - "dev": true, + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", "requires": { - "is-core-module": "^2.11.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" } }, "resolve-cwd": { @@ -7751,6 +8004,17 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "shiki": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.2.tgz", + "integrity": "sha512-ltSZlSLOuSY0M0Y75KA+ieRaZ0Trf5Wl3gutE7jzLuIcWxLp5i/uEnLoQWNvgKXQ5OMpGkJnVMRLAuzjc0LJ2A==", + "requires": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -7772,8 +8036,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { "version": "0.5.13", @@ -7986,9 +8249,9 @@ } }, "semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -8024,9 +8287,9 @@ } }, "semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -8079,11 +8342,60 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, + "typedoc": { + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", + "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", + "requires": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.0", + "shiki": "^0.14.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", + "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "typedoc-plugin-markdown": { + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.15.3.tgz", + "integrity": "sha512-idntFYu3vfaY3eaD+w9DeRd0PmNGqGuNLKihPU9poxFGnATJYGn9dPtEhn2QrTdishFMg7jPXAhos+2T6YCWRQ==", + "requires": { + "handlebars": "^4.7.7" + } + }, + "typedoc-plugin-rename-defaults": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/typedoc-plugin-rename-defaults/-/typedoc-plugin-rename-defaults-0.6.5.tgz", + "integrity": "sha512-DwkgwRMxgu3UrDR3VUAdnF9jYzM6p7rw6UcVIh4MD7yjEmFDR8WWyOlk6oYgELmRYHxTDx0f0GK6iSgoxSh/Qw==", + "dev": true, + "requires": {} + }, "typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + }, + "uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true }, "update-browserslist-db": { "version": "1.0.11", @@ -8099,7 +8411,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "requires": { "punycode": "^2.1.0" } @@ -8134,6 +8445,16 @@ } } }, + "vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==" + }, + "vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==" + }, "walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -8244,6 +8565,11 @@ "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/clientlibs/js/package.json b/clientlibs/js/package.json index 1a4d021784..66ce64cb62 100644 --- a/clientlibs/js/package.json +++ b/clientlibs/js/package.json @@ -1,6 +1,6 @@ { "name": "upgrade_client_lib", - "version": "4.3.0", + "version": "4.1.7", "description": "Client library to communicate with the Upgrade server", "files": [ "dist/*" @@ -15,6 +15,7 @@ "lint:fix": "eslint -c ../../.eslintrc.js --ext .ts './{src, test}/**/*.ts' --fix && npm run prettier:write", "prettier:write": "prettier --config ../../.prettierrc './{src, test}/**/*.ts' --write", "prettier:check": "prettier --config ../../.prettierrc './{src, test}/**/*.ts' --check", + "docs:markdown": "typedoc --options typedoc.json", "test": "jest" }, "keywords": [], @@ -31,6 +32,7 @@ "ts-loader": "^9.4.1", "ts-node": "^10.9.1", "tslib": "^2.4.1", + "typedoc-plugin-rename-defaults": "^0.6.5", "typescript": "^4.8.4", "webpack": "^5.74.0", "webpack-cli": "^4.10.0" @@ -38,6 +40,9 @@ "dependencies": { "axios": "^1.4.0", "es6-promise": "^4.2.8", + "eslint-plugin-tsdoc": "^0.2.17", + "typedoc": "^0.24.8", + "typedoc-plugin-markdown": "^3.15.3", "uuid": "^8.3.2" } } diff --git a/clientlibs/js/src/UpgradeClient.ts b/clientlibs/js/src/UpgradeClient.ts index d908102ca6..2bcd358ac8 100644 --- a/clientlibs/js/src/UpgradeClient.ts +++ b/clientlibs/js/src/UpgradeClient.ts @@ -22,6 +22,31 @@ import getFeatureFlag from './functions/getFeatureFlag'; import init from './functions/init'; import * as uuid from 'uuid'; +/** + * UpGradeClient is the main class for interacting with the UpGrade API. + * + * @example +* ```typescript +* import UpgradeClient from 'upgrade_client_lib/dist/browser'; +* ``` +* +* ```typescript +* import UpgradeClient from 'upgrade_client_lib/dist/node'; +* ``` +* +* General UpGrade types can also be accessed as named exports: +* ```typescript +* import UpgradeClient, { IExperimentAssignment } from 'upgrade_client_lib/dist/browser'; +* ``` +* +* SDK-Specific types can be accessed also: +* ```typescript +* import { Interfaces } from 'upgrade_client_lib/dist/clientlibs/js/src/identifiers'; +* +* const initResponse: Interfaces.IUser = await upgradeClient.init(); +* ``` +*/ + export default class UpgradeClient { // Endpoints URLs private api = { @@ -53,6 +78,29 @@ export default class UpgradeClient { // this will allow users who are not using the upgrade types package to use this enum for markExperimentPoint() public static MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS; +/** + * When constructing UpgradeClient, the user id, api host url, and "context" identifier are required. + * These will be attached to various API calls for this instance of the client. + * + * @example + * + * ```typescript + * // required + * const hostUrl: "htts://my-hosted-upgrade-api.com"; + * const userId: "abc123"; + * const context: "my-app-context-name"; + * + * // not required, each is also optional + * const options: { + * token: "someToken"; + * clientSessionId: "someSessionId"; + * } + * + * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context); + * const upgradeClient: UpgradeClient[] = new UpgradeClient(hostURL, userId, context, options); + * ``` + */ + constructor( userId: string, hostUrl: string, @@ -73,7 +121,7 @@ export default class UpgradeClient { failedExperimentPoint: `${hostUrl}/api/v4/failed`, getAllFeatureFlag: `${hostUrl}/api/v4/featureflag`, log: `${hostUrl}/api/v4/log`, - logCaliper: `${hostUrl}/api/v4/logCaliper`, + logCaliper: `${hostUrl}/api/v4/log/caliper`, altUserIds: `${hostUrl}/api/v4/useraliases`, addMetrics: `${hostUrl}/api/v4/metric`, }; @@ -88,11 +136,47 @@ export default class UpgradeClient { } } +/** + * This will initialize user and metadata for the user. It will return the user object with id, group, and working group. + * NOTE: A user must be initialized at least once before calling any other methods. + * Else, you will see "Experiment user not defined" errors when other SDK methods are called. + * + * @example + * ```typescript + * const group: Record> = { + * classId: ['class1', 'class2'], + * districtId: ['district1', 'district2'], + * } + * + * const workingGroup: Record = { + * classId: 'class1', + * districtId: 'district2', + * } + * + * const initResponse: Interfaces.IUser[] = await upgradeClient.init(); + * const initResponse: Interfaces.IUser[] = await upgradeClient.init(group); + * const initResponse: Interfaces.IUser[] = await upgradeClient.init(group, workingGroup); + * + * ``` + */ async init(group?: Record>, workingGroup?: Record): Promise { this.validateClient(); return await init(this.api.init, this.userId, this.token, this.clientSessionId, group, workingGroup); } +/** + * Will set the group membership(s) for the user and return the user object with updated working group. + * + * @example + * ```typescript + * const group: Record> = { + * classId: ['class1', 'class2'], + * districtId: ['district1', 'district2'], + * } + * + * const groupMembershipResponse: Interfaces.IUser[] = await upgradeClient.setGroupMembership(group); + * ``` + */ async setGroupMembership(group: Record>): Promise { this.validateClient(); let response: Interfaces.IUser = await setGroupMembership( @@ -113,6 +197,19 @@ export default class UpgradeClient { return response; } +/** + * Will set the working group(s) for the user and return the user object with updated working group. + * + * @example + * ```typescript + * const workingGroup: Record = { + * classId: 'class1', + * districtId: 'district2', + * } + * + * const workingGroupResponse: Interfaces.IUser[] = await upgradeClient.setWorkingGroup(workingGroup); + * ``` + */ async setWorkingGroup(workingGroup: Record): Promise { this.validateClient(); let response: Interfaces.IUser = await setWorkingGroup( @@ -133,6 +230,15 @@ export default class UpgradeClient { return response; } +/** + * Will return all the experiment conditions for the user. + * Internally this uses the `context` and `userId` to query conditions for all eligible decision points at enrolling experiments for this user. + * + * @example + * ```typescript + * const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); + * ``` + */ async getAllExperimentConditions(): Promise { this.validateClient(); const response = await getAllExperimentConditions( @@ -148,7 +254,18 @@ export default class UpgradeClient { return response; } - async getDecisionPointAssignment(site: string, target: string): Promise { +/** + * Given a site and optional target, return the condition assignment at this decision point + * NOTE: If getAllExperimentConditions() has not been called, this will call it first. + * NOTE ALSO: If getAllExperimentConditions() has been called, this will return the cached result and not make a network call. + * + * @example + * ```typescript + * const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.getAllExperimentConditions(workingGroup); + * ``` + */ + + async getDecisionPointAssignment(site: string, target?: string): Promise { this.validateClient(); if (this.experimentConditionData == null) { await this.getAllExperimentConditions(); @@ -156,6 +273,38 @@ export default class UpgradeClient { return getExperimentCondition(this.experimentConditionData, site, target); } + /** + * Will record ("mark") that a user has "seen" a decision point. + * + * Marking the decision point will record the user's condition assignment and the time of the decision point, regardless of whether the user is enrolled in an experiment. + * + * `status` signifies a client application's note on what it did in the code with condition assignment that Upgrade provided. + * Status can be one of the following: + * + * ```ts + * export enum MARKED_DECISION_POINT_STATUS { + * CONDITION_APPLIED = 'condition applied', + * CONDITION_FAILED_TO_APPLY = 'condition not applied', + * NO_CONDITION_ASSIGNED = 'no condition assigned', + * } + * ``` + * + * The client can also send along an additional `clientError` string to log context as to why a condition was not applied. + * + * @example + * ```ts + * import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; + * + * const site = 'dashboard'; + * const condition = 'variant_x'; // send null if no condition / no experiment is running / error + * const status: MARKED_DECISION_POINT_STATUS = MARKED_DECISION_POINT_STATUS.CONDITION_FAILED_TO_APPLY + * const target = 'experimental button'; // optional + * const clientError = 'variant not recognized'; //optional + * + * const allExperimentConditionsResponse: IExperimentAssignmentv4[] = await upgradeClient.markExperimentPoint(site, condition, MARKED_DECISION_POINT_STATUS.CONDITION_APPLIED, target, clientError); + * ``` + */ + async markExperimentPoint( site: string, target: string, @@ -181,6 +330,11 @@ export default class UpgradeClient { ); } + /** + * This feature is available but not recommended for use as it is not fully regression tested in recent releases. + * @ignore + */ + async getAllFeatureFlags(): Promise { this.validateClient(); const response = await getAllFeatureFlags(this.api.getAllFeatureFlag, this.token, this.clientSessionId); @@ -190,26 +344,128 @@ export default class UpgradeClient { return response; } + /** + * This feature is available but not recommended for use as it is not fully regression tested in recent releases. + * @ignore + */ + getFeatureFlag(key: string): IFeatureFlag { this.validateClient(); return getFeatureFlag(this.featureFlags, key); } + /** + * Will report user outcome metrics to Upgrade. + * Please see https://upgrade-platform.gitbook.io/docs/developer-guide/reference/metrics for more information. + * + * @example + * ```ts + * const metrics: IMetricInput[] = [ + * { + * "metric": "totalTimeSeconds", + * "datatype": "continuous" + * }, + * { + * "metric": "completedAll", + * "datatype": "categorical", + * "allowedValues": [ "COMPLETE", "INCOMPLETE" ] + * }, + * { + * "groupClass": "quizzes", + * "allowedKeys": + * [ + * "quiz1", + * "quiz2", + * "quiz3" + * ], + * "attributes": + * [ + * { + * "metric": "quizTimeSeconds", + * "datatype": "continuous" + * }, + * { + * "metric": "score", + * "datatype": "continuous" + * }, + * { + * "metric": "passStatus", + * "datatype": "categorical", + * "allowedValues": [ "PASS", "FAIL" ] + * } + * ] + * }, + * { + * "groupClass": "polls", + * "allowedKeys": + * [ + * "poll1", + * "poll2" + * ], + * "attributes": + * [ + * { + * "metric": "pollTimeSeconds", + * "datatype": "continuous" + * }, + * { + * "metric": "rank", + * "datatype": "categorical", + * "allowedValues": [ "UNHAPPY", "NEUTRAL", "HAPPY" ] + * } + * ] + * } + * ]; + * + * const logResponse: ILog[] = await upgradeClient.metrics(metrics); + * ``` + */ async log(value: ILogInput[], sendAsAnalytics = false): Promise { this.validateClient(); return await log(this.api.log, this.userId, this.token, this.clientSessionId, value, sendAsAnalytics); } +/** + * Will report Caliper user outcome metrics to Upgrade, same as log() but with Caliper envelope. + * + * @example + * ```ts + * const logRequest: CaliperEnvelope = { + sensor: 'test', + sendTime: 'test', + dataVersion: 'test', + data: [], + }; + * + * + * const logCaliperResponse: ILog[] = await upgradeClient.logCaliper(logRequest); + * + * ``` + */ async logCaliper(value: CaliperEnvelope, sendAsAnalytics = false): Promise { this.validateClient(); return await logCaliper(this.api.logCaliper, this.userId, this.token, this.clientSessionId, value, sendAsAnalytics); } + /** + * Will set an array of alternate user ids for the user. + * + * @example + * ```ts + * const aliases: string[] = ['alias1', 'alias2']; + * + * const setAltUserIdsResponse: IExperimentUserAliases[] = await upgradeClient.setAltUserIds(aliases); + * ``` + */ async setAltUserIds(altUserIds: string[]): Promise { this.validateClient(); return await setAltUserIds(this.api.altUserIds, this.userId, this.token, this.clientSessionId, altUserIds); } + /** + * This feature is available but not recommended for use as it is not fully regression tested in recent releases. + * @ignore + */ async addMetrics(metrics: (ISingleMetric | IGroupMetric)[]): Promise { this.validateClient(); return await addMetrics(this.api.addMetrics, this.token, this.clientSessionId, metrics); diff --git a/clientlibs/js/src/functions/getExperimentCondition.ts b/clientlibs/js/src/functions/getExperimentCondition.ts index ff2160db28..8b10a48023 100644 --- a/clientlibs/js/src/functions/getExperimentCondition.ts +++ b/clientlibs/js/src/functions/getExperimentCondition.ts @@ -54,6 +54,9 @@ export class Assignment { } } +/** + * @hidden + */ export default function getExperimentCondition( experimentConditionData: IExperimentAssignmentv4[], site: string, diff --git a/clientlibs/js/src/functions/markExperimentPoint.ts b/clientlibs/js/src/functions/markExperimentPoint.ts index b8741d6637..aafdb6a7da 100644 --- a/clientlibs/js/src/functions/markExperimentPoint.ts +++ b/clientlibs/js/src/functions/markExperimentPoint.ts @@ -5,7 +5,11 @@ import { IExperimentAssignmentv4, MARKED_DECISION_POINT_STATUS } from 'upgrade_t interface markData { userId: string; status: MARKED_DECISION_POINT_STATUS; - data: IExperimentAssignmentv4; + data: { + site: string; + assignedCondition: { conditionCode: string; experimentId?: string }; + target?: string; + }; clientError?: string; } @@ -21,13 +25,22 @@ export default async function markExperimentPoint( getAllData: IExperimentAssignmentv4[], clientError?: string ): Promise { - const data = getAllData.find((data) => data.site === site && data.target === target); - data.assignedCondition.conditionCode = condition; let requestBody: markData = { userId, status, - data, + data: { + site: site, + assignedCondition: { + conditionCode: condition, + }, + }, }; + if (target) { + requestBody.data = { + ...requestBody.data, + target, + }; + } if (clientError) { requestBody = { ...requestBody, diff --git a/clientlibs/js/typedoc.json b/clientlibs/js/typedoc.json new file mode 100644 index 0000000000..6418465db4 --- /dev/null +++ b/clientlibs/js/typedoc.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/UpgradeClient.ts", "./src/identifiers", "./src/functions/getExperimentCondition.ts"], + "out": "docs", + "exclude": ["**/*+(index|.spec).ts", "**/fetchDataService.ts", "**/enums.ts"], + "excludePrivate": true, + "entryPointStrategy": "expand", + "plugin": [ + "typedoc-plugin-rename-defaults", + "typedoc-plugin-markdown" + ], + "hideBreadcrumbs": true +} \ No newline at end of file diff --git a/clientlibs/libTesters/ts-lib-tester-backend-server/package.json b/clientlibs/libTesters/ts-lib-tester-backend-server/package.json index e77affd2c3..b139fdf585 100644 --- a/clientlibs/libTesters/ts-lib-tester-backend-server/package.json +++ b/clientlibs/libTesters/ts-lib-tester-backend-server/package.json @@ -11,7 +11,7 @@ "dev": "concurrently \"npx tsc --watch\" \"nodemon -q dist/ts-lib-tester-backend-server/src/app.js\"", "preinstall": "npm run copy-local-js-build", "start:install": "npm install && npm run start", - "copy-local-js-build": "mkdir -p node_modules/upgrade_client_local && cd ../../js/ && npm run build && cp -r ./{dist,package.json,README.md} ../libTesters/ts-lib-tester-backend-server/node_modules/upgrade_client_local", + "copy-local-js-build": "mkdir -p node_modules/upgrade_client_local && cd ../../js/ && npm install && npm run build && cp -r ./{dist,package.json,README.md} ../libTesters/ts-lib-tester-backend-server/node_modules/upgrade_client_local", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", diff --git a/frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-participants/experiment-participants.component.ts b/frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-participants/experiment-participants.component.ts index ecb5fb770c..dab45ab97a 100644 --- a/frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-participants/experiment-participants.component.ts +++ b/frontend/projects/upgrade/src/app/features/dashboard/home/components/experiment-participants/experiment-participants.component.ts @@ -170,10 +170,10 @@ export class ExperimentParticipantsComponent implements OnInit { this.members2.push(this.addMembers2(MemberTypes.SEGMENT, id.name)); }); } - } - - this.members1.removeAt(0); - this.members2.removeAt(0); + } else { + this.members1.removeAt(0); + this.members2.removeAt(0); + } this.updateView1(); this.updateView2();