@playcademy/better-auth 0.0.20 → 0.0.21-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.js +45 -3
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -16087,8 +16087,8 @@ function validateConfig(config2) {
16087
16087
  var init_config_loader = __esm(() => {
16088
16088
  init_file_loader();
16089
16089
  });
16090
- var VALID_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
16091
- var VALID_SUBJECTS = [
16090
+ var TIMEBACK_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
16091
+ var TIMEBACK_SUBJECTS = [
16092
16092
  "Reading",
16093
16093
  "Language",
16094
16094
  "Vocabulary",
@@ -16099,6 +16099,19 @@ var VALID_SUBJECTS = [
16099
16099
  "Math",
16100
16100
  "None"
16101
16101
  ];
16102
+ var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
16103
+ xp: 1,
16104
+ mastery: 0,
16105
+ score: 2
16106
+ };
16107
+ var TIMEBACK_GAME_METRIC_COMPARISON_TOLERANCE = {
16108
+ xp: 0.5 / 10 ** TIMEBACK_GAME_METRIC_DECIMAL_PLACES.xp,
16109
+ mastery: 0,
16110
+ time: 60,
16111
+ score: 0.5 / 10 ** TIMEBACK_GAME_METRIC_DECIMAL_PLACES.score
16112
+ };
16113
+ var VALID_GRADES = TIMEBACK_GRADES;
16114
+ var VALID_SUBJECTS = TIMEBACK_SUBJECTS;
16102
16115
  function isValidGrade(value) {
16103
16116
  return typeof value === "number" && Number.isInteger(value) && VALID_GRADES.includes(value);
16104
16117
  }
@@ -16113,6 +16126,35 @@ function createTimebackNamespace(client) {
16113
16126
  };
16114
16127
  }
16115
16128
  return {
16129
+ assessments: {
16130
+ start: (studentId, input) => client["request"]("/api/timeback/assessments/start", "POST", { ...input, gameId: client.gameId, studentId }),
16131
+ latest: (studentId, options) => {
16132
+ const params = new URLSearchParams({
16133
+ gameId: client.gameId,
16134
+ studentId,
16135
+ purpose: options.purpose
16136
+ });
16137
+ if (options.subject !== undefined) {
16138
+ params.set("subject", options.subject);
16139
+ }
16140
+ if (options.grade !== undefined) {
16141
+ params.set("grade", String(options.grade));
16142
+ }
16143
+ return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
16144
+ },
16145
+ get: (studentId, attemptId) => {
16146
+ const params = new URLSearchParams({ gameId: client.gameId, studentId });
16147
+ return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
16148
+ },
16149
+ save: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/save`, "POST", { ...input, gameId: client.gameId, studentId }),
16150
+ submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
16151
+ ...input,
16152
+ gameId: client.gameId,
16153
+ studentId,
16154
+ appName: client.config.name,
16155
+ sensorUrl: context.sensorUrl
16156
+ })
16157
+ },
16116
16158
  endActivity: async (studentId, payload) => {
16117
16159
  if (!isValidGrade(payload.activityData.grade)) {
16118
16160
  throw new Error("activityData.grade must be a valid grade level (-1 to 13)");
@@ -16288,7 +16330,7 @@ function statusCodeToErrorCode(status) {
16288
16330
  }
16289
16331
  }
16290
16332
  }
16291
- var SDK_VERSION = "0.16.0";
16333
+ var SDK_VERSION = "0.16.1-beta.2";
16292
16334
  async function makeApiRequest(opts) {
16293
16335
  const { baseUrl, apiToken, endpoint, method = "GET", body, gameOrigin, launchId } = opts;
16294
16336
  const url = `${baseUrl}${endpoint}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/better-auth",
3
- "version": "0.0.20",
3
+ "version": "0.0.21-beta.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": {
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@better-auth/utils": "^0.3.0",
27
27
  "@better-fetch/fetch": "^1.1.18",
28
- "@playcademy/sdk": "0.16.0",
28
+ "@playcademy/sdk": "0.16.1-beta.2",
29
29
  "better-auth": "1.3.33",
30
30
  "better-call": "^1.0.19"
31
31
  },