playcademy 0.15.5 → 0.16.0
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 +1 -1
- package/dist/edge-play/src/routes/integrations/timeback/end-activity.ts +22 -2
- package/dist/index.d.ts +55 -1
- package/dist/index.js +1091 -642
- package/dist/utils.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -20,6 +20,19 @@ import type { HonoEnv } from '../../../types'
|
|
|
20
20
|
/** Valid grade levels: -1 (Pre-K), 0 (Kindergarten), 1-12 (Grades), 13 (AP) */
|
|
21
21
|
const VALID_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] as const
|
|
22
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
|
+
|
|
23
36
|
function isValidGrade(value: unknown): value is (typeof VALID_GRADES)[number] {
|
|
24
37
|
return (
|
|
25
38
|
typeof value === 'number' &&
|
|
@@ -28,6 +41,13 @@ function isValidGrade(value: unknown): value is (typeof VALID_GRADES)[number] {
|
|
|
28
41
|
)
|
|
29
42
|
}
|
|
30
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
|
+
|
|
31
51
|
function getConfig(c: Context<HonoEnv>): PlaycademyConfig {
|
|
32
52
|
const config = c.get('config')
|
|
33
53
|
const timebackConfig = config?.integrations?.timeback
|
|
@@ -47,8 +67,8 @@ function validateRequestBody(body: {
|
|
|
47
67
|
if (!isValidGrade(body.activityData?.grade)) {
|
|
48
68
|
return { error: `grade must be a valid grade level (${VALID_GRADES.join(', ')})` }
|
|
49
69
|
}
|
|
50
|
-
if (!body.activityData?.subject) {
|
|
51
|
-
return { error:
|
|
70
|
+
if (!isValidSubject(body.activityData?.subject)) {
|
|
71
|
+
return { error: `subject must be a valid subject (${VALID_SUBJECTS.join(', ')})` }
|
|
52
72
|
}
|
|
53
73
|
if (
|
|
54
74
|
typeof body.scoreData?.correctQuestions !== 'number' ||
|
package/dist/index.d.ts
CHANGED
|
@@ -1354,6 +1354,58 @@ interface CallbackServerResult {
|
|
|
1354
1354
|
/**
|
|
1355
1355
|
* KV command types
|
|
1356
1356
|
*/
|
|
1357
|
+
/**
|
|
1358
|
+
* Base options for KV commands
|
|
1359
|
+
*/
|
|
1360
|
+
interface BaseKVOptions {
|
|
1361
|
+
raw?: boolean;
|
|
1362
|
+
json?: boolean;
|
|
1363
|
+
remote?: boolean;
|
|
1364
|
+
env?: string;
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Options for kv list command
|
|
1368
|
+
*/
|
|
1369
|
+
interface KVListOptions extends BaseKVOptions {
|
|
1370
|
+
prefix?: string;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Options for kv get command
|
|
1374
|
+
*/
|
|
1375
|
+
type KVGetOptions = BaseKVOptions;
|
|
1376
|
+
/**
|
|
1377
|
+
* Options for kv set command
|
|
1378
|
+
*/
|
|
1379
|
+
interface KVSetOptions extends BaseKVOptions {
|
|
1380
|
+
file?: string;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Options for kv delete command
|
|
1384
|
+
*/
|
|
1385
|
+
interface KVDeleteOptions extends BaseKVOptions {
|
|
1386
|
+
force?: boolean;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Options for kv inspect command
|
|
1390
|
+
*/
|
|
1391
|
+
type KVInspectOptions = BaseKVOptions;
|
|
1392
|
+
/**
|
|
1393
|
+
* Options for kv stats command
|
|
1394
|
+
*/
|
|
1395
|
+
type KVStatsOptions = BaseKVOptions;
|
|
1396
|
+
/**
|
|
1397
|
+
* Options for kv clear command
|
|
1398
|
+
*/
|
|
1399
|
+
interface KVClearOptions extends BaseKVOptions {
|
|
1400
|
+
force?: boolean;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Options for kv seed command
|
|
1404
|
+
*/
|
|
1405
|
+
interface KVSeedOptions extends BaseKVOptions {
|
|
1406
|
+
replace?: boolean;
|
|
1407
|
+
force?: boolean;
|
|
1408
|
+
}
|
|
1357
1409
|
/**
|
|
1358
1410
|
* Statistics about KV storage
|
|
1359
1411
|
*/
|
|
@@ -1384,6 +1436,8 @@ interface KeyMetadata {
|
|
|
1384
1436
|
value?: unknown;
|
|
1385
1437
|
/** Type of value stored */
|
|
1386
1438
|
valueType?: 'json' | 'string';
|
|
1439
|
+
/** Custom metadata attached to the key */
|
|
1440
|
+
customMetadata?: Record<string, unknown>;
|
|
1387
1441
|
}
|
|
1388
1442
|
|
|
1389
1443
|
/**
|
|
@@ -1509,4 +1563,4 @@ interface SecretDeleteOptions extends SecretCommandOptions {
|
|
|
1509
1563
|
force?: boolean;
|
|
1510
1564
|
}
|
|
1511
1565
|
|
|
1512
|
-
export type { ApiConfig, ApiErrorResponse, ApiKeyListItem, ApiKeyWithSecret, ApiRequestOptions, AuthProfile, AuthStore, AuthStrategy, BackendBundle, BackendDeploymentMetadata, BackendDiff, BackendFeatures, BucketBulkOptions, BucketDeleteOptions, BucketGetOptions, BucketListOptions, BucketPutOptions, BuildDiff, BulkCollectionResult, BundleOptions, CallbackServerResult, CollectedFile, ComponentConfig, ComponentResourceConfig, ConfigDiff, CreateApiKeyResponse, CustomRoutesIntegrationOptions, DatabaseIntegrationOptions, DeployConfig, DeployNewGameOptions, DeployedGameInfo, DeploymentChanges, DeploymentContext, DeploymentDiffOptions, DeploymentPlan, DeploymentResult, DevServerOptions, EmbeddedSourcePaths, EngineConfig, EngineType, EnvironmentAuthProfiles, GameStore, IntegrationChangeDetector, IntegrationChangeDetectors, IntegrationConfigChange, IntegrationsConfig, IntegrationsDiff, KeyMetadata, KeyStats, LoadConfigResult, LogEntry, LogStreamConfig, LogStreamUrlOptions, LoginCredentials, LoginResponse, OrganizationConfig, PlaycademyConfig, PluginLogger, PreviewOptions, PreviewResponse, ProjectDirectoryInfo, ResourceConfig, ScaffoldResult, SecretCommandOptions, SecretDeleteOptions, SecretListOptions, SecretSetOptions, SignInResponse, SsoCallbackData, Template, TemplateFramework, TemplateHook, TemplateHookOptions, TemplateSource, TimebackBaseConfig, TimebackCourseConfig, TimebackCourseConfigWithOverrides, TimebackGrade, TimebackIntegrationConfig, TimebackSourcedIds, TimebackSubject, TokenType, UpdateExistingGameOptions };
|
|
1566
|
+
export type { ApiConfig, ApiErrorResponse, ApiKeyListItem, ApiKeyWithSecret, ApiRequestOptions, AuthProfile, AuthStore, AuthStrategy, BackendBundle, BackendDeploymentMetadata, BackendDiff, BackendFeatures, BaseKVOptions, BucketBulkOptions, BucketDeleteOptions, BucketGetOptions, BucketListOptions, BucketPutOptions, BuildDiff, BulkCollectionResult, BundleOptions, CallbackServerResult, CollectedFile, ComponentConfig, ComponentResourceConfig, ConfigDiff, CreateApiKeyResponse, CustomRoutesIntegrationOptions, DatabaseIntegrationOptions, DeployConfig, DeployNewGameOptions, DeployedGameInfo, DeploymentChanges, DeploymentContext, DeploymentDiffOptions, DeploymentPlan, DeploymentResult, DevServerOptions, EmbeddedSourcePaths, EngineConfig, EngineType, EnvironmentAuthProfiles, GameStore, IntegrationChangeDetector, IntegrationChangeDetectors, IntegrationConfigChange, IntegrationsConfig, IntegrationsDiff, KVClearOptions, KVDeleteOptions, KVGetOptions, KVInspectOptions, KVListOptions, KVSeedOptions, KVSetOptions, KVStatsOptions, KeyMetadata, KeyStats, LoadConfigResult, LogEntry, LogStreamConfig, LogStreamUrlOptions, LoginCredentials, LoginResponse, OrganizationConfig, PlaycademyConfig, PluginLogger, PreviewOptions, PreviewResponse, ProjectDirectoryInfo, ResourceConfig, ScaffoldResult, SecretCommandOptions, SecretDeleteOptions, SecretListOptions, SecretSetOptions, SignInResponse, SsoCallbackData, Template, TemplateFramework, TemplateHook, TemplateHookOptions, TemplateSource, TimebackBaseConfig, TimebackCourseConfig, TimebackCourseConfigWithOverrides, TimebackGrade, TimebackIntegrationConfig, TimebackSourcedIds, TimebackSubject, TokenType, UpdateExistingGameOptions };
|