@playcademy/sandbox 0.3.13 → 0.3.15
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 +77713 -78095
- package/dist/config.js +40 -14
- package/dist/constants.js +75 -5
- package/dist/infrastructure/api/index.d.ts +1 -1
- package/dist/mocks/timeback.d.ts +1 -1
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +77671 -78059
- package/dist/test.d.ts +11 -0
- package/package.json +10 -3
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ var __create = Object.create;
|
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
8
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
@@ -15,6 +16,20 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
15
16
|
});
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
|
+
var __toCommonJS = (from) => {
|
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
|
22
|
+
if (entry)
|
|
23
|
+
return entry;
|
|
24
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
+
get: () => from[key],
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
}));
|
|
30
|
+
__moduleCache.set(from, entry);
|
|
31
|
+
return entry;
|
|
32
|
+
};
|
|
18
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
34
|
var __export = (target, all) => {
|
|
20
35
|
for (var name in all)
|
|
@@ -31,12 +46,15 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
31
46
|
// src/config/timeback.ts
|
|
32
47
|
function getTimebackMode() {
|
|
33
48
|
const explicit = process.env.TIMEBACK_MODE;
|
|
34
|
-
if (explicit === "local" || explicit === "remote" || explicit === "disabled")
|
|
49
|
+
if (explicit === "local" || explicit === "remote" || explicit === "disabled") {
|
|
35
50
|
return explicit;
|
|
36
|
-
|
|
51
|
+
}
|
|
52
|
+
if (process.env.TIMEBACK_LOCAL === "true") {
|
|
37
53
|
return "local";
|
|
38
|
-
|
|
54
|
+
}
|
|
55
|
+
if (process.env.TIMEBACK_API_CLIENT_ID) {
|
|
39
56
|
return "remote";
|
|
57
|
+
}
|
|
40
58
|
return "disabled";
|
|
41
59
|
}
|
|
42
60
|
function isTimebackEnabled() {
|
|
@@ -45,37 +63,44 @@ function isTimebackEnabled() {
|
|
|
45
63
|
function hasTimebackCredentials() {
|
|
46
64
|
const { mode, onerosterApiUrl, caliperApiUrl, clientId, clientSecret, authUrl } = config.timeback;
|
|
47
65
|
if (mode === "local") {
|
|
48
|
-
return
|
|
66
|
+
return Boolean(onerosterApiUrl && caliperApiUrl);
|
|
49
67
|
}
|
|
50
68
|
if (mode === "remote") {
|
|
51
|
-
return
|
|
69
|
+
return Boolean(onerosterApiUrl && clientId && clientSecret && authUrl);
|
|
52
70
|
}
|
|
53
71
|
return false;
|
|
54
72
|
}
|
|
55
73
|
function hasTimebackFullConfig() {
|
|
56
|
-
return hasTimebackCredentials() &&
|
|
74
|
+
return hasTimebackCredentials() && Boolean(config.timeback.courseId && config.timeback.timebackId);
|
|
57
75
|
}
|
|
58
76
|
function requireTimebackCredentials() {
|
|
59
|
-
if (hasTimebackCredentials())
|
|
77
|
+
if (hasTimebackCredentials()) {
|
|
60
78
|
return config.timeback;
|
|
79
|
+
}
|
|
61
80
|
const { mode, onerosterApiUrl, caliperApiUrl, clientId, clientSecret, authUrl } = config.timeback;
|
|
62
81
|
if (mode === "local") {
|
|
63
82
|
const missing2 = [];
|
|
64
|
-
if (!onerosterApiUrl)
|
|
83
|
+
if (!onerosterApiUrl) {
|
|
65
84
|
missing2.push("TIMEBACK_ONEROSTER_API_URL");
|
|
66
|
-
|
|
85
|
+
}
|
|
86
|
+
if (!caliperApiUrl) {
|
|
67
87
|
missing2.push("TIMEBACK_CALIPER_API_URL");
|
|
88
|
+
}
|
|
68
89
|
throw new Error(`TimeBack local mode missing: ${missing2.join(", ")}`);
|
|
69
90
|
}
|
|
70
91
|
const missing = [];
|
|
71
|
-
if (!onerosterApiUrl)
|
|
92
|
+
if (!onerosterApiUrl) {
|
|
72
93
|
missing.push("TIMEBACK_ONEROSTER_API_URL");
|
|
73
|
-
|
|
94
|
+
}
|
|
95
|
+
if (!clientId) {
|
|
74
96
|
missing.push("TIMEBACK_API_CLIENT_ID");
|
|
75
|
-
|
|
97
|
+
}
|
|
98
|
+
if (!clientSecret) {
|
|
76
99
|
missing.push("TIMEBACK_API_CLIENT_SECRET");
|
|
77
|
-
|
|
100
|
+
}
|
|
101
|
+
if (!authUrl) {
|
|
78
102
|
missing.push("TIMEBACK_API_AUTH_URL");
|
|
103
|
+
}
|
|
79
104
|
throw new Error(`TimeBack credentials missing: ${missing.join(", ")}`);
|
|
80
105
|
}
|
|
81
106
|
function configureTimeback(options) {
|
|
@@ -133,8 +158,9 @@ function configureTimeback(options) {
|
|
|
133
158
|
}
|
|
134
159
|
function getTimebackDisplayMode() {
|
|
135
160
|
const { timebackId, mode } = config.timeback;
|
|
136
|
-
if (!timebackId)
|
|
161
|
+
if (!timebackId) {
|
|
137
162
|
return null;
|
|
163
|
+
}
|
|
138
164
|
if (timebackId === "mock" || !hasTimebackCredentials()) {
|
|
139
165
|
return "mock";
|
|
140
166
|
}
|
package/dist/constants.js
CHANGED
|
@@ -3,6 +3,7 @@ var __create = Object.create;
|
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
8
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
@@ -15,6 +16,20 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
15
16
|
});
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
|
+
var __toCommonJS = (from) => {
|
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
|
22
|
+
if (entry)
|
|
23
|
+
return entry;
|
|
24
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
+
get: () => from[key],
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
}));
|
|
30
|
+
__moduleCache.set(from, entry);
|
|
31
|
+
return entry;
|
|
32
|
+
};
|
|
18
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
34
|
var __export = (target, all) => {
|
|
20
35
|
for (var name in all)
|
|
@@ -129,9 +144,17 @@ var init_auth = __esm(() => {
|
|
|
129
144
|
});
|
|
130
145
|
|
|
131
146
|
// ../constants/src/typescript.ts
|
|
132
|
-
var
|
|
147
|
+
var TypeScriptPackages, TYPESCRIPT_RUNNER;
|
|
133
148
|
var init_typescript = __esm(() => {
|
|
134
|
-
|
|
149
|
+
TypeScriptPackages = {
|
|
150
|
+
tsc: "tsc",
|
|
151
|
+
nativePreview: "@typescript/native-preview",
|
|
152
|
+
nativePreviewPinned: "@typescript/native-preview@7.0.0-dev.20260221.1"
|
|
153
|
+
};
|
|
154
|
+
TYPESCRIPT_RUNNER = {
|
|
155
|
+
package: TypeScriptPackages.nativePreviewPinned,
|
|
156
|
+
bin: "tsgo"
|
|
157
|
+
};
|
|
135
158
|
});
|
|
136
159
|
|
|
137
160
|
// ../constants/src/character.ts
|
|
@@ -147,7 +170,17 @@ var init_character = __esm(() => {
|
|
|
147
170
|
});
|
|
148
171
|
|
|
149
172
|
// ../constants/src/domains.ts
|
|
150
|
-
var
|
|
173
|
+
var PLAYCADEMY_BASE_URLS, GAME_WORKER_DOMAINS;
|
|
174
|
+
var init_domains = __esm(() => {
|
|
175
|
+
PLAYCADEMY_BASE_URLS = {
|
|
176
|
+
production: "https://hub.playcademy.net",
|
|
177
|
+
staging: "https://hub.dev.playcademy.net"
|
|
178
|
+
};
|
|
179
|
+
GAME_WORKER_DOMAINS = {
|
|
180
|
+
production: "playcademy.gg",
|
|
181
|
+
staging: "staging.playcademy.gg"
|
|
182
|
+
};
|
|
183
|
+
});
|
|
151
184
|
|
|
152
185
|
// ../constants/src/env-vars.ts
|
|
153
186
|
var init_env_vars = () => {};
|
|
@@ -197,10 +230,47 @@ var init_overworld = __esm(() => {
|
|
|
197
230
|
var PLATFORM_TIMEZONE = "America/New_York";
|
|
198
231
|
|
|
199
232
|
// ../constants/src/timeback.ts
|
|
200
|
-
var TIMEBACK_ROUTES, TIMEBACK_ORG_SOURCED_ID = "PLAYCADEMY";
|
|
233
|
+
var TIMEBACK_ROUTES, TIMEBACK_ORG_SOURCED_ID = "PLAYCADEMY", TIMEBACK_ORG_NAME = "Playcademy Studios", TIMEBACK_ORG_TYPE = "department", TIMEBACK_COURSE_DEFAULTS, TIMEBACK_RESOURCE_DEFAULTS, TIMEBACK_COMPONENT_DEFAULTS, TIMEBACK_COMPONENT_RESOURCE_DEFAULTS;
|
|
201
234
|
var init_timeback = __esm(() => {
|
|
202
235
|
TIMEBACK_ROUTES = {
|
|
203
|
-
END_ACTIVITY: "/integrations/timeback/end-activity"
|
|
236
|
+
END_ACTIVITY: "/integrations/timeback/end-activity",
|
|
237
|
+
GET_XP: "/integrations/timeback/xp"
|
|
238
|
+
};
|
|
239
|
+
TIMEBACK_COURSE_DEFAULTS = {
|
|
240
|
+
gradingScheme: "STANDARD",
|
|
241
|
+
level: {
|
|
242
|
+
elementary: "Elementary",
|
|
243
|
+
middle: "Middle",
|
|
244
|
+
high: "High",
|
|
245
|
+
ap: "AP"
|
|
246
|
+
},
|
|
247
|
+
goals: {
|
|
248
|
+
dailyXp: 50,
|
|
249
|
+
dailyLessons: 3
|
|
250
|
+
},
|
|
251
|
+
metrics: {
|
|
252
|
+
totalXp: 1000,
|
|
253
|
+
totalLessons: 50
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
TIMEBACK_RESOURCE_DEFAULTS = {
|
|
257
|
+
vendorId: "playcademy",
|
|
258
|
+
roles: ["primary"],
|
|
259
|
+
importance: "primary",
|
|
260
|
+
metadata: {
|
|
261
|
+
type: "interactive",
|
|
262
|
+
toolProvider: "Playcademy",
|
|
263
|
+
instructionalMethod: "exploratory",
|
|
264
|
+
language: "en-US"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
TIMEBACK_COMPONENT_DEFAULTS = {
|
|
268
|
+
sortOrder: 1,
|
|
269
|
+
prerequisiteCriteria: "ALL"
|
|
270
|
+
};
|
|
271
|
+
TIMEBACK_COMPONENT_RESOURCE_DEFAULTS = {
|
|
272
|
+
sortOrder: 1,
|
|
273
|
+
lessonType: "quiz"
|
|
204
274
|
};
|
|
205
275
|
});
|
|
206
276
|
|
|
@@ -43,7 +43,7 @@ export declare function handle(...args: Parameters<ReturnType<typeof createHandl
|
|
|
43
43
|
* import { deploy } from '@playcademy/api-core/controllers'
|
|
44
44
|
* import { handleStream } from '../infrastructure/api'
|
|
45
45
|
*
|
|
46
|
-
* router.post('/games/:slug/
|
|
46
|
+
* router.post('/games/:slug/seed', handleStream(seed.seed))
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
export declare function handleStream(...args: Parameters<ReturnType<typeof createHandlers>[1]>): ReturnType<ReturnType<typeof createHandlers>[1]>;
|
package/dist/mocks/timeback.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Pure mock data generators for local development.
|
|
5
5
|
* Used by route handlers when mock mode is enabled.
|
|
6
6
|
*/
|
|
7
|
-
import type { User } from '@playcademy/
|
|
7
|
+
import type { UserRow as User } from '@playcademy/data/types';
|
|
8
8
|
import type { AuthenticatedUser, GameUser, TimebackStudentProfile, UserEnrollment, UserTimebackData } from '@playcademy/types/user';
|
|
9
9
|
import type { DatabaseInstance } from '../types';
|
|
10
10
|
/**
|
package/dist/pglite.data
CHANGED
|
Binary file
|
package/dist/pglite.wasm
CHANGED
|
Binary file
|
package/dist/server.d.ts
CHANGED
|
@@ -291,6 +291,7 @@ declare function startServer(port: number, project?: ProjectInfo, options?: Omit
|
|
|
291
291
|
gameId: string | undefined;
|
|
292
292
|
timebackMode: "local" | "mock" | "remote" | null;
|
|
293
293
|
setRole: (role: TimebackUserRole) => void;
|
|
294
|
+
reset: () => Promise<void>;
|
|
294
295
|
stop: () => Promise<void>;
|
|
295
296
|
}>;
|
|
296
297
|
|