@playcademy/sdk 0.16.1-beta.1 → 0.16.1-beta.3
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/index.js +7 -1
- package/dist/internal.d.ts +10 -1
- package/dist/internal.js +14 -7
- package/dist/server/edge.d.ts +8 -0
- package/dist/server/edge.js +8 -1
- package/dist/server.d.ts +8 -0
- package/dist/server.js +8 -1
- package/dist/types.d.ts +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1118,6 +1118,12 @@ function createScoresNamespace(client) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
};
|
|
1120
1120
|
}
|
|
1121
|
+
// ../constants/src/auth.ts
|
|
1122
|
+
var DEFAULT_PERSONAL_API_KEY_PERMISSIONS = {
|
|
1123
|
+
games: ["read", "write", "delete"],
|
|
1124
|
+
users: ["read:self", "write:self"],
|
|
1125
|
+
dev: ["read", "write"]
|
|
1126
|
+
};
|
|
1121
1127
|
// ../constants/src/platform.ts
|
|
1122
1128
|
var PLAYCADEMY_BROWSER_TIME_ZONE_HEADER = "x-playcademy-browser-time-zone";
|
|
1123
1129
|
// ../constants/src/timeback.ts
|
|
@@ -2463,7 +2469,7 @@ async function request({
|
|
|
2463
2469
|
return rawText && rawText.length > 0 ? rawText : undefined;
|
|
2464
2470
|
}
|
|
2465
2471
|
// src/version.ts
|
|
2466
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
2472
|
+
var SDK_VERSION = "0.16.1-beta.3";
|
|
2467
2473
|
|
|
2468
2474
|
// src/clients/base.ts
|
|
2469
2475
|
class PlaycademyBaseClient {
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SchemaInfo } from '@playcademy/cloudflare';
|
|
2
|
+
import { GamePermission, AUTH_PROVIDER_IDS } from '@playcademy/constants';
|
|
2
3
|
import { TimebackGrade, TimebackSubject, HeartbeatRequest, TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/types/timeback';
|
|
3
4
|
import * as _playcademy_types from '@playcademy/types';
|
|
4
5
|
import { GameManifest, LocalDayContext } from '@playcademy/types';
|
|
@@ -7,7 +8,6 @@ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
|
7
8
|
import { DomainValidationRecords } from '@playcademy/types/game';
|
|
8
9
|
import { z } from 'zod';
|
|
9
10
|
import { TimebackUserRole, UserEnrollment, UserOrganization, UserInfo } from '@playcademy/types/user';
|
|
10
|
-
import { AUTH_PROVIDER_IDS } from '@playcademy/constants';
|
|
11
11
|
|
|
12
12
|
/** Permitted HTTP verbs */
|
|
13
13
|
type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
@@ -1005,6 +1005,8 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1005
1005
|
interface GameMetadata {
|
|
1006
1006
|
description?: string;
|
|
1007
1007
|
emoji?: string;
|
|
1008
|
+
/** Browser permissions delegated to the game's iframe (opt-in per game). */
|
|
1009
|
+
permissions?: GamePermission[];
|
|
1008
1010
|
[key: string]: unknown;
|
|
1009
1011
|
}
|
|
1010
1012
|
/**
|
|
@@ -3035,6 +3037,13 @@ interface PlaycademyConfig {
|
|
|
3035
3037
|
description?: string;
|
|
3036
3038
|
/** Game emoji icon */
|
|
3037
3039
|
emoji?: string;
|
|
3040
|
+
/**
|
|
3041
|
+
* Browser permissions to request for the game's iframe (e.g.
|
|
3042
|
+
* `['microphone']`). Opt-in per game; only `microphone` and `camera` are
|
|
3043
|
+
* delegated this way. Fullscreen, autoplay, and gamepad are granted to
|
|
3044
|
+
* every game automatically.
|
|
3045
|
+
*/
|
|
3046
|
+
permissions?: GamePermission[];
|
|
3038
3047
|
/** Build command to run before deployment */
|
|
3039
3048
|
buildCommand?: string[];
|
|
3040
3049
|
/** Path to build output */
|
package/dist/internal.js
CHANGED
|
@@ -1118,6 +1118,12 @@ function createScoresNamespace(client) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
};
|
|
1120
1120
|
}
|
|
1121
|
+
// ../constants/src/auth.ts
|
|
1122
|
+
var DEFAULT_PERSONAL_API_KEY_PERMISSIONS = {
|
|
1123
|
+
games: ["read", "write", "delete"],
|
|
1124
|
+
users: ["read:self", "write:self"],
|
|
1125
|
+
dev: ["read", "write"]
|
|
1126
|
+
};
|
|
1121
1127
|
// ../constants/src/platform.ts
|
|
1122
1128
|
var PLAYCADEMY_BROWSER_TIME_ZONE_HEADER = "x-playcademy-browser-time-zone";
|
|
1123
1129
|
// ../constants/src/timeback.ts
|
|
@@ -2218,6 +2224,11 @@ function createAdminNamespace(client) {
|
|
|
2218
2224
|
}
|
|
2219
2225
|
};
|
|
2220
2226
|
}
|
|
2227
|
+
// ../utils/src/error.ts
|
|
2228
|
+
function errorMessage(err) {
|
|
2229
|
+
return err instanceof Error ? err.message : String(err);
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2221
2232
|
// src/namespaces/platform/auth.ts
|
|
2222
2233
|
function createAuthNamespace(client) {
|
|
2223
2234
|
return {
|
|
@@ -2234,7 +2245,7 @@ function createAuthNamespace(client) {
|
|
|
2234
2245
|
} catch (error) {
|
|
2235
2246
|
return {
|
|
2236
2247
|
success: false,
|
|
2237
|
-
error: error
|
|
2248
|
+
error: errorMessage(error)
|
|
2238
2249
|
};
|
|
2239
2250
|
}
|
|
2240
2251
|
},
|
|
@@ -2249,11 +2260,7 @@ function createAuthNamespace(client) {
|
|
|
2249
2260
|
body: {
|
|
2250
2261
|
name: options?.name || `SDK Key - ${new Date().toISOString()}`,
|
|
2251
2262
|
expiresIn: options?.expiresIn !== undefined ? options.expiresIn : null,
|
|
2252
|
-
permissions: options?.permissions ||
|
|
2253
|
-
games: ["read", "write", "delete"],
|
|
2254
|
-
users: ["read:self", "write:self"],
|
|
2255
|
-
dev: ["read", "write"]
|
|
2256
|
-
}
|
|
2263
|
+
permissions: options?.permissions || DEFAULT_PERSONAL_API_KEY_PERMISSIONS
|
|
2257
2264
|
}
|
|
2258
2265
|
}),
|
|
2259
2266
|
list: async () => client["request"]("/auth/api-key/list", "GET"),
|
|
@@ -3312,7 +3319,7 @@ async function request({
|
|
|
3312
3319
|
return rawText && rawText.length > 0 ? rawText : undefined;
|
|
3313
3320
|
}
|
|
3314
3321
|
// src/version.ts
|
|
3315
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
3322
|
+
var SDK_VERSION = "0.16.1-beta.3";
|
|
3316
3323
|
|
|
3317
3324
|
// src/clients/base.ts
|
|
3318
3325
|
class PlaycademyBaseClient {
|
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 */
|
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
|
|
@@ -292,7 +299,7 @@ function extractApiErrorInfo(error) {
|
|
|
292
299
|
}
|
|
293
300
|
|
|
294
301
|
// src/version.ts
|
|
295
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
302
|
+
var SDK_VERSION = "0.16.1-beta.3";
|
|
296
303
|
|
|
297
304
|
// src/server/request.ts
|
|
298
305
|
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 */
|
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
|
|
@@ -481,7 +488,7 @@ function extractApiErrorInfo(error) {
|
|
|
481
488
|
}
|
|
482
489
|
|
|
483
490
|
// src/version.ts
|
|
484
|
-
var SDK_VERSION = "0.16.1-beta.
|
|
491
|
+
var SDK_VERSION = "0.16.1-beta.3";
|
|
485
492
|
|
|
486
493
|
// src/server/request.ts
|
|
487
494
|
async function makeApiRequest(opts) {
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { GameManifest, LocalDayContext } from '@playcademy/types';
|
|
|
3
3
|
export { AuthenticatedUser, DeveloperStatusEnumType, DeveloperStatusResponse, DeveloperStatusValue, GameCourseMetrics, GameLeaderboardEntry, GameManifest, GameMetricComparisonKind, GameMetricComparisonMetric, GameMetricComparisonRow, GameMetricComparisonRowStatus, GameMetricsProxyResponse, GameMetricsResponse, GameMetricsUnsupportedReason, GamePlatform, GameRunMetrics, GameRunMetricsComparison, GameRunMetricsComparisonStatus, GameRunMetricsComparisonSummary, GameTimebackIntegration, GameType, GameUser, LeaderboardEntry, LeaderboardOptions, LeaderboardTimeframe, LocalDayContext, LocalDaySource, ManifestV1, ManifestV2, ManifestVersions, PopulateStudentResponse, UserEnrollment, UserInfo, UserOrganization, UserRank, UserRankResponse, UserRoleEnumType, UserScore, UserTimebackData } from '@playcademy/types';
|
|
4
4
|
import { TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig, TimebackGrade, TimebackSubject, HeartbeatRequest } from '@playcademy/types/timeback';
|
|
5
5
|
import { TimebackUserRole, UserEnrollment, UserOrganization, UserInfo } from '@playcademy/types/user';
|
|
6
|
-
import { AUTH_PROVIDER_IDS } from '@playcademy/constants';
|
|
6
|
+
import { GamePermission, AUTH_PROVIDER_IDS } from '@playcademy/constants';
|
|
7
7
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
8
8
|
import { DomainValidationRecords } from '@playcademy/types/game';
|
|
9
9
|
import { z } from 'zod';
|
|
@@ -345,6 +345,13 @@ interface PlaycademyConfig {
|
|
|
345
345
|
description?: string;
|
|
346
346
|
/** Game emoji icon */
|
|
347
347
|
emoji?: string;
|
|
348
|
+
/**
|
|
349
|
+
* Browser permissions to request for the game's iframe (e.g.
|
|
350
|
+
* `['microphone']`). Opt-in per game; only `microphone` and `camera` are
|
|
351
|
+
* delegated this way. Fullscreen, autoplay, and gamepad are granted to
|
|
352
|
+
* every game automatically.
|
|
353
|
+
*/
|
|
354
|
+
permissions?: GamePermission[];
|
|
348
355
|
/** Build command to run before deployment */
|
|
349
356
|
buildCommand?: string[];
|
|
350
357
|
/** Path to build output */
|
|
@@ -679,6 +686,8 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
679
686
|
interface GameMetadata {
|
|
680
687
|
description?: string;
|
|
681
688
|
emoji?: string;
|
|
689
|
+
/** Browser permissions delegated to the game's iframe (opt-in per game). */
|
|
690
|
+
permissions?: GamePermission[];
|
|
682
691
|
[key: string]: unknown;
|
|
683
692
|
}
|
|
684
693
|
/**
|