playcademy 0.15.4 → 0.15.6

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.
package/dist/cli.js CHANGED
@@ -2965,7 +2965,7 @@ import { join as join13 } from "path";
2965
2965
  // package.json with { type: 'json' }
2966
2966
  var package_default2 = {
2967
2967
  name: "playcademy",
2968
- version: "0.15.3",
2968
+ version: "0.15.5",
2969
2969
  type: "module",
2970
2970
  exports: {
2971
2971
  ".": {
@@ -17,6 +17,37 @@ import type { HonoEnv } from '../../../types'
17
17
  * their own backend infrastructure. The SDK handles config enrichment and metadata.
18
18
  */
19
19
 
20
+ /** Valid grade levels: -1 (Pre-K), 0 (Kindergarten), 1-12 (Grades), 13 (AP) */
21
+ const VALID_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] as const
22
+
23
+ /** Valid TimeBack subject values */
24
+ const VALID_SUBJECTS = [
25
+ 'Reading',
26
+ 'Language',
27
+ 'Vocabulary',
28
+ 'Social Studies',
29
+ 'Writing',
30
+ 'Science',
31
+ 'FastMath',
32
+ 'Math',
33
+ 'None',
34
+ ] as const
35
+
36
+ function isValidGrade(value: unknown): value is (typeof VALID_GRADES)[number] {
37
+ return (
38
+ typeof value === 'number' &&
39
+ Number.isInteger(value) &&
40
+ VALID_GRADES.includes(value as (typeof VALID_GRADES)[number])
41
+ )
42
+ }
43
+
44
+ function isValidSubject(value: unknown): value is (typeof VALID_SUBJECTS)[number] {
45
+ return (
46
+ typeof value === 'string' &&
47
+ VALID_SUBJECTS.includes(value as (typeof VALID_SUBJECTS)[number])
48
+ )
49
+ }
50
+
20
51
  function getConfig(c: Context<HonoEnv>): PlaycademyConfig {
21
52
  const config = c.get('config')
22
53
  const timebackConfig = config?.integrations?.timeback
@@ -33,11 +64,11 @@ function validateRequestBody(body: {
33
64
  if (!body.activityData?.activityId) {
34
65
  return { error: 'activityId is required' }
35
66
  }
36
- if (!body.activityData?.grade) {
37
- return { error: 'grade is required' }
67
+ if (!isValidGrade(body.activityData?.grade)) {
68
+ return { error: `grade must be a valid grade level (${VALID_GRADES.join(', ')})` }
38
69
  }
39
- if (!body.activityData?.subject) {
40
- return { error: 'subject is required' }
70
+ if (!isValidSubject(body.activityData?.subject)) {
71
+ return { error: `subject must be a valid subject (${VALID_SUBJECTS.join(', ')})` }
41
72
  }
42
73
  if (
43
74
  typeof body.scoreData?.correctQuestions !== 'number' ||
package/dist/index.js CHANGED
@@ -3664,9 +3664,13 @@ async function getGameById(client, gameId, options) {
3664
3664
  if (options?.noExit) {
3665
3665
  return null;
3666
3666
  }
3667
- logger.newLine();
3668
- logger.admonition("warning", "Game Not Found", [`Could not find game with ID: ${gameId}`]);
3669
- logger.newLine();
3667
+ if (!options?.silent) {
3668
+ logger.newLine();
3669
+ logger.admonition("warning", "Game Not Found", [
3670
+ `Could not find game with ID: ${gameId}`
3671
+ ]);
3672
+ logger.newLine();
3673
+ }
3670
3674
  process.exit(1);
3671
3675
  }
3672
3676
  return game;
@@ -3972,7 +3976,7 @@ import { join as join12 } from "path";
3972
3976
  // package.json with { type: 'json' }
3973
3977
  var package_default2 = {
3974
3978
  name: "playcademy",
3975
- version: "0.15.3",
3979
+ version: "0.15.5",
3976
3980
  type: "module",
3977
3981
  exports: {
3978
3982
  ".": {
@@ -10621,7 +10625,7 @@ var getStatusCommand = new Command13("status").description("Check your developer
10621
10625
  });
10622
10626
 
10623
10627
  // package.json
10624
- var version2 = "0.15.3";
10628
+ var version2 = "0.15.5";
10625
10629
 
10626
10630
  // src/commands/dev/server.ts
10627
10631
  function setupCleanupHandlers(workspace, getServer) {
@@ -12574,7 +12578,9 @@ async function runBucketBulkRemote(directory, options) {
12574
12578
  outputDryRunResults(files, totalSize, options.prefix, options.json, options.raw);
12575
12579
  return;
12576
12580
  }
12577
- const game = await getGameById(client, deployedGame.gameId);
12581
+ const game = await getGameById(client, deployedGame.gameId, {
12582
+ silent: options.raw || options.json
12583
+ });
12578
12584
  const uploaded = await uploadFilesRemote(
12579
12585
  files,
12580
12586
  game.slug,
@@ -12703,7 +12709,9 @@ async function runBucketDeleteRemote(key, options) {
12703
12709
  }
12704
12710
  process.exit(1);
12705
12711
  }
12706
- const game = await getGameById(client, deployedGame.gameId);
12712
+ const game = await getGameById(client, deployedGame.gameId, {
12713
+ silent: options.raw || options.json
12714
+ });
12707
12715
  await client.dev.games.bucket.delete(game.slug, key);
12708
12716
  if (options.json) {
12709
12717
  logger.json({
@@ -12822,7 +12830,9 @@ async function runBucketGetRemote(key, options) {
12822
12830
  }
12823
12831
  process.exit(1);
12824
12832
  }
12825
- const game = await getGameById(client, deployedGame.gameId);
12833
+ const game = await getGameById(client, deployedGame.gameId, {
12834
+ silent: options.raw || options.json
12835
+ });
12826
12836
  let arrayBuffer;
12827
12837
  try {
12828
12838
  arrayBuffer = await client.dev.games.bucket.get(game.slug, key);
@@ -13072,7 +13082,9 @@ async function runBucketListRemote(options) {
13072
13082
  }
13073
13083
  process.exit(1);
13074
13084
  }
13075
- const game = await getGameById(client, deployedGame.gameId);
13085
+ const game = await getGameById(client, deployedGame.gameId, {
13086
+ silent: options.raw || options.json
13087
+ });
13076
13088
  const files = await client.dev.games.bucket.list(game.slug, options.prefix);
13077
13089
  if (options.json) {
13078
13090
  logger.json(files);
@@ -13237,7 +13249,9 @@ async function runBucketPutRemote(key, filePath, options) {
13237
13249
  }
13238
13250
  process.exit(1);
13239
13251
  }
13240
- const game = await getGameById(client, deployedGame.gameId);
13252
+ const game = await getGameById(client, deployedGame.gameId, {
13253
+ silent: options.raw || options.json
13254
+ });
13241
13255
  const contentType = getContentType(filePath);
13242
13256
  await client.dev.games.bucket.put(game.slug, key, fileBuffer, contentType);
13243
13257
  if (options.json) {
package/dist/utils.js CHANGED
@@ -2321,7 +2321,7 @@ import { join as join12 } from "path";
2321
2321
  // package.json with { type: 'json' }
2322
2322
  var package_default2 = {
2323
2323
  name: "playcademy",
2324
- version: "0.15.3",
2324
+ version: "0.15.5",
2325
2325
  type: "module",
2326
2326
  exports: {
2327
2327
  ".": {
package/dist/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json with { type: 'json' }
2
2
  var package_default = {
3
3
  name: "playcademy",
4
- version: "0.15.3",
4
+ version: "0.15.5",
5
5
  type: "module",
6
6
  exports: {
7
7
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@inquirer/prompts": "^7.8.6",
53
- "@playcademy/sdk": "0.2.5",
53
+ "@playcademy/sdk": "0.2.6",
54
54
  "chokidar": "^4.0.3",
55
55
  "colorette": "^2.0.20",
56
56
  "commander": "^14.0.1",