@playcademy/sdk 0.16.1-beta.1 → 0.16.1-beta.11
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/README.md +58 -3
- package/dist/index.d.ts +608 -153
- package/dist/index.js +1739 -706
- package/dist/internal.d.ts +527 -25
- package/dist/internal.js +1677 -617
- package/dist/server/edge.d.ts +9 -0
- package/dist/server/edge.js +23 -2
- package/dist/server.d.ts +9 -0
- package/dist/server.js +23 -2
- package/dist/types.d.ts +587 -152
- package/package.json +1 -1
package/dist/server/edge.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';
|
|
@@ -152,6 +153,13 @@ interface PlaycademyConfig {
|
|
|
152
153
|
description?: string;
|
|
153
154
|
/** Game emoji icon */
|
|
154
155
|
emoji?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Browser permissions to request for the game's iframe (e.g.
|
|
158
|
+
* `['microphone']`). Opt-in per game; only `microphone` and `camera` are
|
|
159
|
+
* delegated this way. Fullscreen, autoplay, and gamepad are granted to
|
|
160
|
+
* every game automatically.
|
|
161
|
+
*/
|
|
162
|
+
permissions?: GamePermission[];
|
|
155
163
|
/** Build command to run before deployment */
|
|
156
164
|
buildCommand?: string[];
|
|
157
165
|
/** Path to build output */
|
|
@@ -351,6 +359,7 @@ declare class PlaycademyClient {
|
|
|
351
359
|
latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
|
|
352
360
|
get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
|
|
353
361
|
save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
|
|
362
|
+
submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
|
|
354
363
|
submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
|
|
355
364
|
sensorUrl: string;
|
|
356
365
|
}) => Promise<_playcademy_types.AssessmentSubmitResult>;
|
package/dist/server/edge.js
CHANGED
|
@@ -9,6 +9,13 @@ var __export = (target, all) => {
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
|
+
|
|
13
|
+
// ../constants/src/auth.ts
|
|
14
|
+
var DEFAULT_PERSONAL_API_KEY_PERMISSIONS = {
|
|
15
|
+
games: ["read", "write", "delete"],
|
|
16
|
+
users: ["read:self", "write:self"],
|
|
17
|
+
dev: ["read", "write"]
|
|
18
|
+
};
|
|
12
19
|
// ../constants/src/platform.ts
|
|
13
20
|
var PLAYCADEMY_BROWSER_TIME_ZONE_HEADER = "x-playcademy-browser-time-zone";
|
|
14
21
|
// ../constants/src/timeback.ts
|
|
@@ -34,7 +41,13 @@ var TIMEBACK_SUBJECTS = [
|
|
|
34
41
|
"Math",
|
|
35
42
|
"None"
|
|
36
43
|
];
|
|
37
|
-
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
|
+
itemsPerStandard: 5,
|
|
48
|
+
standardFieldLength: 128
|
|
49
|
+
};
|
|
50
|
+
var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
|
|
38
51
|
var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
|
|
39
52
|
xp: 1,
|
|
40
53
|
mastery: 0,
|
|
@@ -58,6 +71,9 @@ function isValidSubject(value) {
|
|
|
58
71
|
function isAssessmentPurpose(value) {
|
|
59
72
|
return typeof value === "string" && ASSESSMENT_PURPOSES.includes(value);
|
|
60
73
|
}
|
|
74
|
+
function isValidELevel(value) {
|
|
75
|
+
return typeof value === "string" && VALID_E_LEVELS.includes(value);
|
|
76
|
+
}
|
|
61
77
|
// src/server/namespaces/timeback.ts
|
|
62
78
|
function createTimebackNamespace(client) {
|
|
63
79
|
function enrichActivityData(data) {
|
|
@@ -81,6 +97,10 @@ function createTimebackNamespace(client) {
|
|
|
81
97
|
if (options.grade !== undefined) {
|
|
82
98
|
params.set("grade", String(options.grade));
|
|
83
99
|
}
|
|
100
|
+
if (options.purpose === "mastery") {
|
|
101
|
+
params.set("standardFramework", options.standard.framework);
|
|
102
|
+
params.set("standardIdentifier", options.standard.identifier);
|
|
103
|
+
}
|
|
84
104
|
return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
|
|
85
105
|
},
|
|
86
106
|
get: (studentId, attemptId) => {
|
|
@@ -88,6 +108,7 @@ function createTimebackNamespace(client) {
|
|
|
88
108
|
return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
|
|
89
109
|
},
|
|
90
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 }),
|
|
91
112
|
submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
|
|
92
113
|
...input,
|
|
93
114
|
gameId: client.gameId,
|
|
@@ -292,7 +313,7 @@ function extractApiErrorInfo(error) {
|
|
|
292
313
|
}
|
|
293
314
|
|
|
294
315
|
// src/version.ts
|
|
295
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
316
|
+
var SDK_VERSION = "0.16.1-beta.11";
|
|
296
317
|
|
|
297
318
|
// src/server/request.ts
|
|
298
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';
|
|
@@ -152,6 +153,13 @@ interface PlaycademyConfig {
|
|
|
152
153
|
description?: string;
|
|
153
154
|
/** Game emoji icon */
|
|
154
155
|
emoji?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Browser permissions to request for the game's iframe (e.g.
|
|
158
|
+
* `['microphone']`). Opt-in per game; only `microphone` and `camera` are
|
|
159
|
+
* delegated this way. Fullscreen, autoplay, and gamepad are granted to
|
|
160
|
+
* every game automatically.
|
|
161
|
+
*/
|
|
162
|
+
permissions?: GamePermission[];
|
|
155
163
|
/** Build command to run before deployment */
|
|
156
164
|
buildCommand?: string[];
|
|
157
165
|
/** Path to build output */
|
|
@@ -351,6 +359,7 @@ declare class PlaycademyClient$1 {
|
|
|
351
359
|
latest: (studentId: string, options: _playcademy_types.GetLatestAssessmentOptions) => Promise<_playcademy_types.LatestAssessmentResult | null>;
|
|
352
360
|
get: (studentId: string, attemptId: string) => Promise<_playcademy_types.AssessmentAttemptSnapshot>;
|
|
353
361
|
save: (studentId: string, attemptId: string, input: _playcademy_types.SaveAssessmentInput) => Promise<_playcademy_types.AssessmentSaveResult>;
|
|
362
|
+
submitItem: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentItemInput) => Promise<_playcademy_types.SubmitAssessmentItemResult>;
|
|
354
363
|
submit: (studentId: string, attemptId: string, input: _playcademy_types.SubmitAssessmentInput, context: {
|
|
355
364
|
sensorUrl: string;
|
|
356
365
|
}) => Promise<_playcademy_types.AssessmentSubmitResult>;
|
package/dist/server.js
CHANGED
|
@@ -198,6 +198,13 @@ function validateConfig(config) {
|
|
|
198
198
|
var init_config_loader = __esm(() => {
|
|
199
199
|
init_file_loader();
|
|
200
200
|
});
|
|
201
|
+
|
|
202
|
+
// ../constants/src/auth.ts
|
|
203
|
+
var DEFAULT_PERSONAL_API_KEY_PERMISSIONS = {
|
|
204
|
+
games: ["read", "write", "delete"],
|
|
205
|
+
users: ["read:self", "write:self"],
|
|
206
|
+
dev: ["read", "write"]
|
|
207
|
+
};
|
|
201
208
|
// ../constants/src/platform.ts
|
|
202
209
|
var PLAYCADEMY_BROWSER_TIME_ZONE_HEADER = "x-playcademy-browser-time-zone";
|
|
203
210
|
// ../constants/src/timeback.ts
|
|
@@ -223,7 +230,13 @@ var TIMEBACK_SUBJECTS = [
|
|
|
223
230
|
"Math",
|
|
224
231
|
"None"
|
|
225
232
|
];
|
|
226
|
-
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
|
+
itemsPerStandard: 5,
|
|
237
|
+
standardFieldLength: 128
|
|
238
|
+
};
|
|
239
|
+
var VALID_E_LEVELS = ["E1", "E2", "E3", "E4"];
|
|
227
240
|
var TIMEBACK_GAME_METRIC_DECIMAL_PLACES = {
|
|
228
241
|
xp: 1,
|
|
229
242
|
mastery: 0,
|
|
@@ -247,6 +260,9 @@ function isValidSubject(value) {
|
|
|
247
260
|
function isAssessmentPurpose(value) {
|
|
248
261
|
return typeof value === "string" && ASSESSMENT_PURPOSES.includes(value);
|
|
249
262
|
}
|
|
263
|
+
function isValidELevel(value) {
|
|
264
|
+
return typeof value === "string" && VALID_E_LEVELS.includes(value);
|
|
265
|
+
}
|
|
250
266
|
// src/server/namespaces/timeback.ts
|
|
251
267
|
function createTimebackNamespace(client) {
|
|
252
268
|
function enrichActivityData(data) {
|
|
@@ -270,6 +286,10 @@ function createTimebackNamespace(client) {
|
|
|
270
286
|
if (options.grade !== undefined) {
|
|
271
287
|
params.set("grade", String(options.grade));
|
|
272
288
|
}
|
|
289
|
+
if (options.purpose === "mastery") {
|
|
290
|
+
params.set("standardFramework", options.standard.framework);
|
|
291
|
+
params.set("standardIdentifier", options.standard.identifier);
|
|
292
|
+
}
|
|
273
293
|
return client["request"](`/api/timeback/assessments/latest?${params.toString()}`, "GET");
|
|
274
294
|
},
|
|
275
295
|
get: (studentId, attemptId) => {
|
|
@@ -277,6 +297,7 @@ function createTimebackNamespace(client) {
|
|
|
277
297
|
return client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}?${params.toString()}`, "GET");
|
|
278
298
|
},
|
|
279
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 }),
|
|
280
301
|
submit: (studentId, attemptId, input, context) => client["request"](`/api/timeback/assessments/${encodeURIComponent(attemptId)}/submit`, "POST", {
|
|
281
302
|
...input,
|
|
282
303
|
gameId: client.gameId,
|
|
@@ -481,7 +502,7 @@ function extractApiErrorInfo(error) {
|
|
|
481
502
|
}
|
|
482
503
|
|
|
483
504
|
// src/version.ts
|
|
484
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
505
|
+
var SDK_VERSION = "0.16.1-beta.11";
|
|
485
506
|
|
|
486
507
|
// src/server/request.ts
|
|
487
508
|
async function makeApiRequest(opts) {
|