@playcademy/sdk 0.2.9 → 0.2.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/dist/internal.d.ts +33 -2
- package/dist/internal.js +27 -5
- package/package.json +3 -3
package/dist/internal.d.ts
CHANGED
|
@@ -785,6 +785,11 @@ declare enum NotificationStatus {
|
|
|
785
785
|
DISMISSED = "dismissed",
|
|
786
786
|
EXPIRED = "expired"
|
|
787
787
|
}
|
|
788
|
+
declare enum NotificationMethod {
|
|
789
|
+
REALTIME = "realtime",
|
|
790
|
+
LOGIN = "login",
|
|
791
|
+
PUSH = "push"
|
|
792
|
+
}
|
|
788
793
|
interface NotificationStats {
|
|
789
794
|
total: number;
|
|
790
795
|
delivered: number;
|
|
@@ -7027,7 +7032,7 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
|
|
|
7027
7032
|
backend?: BackendDeploymentBundle | undefined;
|
|
7028
7033
|
hooks?: DevUploadHooks | undefined;
|
|
7029
7034
|
}) => Promise<Game>;
|
|
7030
|
-
seed: (slug: string, code: string, environment?: "production" | "staging" | undefined) => Promise<SeedResponse>;
|
|
7035
|
+
seed: (slug: string, code: string, environment?: "production" | "staging" | undefined, secrets?: Record<string, string> | undefined) => Promise<SeedResponse>;
|
|
7031
7036
|
upsert: (slug: string, metadata: {
|
|
7032
7037
|
displayName: string;
|
|
7033
7038
|
mapElementId?: string | null | undefined;
|
|
@@ -7256,6 +7261,7 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
|
|
|
7256
7261
|
games: {
|
|
7257
7262
|
fetch: (gameIdOrSlug: string, options?: TTLCacheConfig | undefined) => Promise<FetchedGame>;
|
|
7258
7263
|
list: (options?: TTLCacheConfig | undefined) => Promise<Game[]>;
|
|
7264
|
+
getSubjects: () => Promise<Record<string, string | null>>;
|
|
7259
7265
|
startSession: (gameId?: string | undefined) => Promise<StartSessionResponse>;
|
|
7260
7266
|
endSession: (sessionId: string, gameId?: string | undefined) => Promise<void>;
|
|
7261
7267
|
token: {
|
|
@@ -7330,7 +7336,7 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
|
|
|
7330
7336
|
*/
|
|
7331
7337
|
leaderboard: {
|
|
7332
7338
|
fetch: (options?: LeaderboardOptions | undefined) => Promise<GameLeaderboardEntry[]>;
|
|
7333
|
-
getUserRank: (gameId: string, userId: string) => Promise<
|
|
7339
|
+
getUserRank: (gameId: string, userId: string) => Promise<UserRank | null>;
|
|
7334
7340
|
};
|
|
7335
7341
|
/**
|
|
7336
7342
|
* Platform-wide XP and leveling system.
|
|
@@ -7461,6 +7467,27 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
|
|
|
7461
7467
|
type: string;
|
|
7462
7468
|
userId: string;
|
|
7463
7469
|
}>;
|
|
7470
|
+
markAsDelivered: (notificationId: string, method?: NotificationMethod) => Promise<{
|
|
7471
|
+
clickUrl: string | null;
|
|
7472
|
+
clickedAt: Date | null;
|
|
7473
|
+
createdAt: Date;
|
|
7474
|
+
data: unknown;
|
|
7475
|
+
deliveredAt: Date | null;
|
|
7476
|
+
expiresAt: Date | null;
|
|
7477
|
+
id: string;
|
|
7478
|
+
message: string;
|
|
7479
|
+
metadata: unknown;
|
|
7480
|
+
method: string | null;
|
|
7481
|
+
priority: "high" | "low" | "normal" | "urgent";
|
|
7482
|
+
seenAt: Date | null;
|
|
7483
|
+
status: "clicked" | "delivered" | "dismissed" | "expired" | "pending" | "seen";
|
|
7484
|
+
title: string;
|
|
7485
|
+
type: string;
|
|
7486
|
+
userId: string;
|
|
7487
|
+
}>;
|
|
7488
|
+
deliverPending: () => Promise<{
|
|
7489
|
+
success: boolean;
|
|
7490
|
+
}>;
|
|
7464
7491
|
stats: {
|
|
7465
7492
|
get: (queryOptions?: {
|
|
7466
7493
|
from?: string | undefined;
|
|
@@ -7529,6 +7556,10 @@ declare class PlaycademyInternalClient extends PlaycademyBaseClient {
|
|
|
7529
7556
|
*/
|
|
7530
7557
|
timeback: {
|
|
7531
7558
|
readonly user: PlatformTimebackUser;
|
|
7559
|
+
populateStudent: (names?: {
|
|
7560
|
+
firstName?: string | undefined;
|
|
7561
|
+
lastName?: string | undefined;
|
|
7562
|
+
} | undefined) => Promise<PopulateStudentResponse>;
|
|
7532
7563
|
startActivity: (_metadata: ActivityData) => void;
|
|
7533
7564
|
pauseActivity: () => void;
|
|
7534
7565
|
resumeActivity: () => void;
|
package/dist/internal.js
CHANGED
|
@@ -1769,9 +1769,9 @@ function createDevNamespace(client) {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
throw new Error("No deployment actions specified (need metadata, file, or backend)");
|
|
1771
1771
|
},
|
|
1772
|
-
seed: async (slug, code, environment) => {
|
|
1772
|
+
seed: async (slug, code, environment, secrets) => {
|
|
1773
1773
|
return client["request"](`/games/${slug}/seed`, "POST", {
|
|
1774
|
-
body: { code, environment }
|
|
1774
|
+
body: { code, environment, secrets }
|
|
1775
1775
|
});
|
|
1776
1776
|
},
|
|
1777
1777
|
upsert: async (slug, metadata) => client["request"](`/games/${slug}`, "PUT", { body: metadata }),
|
|
@@ -2050,6 +2050,9 @@ function createGamesNamespace(client) {
|
|
|
2050
2050
|
list: (options) => {
|
|
2051
2051
|
return gamesListCache.get("all", () => client["request"]("/games", "GET"), options);
|
|
2052
2052
|
},
|
|
2053
|
+
getSubjects: () => {
|
|
2054
|
+
return client["request"]("/games/subjects", "GET");
|
|
2055
|
+
},
|
|
2053
2056
|
startSession: async (gameId) => {
|
|
2054
2057
|
const idToUse = gameId ?? client["_ensureGameId"]();
|
|
2055
2058
|
return client["request"](`/games/${idToUse}/sessions`, "POST", {});
|
|
@@ -2291,7 +2294,7 @@ function createNotificationsNamespace(client) {
|
|
|
2291
2294
|
return notificationsListCache.get(cacheKey, () => client["request"](path, "GET"), cacheOptions);
|
|
2292
2295
|
},
|
|
2293
2296
|
markAsSeen: async (notificationId) => {
|
|
2294
|
-
const result = await client["request"](`/notifications/${notificationId}
|
|
2297
|
+
const result = await client["request"](`/notifications/${notificationId}`, "PATCH", {
|
|
2295
2298
|
body: {
|
|
2296
2299
|
id: notificationId,
|
|
2297
2300
|
status: "seen"
|
|
@@ -2301,7 +2304,7 @@ function createNotificationsNamespace(client) {
|
|
|
2301
2304
|
return result;
|
|
2302
2305
|
},
|
|
2303
2306
|
markAsClicked: async (notificationId) => {
|
|
2304
|
-
const result = await client["request"](`/notifications/${notificationId}
|
|
2307
|
+
const result = await client["request"](`/notifications/${notificationId}`, "PATCH", {
|
|
2305
2308
|
body: {
|
|
2306
2309
|
id: notificationId,
|
|
2307
2310
|
status: "clicked"
|
|
@@ -2311,7 +2314,7 @@ function createNotificationsNamespace(client) {
|
|
|
2311
2314
|
return result;
|
|
2312
2315
|
},
|
|
2313
2316
|
dismiss: async (notificationId) => {
|
|
2314
|
-
const result = await client["request"](`/notifications/${notificationId}
|
|
2317
|
+
const result = await client["request"](`/notifications/${notificationId}`, "PATCH", {
|
|
2315
2318
|
body: {
|
|
2316
2319
|
id: notificationId,
|
|
2317
2320
|
status: "dismissed"
|
|
@@ -2320,6 +2323,22 @@ function createNotificationsNamespace(client) {
|
|
|
2320
2323
|
notificationsListCache.clear();
|
|
2321
2324
|
return result;
|
|
2322
2325
|
},
|
|
2326
|
+
markAsDelivered: async (notificationId, method = "realtime") => {
|
|
2327
|
+
const result = await client["request"](`/notifications/${notificationId}`, "PATCH", {
|
|
2328
|
+
body: {
|
|
2329
|
+
id: notificationId,
|
|
2330
|
+
status: "delivered",
|
|
2331
|
+
method
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
notificationsListCache.clear();
|
|
2335
|
+
return result;
|
|
2336
|
+
},
|
|
2337
|
+
deliverPending: async () => {
|
|
2338
|
+
const result = await client["request"]("/notifications/deliver", "POST");
|
|
2339
|
+
notificationsListCache.clear();
|
|
2340
|
+
return result;
|
|
2341
|
+
},
|
|
2323
2342
|
stats: {
|
|
2324
2343
|
get: async (queryOptions, cacheOptions) => {
|
|
2325
2344
|
const user = await client.users.me();
|
|
@@ -2451,6 +2470,9 @@ function createTimebackNamespace2(client) {
|
|
|
2451
2470
|
}
|
|
2452
2471
|
};
|
|
2453
2472
|
},
|
|
2473
|
+
populateStudent: async (names) => {
|
|
2474
|
+
return client["request"]("/timeback/populate-student", "POST", names ? { body: names } : undefined);
|
|
2475
|
+
},
|
|
2454
2476
|
startActivity: (_metadata) => {
|
|
2455
2477
|
throw new Error(NOT_SUPPORTED);
|
|
2456
2478
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@playcademy/data": "0.0.1",
|
|
45
45
|
"@playcademy/logger": "0.0.1",
|
|
46
46
|
"@playcademy/types": "0.0.1",
|
|
47
|
-
"@playcademy/sandbox": "0.3.
|
|
47
|
+
"@playcademy/sandbox": "0.3.12",
|
|
48
48
|
"@playcademy/test": "0.0.1",
|
|
49
49
|
"@playcademy/timeback": "0.0.1",
|
|
50
50
|
"@playcademy/utils": "0.0.1",
|
|
51
51
|
"@types/bun": "latest",
|
|
52
|
-
"playcademy": "0.16.
|
|
52
|
+
"playcademy": "0.16.3",
|
|
53
53
|
"rollup": "^4.50.2",
|
|
54
54
|
"rollup-plugin-dts": "^6.2.3",
|
|
55
55
|
"typescript": "^5.7.2"
|