@playcademy/sdk 0.16.1-beta.2 → 0.16.1-beta.21

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.
@@ -1,4 +1,5 @@
1
1
  import { SchemaInfo } from '@playcademy/cloudflare';
2
+ import { GamePermission } from '@playcademy/constants';
2
3
  import { TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/types/timeback';
3
4
  export { ActivityData, ComponentConfig, ComponentResourceConfig, EndActivityPayload, OrganizationConfig, ResourceConfig, TimebackGrade, TimebackSubject } from '@playcademy/types/timeback';
4
5
  import { UserInfo } from '@playcademy/types/user';
@@ -141,6 +142,19 @@ interface DashboardThemeConfig {
141
142
  /** Secondary/accent color as a hex string, e.g. '#ffd166' */
142
143
  secondary?: string;
143
144
  }
145
+ /**
146
+ * Child-catalog contract generation (see @playcademy/sdk/contracts).
147
+ * The extractor is a repo-local script (run with the CLI's runtime) that
148
+ * prints `{ generatedFrom, deliveries }` as JSON on stdout; the CLI
149
+ * validates, stamps the contract fields, and writes
150
+ * `.playcademy/catalog.json` deterministically. The document carries no
151
+ * app identity — consuming repos assign the namespace key from sync
152
+ * provenance.
153
+ */
154
+ interface CatalogConfig {
155
+ /** Path to the extractor script, relative to the config file. */
156
+ extractor: string;
157
+ }
144
158
  /**
145
159
  * Unified Playcademy configuration
146
160
  * Used for playcademy.config.{js,json}
@@ -152,6 +166,13 @@ interface PlaycademyConfig {
152
166
  description?: string;
153
167
  /** Game emoji icon */
154
168
  emoji?: string;
169
+ /**
170
+ * Browser permissions to request for the game's iframe (e.g.
171
+ * `['microphone']`). Opt-in per game; only `microphone` and `camera` are
172
+ * delegated this way. Fullscreen, autoplay, and gamepad are granted to
173
+ * every game automatically.
174
+ */
175
+ permissions?: GamePermission[];
155
176
  /** Build command to run before deployment */
156
177
  buildCommand?: string[];
157
178
  /** Path to build output */
@@ -166,6 +187,8 @@ interface PlaycademyConfig {
166
187
  dashboard?: DashboardConfig | boolean;
167
188
  /** Integrations (database, custom routes, external services) */
168
189
  integrations?: IntegrationsConfig;
190
+ /** Child-catalog contract generation (`playcademy catalog`) */
191
+ catalog?: CatalogConfig;
169
192
  }
170
193
 
171
194
  /**
@@ -351,7 +374,8 @@ declare class PlaycademyClient {
351
374
  latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
352
375
  get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
353
376
  save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
354
- submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
377
+ submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
378
+ submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentRequest, context: {
355
379
  sensorUrl: string;
356
380
  }) => Promise<_playcademy_types.AssessmentSubmitResult>;
357
381
  };
@@ -41,7 +41,13 @@ var TIMEBACK_SUBJECTS = [
41
41
  "Math",
42
42
  "None"
43
43
  ];
44
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
44
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
45
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
46
+ standards: 20,
47
+ candidateItemsPerStandard: 2,
48
+ standardFieldLength: 128
49
+ };
50
+ var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
45
51
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
46
52
  xp: 1,
47
53
  mastery: 0,
@@ -65,6 +71,9 @@ function isValidSubject(value) {
65
71
  function isAssessmentPurpose(value) {
66
72
  return typeof value === "string" && ASSESSMENT_PURPOSES.includes(value);
67
73
  }
74
+ function isValidELevel(value) {
75
+ return typeof value === "string" && VALID_E_LEVELS.includes(value);
76
+ }
68
77
  // src/server/namespaces/timeback.ts
69
78
  function createTimebackNamespace(client) {
70
79
  function enrichActivityData(data) {
@@ -88,6 +97,10 @@ function createTimebackNamespace(client) {
88
97
  if (options.grade !== undefined) {
89
98
  params.set("grade", String(options.grade));
90
99
  }
100
+ if (options.purpose === "mastery") {
101
+ params.set("standardFramework", options.standard.framework);
102
+ params.set("standardIdentifier", options.standard.identifier);
103
+ }
91
104
  return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
92
105
  },
93
106
  get: (studentId, attemptId) => {
@@ -95,6 +108,7 @@ function createTimebackNamespace(client) {
95
108
  return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
96
109
  },
97
110
  save: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/save`, "POST", { ...input, gameId: client.gameId, studentId }),
111
+ submitItem: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit-item`, "POST", { ...input, gameId: client.gameId, studentId }),
98
112
  submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
99
113
  ...input,
100
114
  gameId: client.gameId,
@@ -299,7 +313,7 @@ function extractApiErrorInfo(error) {
299
313
  }
300
314
 
301
315
  // src/version.ts
302
- var SDK_VERSION = "0.16.1-beta.2";
316
+ var SDK_VERSION = "0.16.1-beta.21";
303
317
 
304
318
  // src/server/request.ts
305
319
  async function makeApiRequest(opts) {
package/dist/server.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { SchemaInfo } from '@playcademy/cloudflare';
2
+ import { GamePermission } from '@playcademy/constants';
2
3
  import { TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/types/timeback';
3
4
  export { ActivityData, ComponentConfig, ComponentResourceConfig, EndActivityPayload, OrganizationConfig, ResourceConfig, TimebackGrade, TimebackSubject } from '@playcademy/types/timeback';
4
5
  import { UserInfo } from '@playcademy/types/user';
@@ -141,6 +142,19 @@ interface DashboardThemeConfig {
141
142
  /** Secondary/accent color as a hex string, e.g. '#ffd166' */
142
143
  secondary?: string;
143
144
  }
145
+ /**
146
+ * Child-catalog contract generation (see @playcademy/sdk/contracts).
147
+ * The extractor is a repo-local script (run with the CLI's runtime) that
148
+ * prints `{ generatedFrom, deliveries }` as JSON on stdout; the CLI
149
+ * validates, stamps the contract fields, and writes
150
+ * `.playcademy/catalog.json` deterministically. The document carries no
151
+ * app identity — consuming repos assign the namespace key from sync
152
+ * provenance.
153
+ */
154
+ interface CatalogConfig {
155
+ /** Path to the extractor script, relative to the config file. */
156
+ extractor: string;
157
+ }
144
158
  /**
145
159
  * Unified Playcademy configuration
146
160
  * Used for playcademy.config.{js,json}
@@ -152,6 +166,13 @@ interface PlaycademyConfig {
152
166
  description?: string;
153
167
  /** Game emoji icon */
154
168
  emoji?: string;
169
+ /**
170
+ * Browser permissions to request for the game's iframe (e.g.
171
+ * `['microphone']`). Opt-in per game; only `microphone` and `camera` are
172
+ * delegated this way. Fullscreen, autoplay, and gamepad are granted to
173
+ * every game automatically.
174
+ */
175
+ permissions?: GamePermission[];
155
176
  /** Build command to run before deployment */
156
177
  buildCommand?: string[];
157
178
  /** Path to build output */
@@ -166,6 +187,8 @@ interface PlaycademyConfig {
166
187
  dashboard?: DashboardConfig | boolean;
167
188
  /** Integrations (database, custom routes, external services) */
168
189
  integrations?: IntegrationsConfig;
190
+ /** Child-catalog contract generation (`playcademy catalog`) */
191
+ catalog?: CatalogConfig;
169
192
  }
170
193
 
171
194
  /**
@@ -351,7 +374,8 @@ declare class PlaycademyClient$1 {
351
374
  latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
352
375
  get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
353
376
  save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
354
- submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
377
+ submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
378
+ submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentRequest, context: {
355
379
  sensorUrl: string;
356
380
  }) => Promise<_playcademy_types.AssessmentSubmitResult>;
357
381
  };
package/dist/server.js CHANGED
@@ -230,7 +230,13 @@ var TIMEBACK_SUBJECTS = [
230
230
  "Math",
231
231
  "None"
232
232
  ];
233
- var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic"];
233
+ var ASSESSMENT_PURPOSES = ["end_of_course", "diagnostic", "review", "mastery"];
234
+ var TIMEBACK_ASSESSMENT_REVIEW_REQUEST_LIMITS = {
235
+ standards: 20,
236
+ candidateItemsPerStandard: 2,
237
+ standardFieldLength: 128
238
+ };
239
+ var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
234
240
  var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
235
241
  xp: 1,
236
242
  mastery: 0,
@@ -254,6 +260,9 @@ function isValidSubject(value) {
254
260
  function isAssessmentPurpose(value) {
255
261
  return typeof value === "string" && ASSESSMENT_PURPOSES.includes(value);
256
262
  }
263
+ function isValidELevel(value) {
264
+ return typeof value === "string" && VALID_E_LEVELS.includes(value);
265
+ }
257
266
  // src/server/namespaces/timeback.ts
258
267
  function createTimebackNamespace(client) {
259
268
  function enrichActivityData(data) {
@@ -277,6 +286,10 @@ function createTimebackNamespace(client) {
277
286
  if (options.grade !== undefined) {
278
287
  params.set("grade", String(options.grade));
279
288
  }
289
+ if (options.purpose === "mastery") {
290
+ params.set("standardFramework", options.standard.framework);
291
+ params.set("standardIdentifier", options.standard.identifier);
292
+ }
280
293
  return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
281
294
  },
282
295
  get: (studentId, attemptId) => {
@@ -284,6 +297,7 @@ function createTimebackNamespace(client) {
284
297
  return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
285
298
  },
286
299
  save: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/save`, "POST", { ...input, gameId: client.gameId, studentId }),
300
+ submitItem: (studentId, attemptId, input) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit-item`, "POST", { ...input, gameId: client.gameId, studentId }),
287
301
  submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
288
302
  ...input,
289
303
  gameId: client.gameId,
@@ -488,7 +502,7 @@ function extractApiErrorInfo(error) {
488
502
  }
489
503
 
490
504
  // src/version.ts
491
- var SDK_VERSION = "0.16.1-beta.2";
505
+ var SDK_VERSION = "0.16.1-beta.21";
492
506
 
493
507
  // src/server/request.ts
494
508
  async function makeApiRequest(opts) {