coursekit-lms 0.1.0 → 0.1.2
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/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/dist/cli/index.js +9 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/server/index.js +9 -5
- package/dist/server/index.js.map +1 -1
- package/dist/types/server/config.d.ts +9 -9
- package/dist/types/server/context.d.ts +1 -1
- package/dist/types/server/db/index.d.ts +2 -4
- package/dist/types/server/db/types.d.ts +4 -0
- package/dist/types/server/index.d.ts +10 -4
- package/dist/types/server/seed/demo.d.ts +5 -4
- package/dist/types/server/services/access.d.ts +1 -1
- package/dist/types/server/services/courses.d.ts +1 -1
- package/dist/types/server/services/notify.d.ts +1 -1
- package/dist/types/server/services/progress.d.ts +1 -1
- package/dist/types/server/services/quiz.d.ts +1 -1
- package/dist/types/server/services/settings.d.ts +1 -1
- package/dist/types/server/services/users.d.ts +5 -5
- package/dist/web/assets/{ActivityEditor-LKK0d5Mb.js → ActivityEditor-BVSZUV8l.js} +1 -1
- package/dist/web/assets/{ActivityPage-BhRtXLwW.js → ActivityPage-DPmSV_mU.js} +1 -1
- package/dist/web/assets/{AdminCoursesPage-BT9AQTuZ.js → AdminCoursesPage-uaSHNtzf.js} +1 -1
- package/dist/web/assets/{AdminLayout-ChXLxrl_.js → AdminLayout-DqoShZGn.js} +1 -1
- package/dist/web/assets/{AdminOverviewPage-BGsUzMXN.js → AdminOverviewPage-DnTrdGbr.js} +1 -1
- package/dist/web/assets/{AdminSettingsPage-B4ZeIbVO.js → AdminSettingsPage-B82cX8xU.js} +1 -1
- package/dist/web/assets/{AdminUsersPage-BmBSnct8.js → AdminUsersPage-3d2F9AEl.js} +1 -1
- package/dist/web/assets/{AnnouncementsPage-KJUA3o7v.js → AnnouncementsPage-BKW30k0Z.js} +1 -1
- package/dist/web/assets/{CalendarPage-DQdBEQN-.js → CalendarPage-CLRWyTNT.js} +1 -1
- package/dist/web/assets/{CatalogPage-CIFyefBY.js → CatalogPage-BiMgSSBR.js} +1 -1
- package/dist/web/assets/{CourseContentPage-CZEP3VMH.js → CourseContentPage-BIDH0UbG.js} +1 -1
- package/dist/web/assets/{CourseLayout-CwpWuS7V.js → CourseLayout-ql01LEmj.js} +1 -1
- package/dist/web/assets/{CourseSettingsPage-DwEIXO2s.js → CourseSettingsPage-CReoPqOa.js} +1 -1
- package/dist/web/assets/{CreateCoursePage-BDfIRStx.js → CreateCoursePage-DFCHlq5M.js} +1 -1
- package/dist/web/assets/{DiscussionPage-Dyt0qgUe.js → DiscussionPage-CWwVpFQV.js} +1 -1
- package/dist/web/assets/{GradesPage-Brj-Wqu1.js → GradesPage-Bu5vphcG.js} +1 -1
- package/dist/web/assets/{MyCoursesPage-GCdSHlYs.js → MyCoursesPage-Dd-Oaygv.js} +1 -1
- package/dist/web/assets/{NotFoundPage-CJIpDg1F.js → NotFoundPage-BRquC7-l.js} +1 -1
- package/dist/web/assets/{NotificationsPage-Y3shIm5z.js → NotificationsPage-LJvqb6Dj.js} +1 -1
- package/dist/web/assets/{ParticipantsPage-OHnKj_8Z.js → ParticipantsPage-wFxiphna.js} +1 -1
- package/dist/web/assets/{ProfilePage-Dgj-HYPS.js → ProfilePage-CzfhacAX.js} +1 -1
- package/dist/web/assets/{QuizAttemptPage-CiW3E3K0.js → QuizAttemptPage-CEAV6wAL.js} +1 -1
- package/dist/web/assets/{QuizEditorPage-bT0jpSFE.js → QuizEditorPage-DS_czQVM.js} +1 -1
- package/dist/web/assets/{SubmissionsPage-DXZGSqup.js → SubmissionsPage-CQjcx09G.js} +1 -1
- package/dist/web/assets/{context-B5ZaAO90.js → context-BLVW7NB7.js} +1 -1
- package/dist/web/assets/{frame-BjgJqbS9.js → frame-CGabirLa.js} +1 -1
- package/dist/web/assets/{index-DkBZ18Ts.js → index-B29bTBiJ.js} +2 -2
- package/dist/web/assets/{markdown-C1oaAmMK.js → markdown-ykrkPMbn.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +8 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
- **`seedDemo()` without a password no longer locks you out.** On a site with no administrator, `lms.seedDemo()` creates `admin@coursekit.test` with a random password; it now returns that password instead of `null`. The CLI was not affected: `coursekit seed --demo` uses `coursekit` unless you pass `--password`.
|
|
6
|
+
- Docs: with `skipLibCheck` off, the type definitions need TypeScript 5.7 or newer. The 0.1.1 notes now say which tabs reload themselves after an upgrade.
|
|
7
|
+
|
|
8
|
+
## 0.1.1
|
|
9
|
+
|
|
10
|
+
Fixes found while verifying the first release from the npm registry.
|
|
11
|
+
|
|
12
|
+
- **Stale tabs after an upgrade.** Requests for files that don't exist (such as page files from an older build) now get a 404 instead of the app page, and a tab running 0.1.1 or later reloads to pick up a newer build after an upgrade instead of failing to open pages. It reloads at most once per build within five minutes, and three times in five minutes in all, so a file that is really missing shows the error screen (with a Reload button) rather than reloading over and over. Tabs opened on 0.1.0 don't have this code: after upgrading from 0.1.0, an open tab shows the error screen the first time it opens a page it hasn't loaded yet, and its Reload button fixes it.
|
|
13
|
+
- **CommonJS.** `require('coursekit-lms')` now works on every supported Node version, 22.13+ (the package `exports` map has a `default` condition). It returns the same module as `import`.
|
|
14
|
+
- **TypeScript.** The published declarations now reference Node's types themselves, so they work even when `node` isn't listed in `"types"` (TypeScript 7's default is `[]`). Optional options accept an explicit `undefined`, so code like `databaseUrl: process.env.DATABASE_URL` compiles under `exactOptionalPropertyTypes`. The types the programmatic API uses are exported too: `CreateUserInput`, `SeedDemoOptions`, `SeedDemoResult`, `AppEnv`, `AppDeps`, `DB` and `DatabaseKind`. The declarations no longer import `kysely/migration`, which TypeScript's older `node10` module resolution (the default for `"module": "commonjs"` in TypeScript 5) can't find.
|
|
15
|
+
- **`createUser()` no longer returns the password hash.** The programmatic `lms.createUser()` now returns the public user (the same shape the API uses). The HTTP API never exposed it.
|
|
16
|
+
- Added `npm run check:package`, which loads the built package with `require()` and `import()` and type-checks consumer code against it, in CI and before publishing.
|
|
17
|
+
|
|
18
|
+
## 0.1.0
|
|
19
|
+
|
|
20
|
+
First release: courses, lessons, resources, assignments, auto-graded quizzes, forums, gradebook, announcements, notifications, calendar and administration, with SQLite or PostgreSQL, a CLI and a programmatic API.
|
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ Migrations run automatically on start (or explicitly with `coursekit migrate`).
|
|
|
123
123
|
|
|
124
124
|
## Use it as a library
|
|
125
125
|
|
|
126
|
-
Coursekit exports a programmatic API, so you can run it inside your own server, react to events or seed data from scripts.
|
|
126
|
+
Coursekit exports a programmatic API, so you can run it inside your own server, react to events or seed data from scripts. It is an ES module, and CommonJS code can `require('coursekit-lms')` too. Type definitions are included; TypeScript projects also need `@types/node`, which most Node projects already have. With `skipLibCheck` off, the type definitions need TypeScript 5.7 or newer (Hono's use 5.7 features). With TypeScript 5, `"module": "commonjs"` and `skipLibCheck` off, also set `esModuleInterop` (for zod's type definitions, which Coursekit's types use) and a `target` of ES2022 or newer (for kysely's).
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
129
|
import { createCoursekit } from 'coursekit-lms';
|
package/dist/cli/index.js
CHANGED
|
@@ -2765,10 +2765,10 @@ async function seedDemo(deps, options = {}) {
|
|
|
2765
2765
|
const password = options.password ?? randomToken(12);
|
|
2766
2766
|
const passwordHash = await hashPassword(password);
|
|
2767
2767
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
2768
|
-
|
|
2768
|
+
const existingAdmin = options.admin ?? await db.selectFrom("users").select("id").where("role", "=", "admin").executeTakeFirst();
|
|
2769
2769
|
const users = [];
|
|
2770
|
-
if (!
|
|
2771
|
-
admin = {
|
|
2770
|
+
if (!existingAdmin) {
|
|
2771
|
+
const admin = {
|
|
2772
2772
|
id: newId(),
|
|
2773
2773
|
email: "admin@coursekit.test",
|
|
2774
2774
|
name: "Ada Admin",
|
|
@@ -3320,7 +3320,7 @@ Tasks persist in localStorage and everything works with the keyboard (Enter to a
|
|
|
3320
3320
|
await insertChunks(db, "announcements", announcements);
|
|
3321
3321
|
await insertChunks(db, "calendarEvents", events);
|
|
3322
3322
|
await insertChunks(db, "notifications", notifications);
|
|
3323
|
-
return { created: true, password
|
|
3323
|
+
return { created: true, password, users, courses: courses.length };
|
|
3324
3324
|
}
|
|
3325
3325
|
|
|
3326
3326
|
// src/server/routes/auth.ts
|
|
@@ -4544,6 +4544,9 @@ function quizRoutes(deps) {
|
|
|
4544
4544
|
|
|
4545
4545
|
// src/server/app.ts
|
|
4546
4546
|
var JSON_LIMIT = 5 * 1024 * 1024;
|
|
4547
|
+
function isFileRequest(path) {
|
|
4548
|
+
return path.startsWith("/assets/") || /\.[a-z0-9]+$/i.test(path.slice(path.lastIndexOf("/") + 1));
|
|
4549
|
+
}
|
|
4547
4550
|
function errorBody(message, code, issues) {
|
|
4548
4551
|
return { error: { message, code, ...issues ? { issues } : {} } };
|
|
4549
4552
|
}
|
|
@@ -4620,6 +4623,7 @@ function createApp(deps) {
|
|
|
4620
4623
|
})
|
|
4621
4624
|
);
|
|
4622
4625
|
app.get("*", (c) => {
|
|
4626
|
+
if (isFileRequest(c.req.path)) return c.notFound();
|
|
4623
4627
|
c.header("Cache-Control", "no-cache");
|
|
4624
4628
|
return c.html(indexHtml);
|
|
4625
4629
|
});
|
|
@@ -4928,7 +4932,7 @@ async function createCoursekit(options = {}) {
|
|
|
4928
4932
|
async migrate() {
|
|
4929
4933
|
await migrateToLatest(db);
|
|
4930
4934
|
},
|
|
4931
|
-
createUser: (input) => createUser(deps, input),
|
|
4935
|
+
createUser: async (input) => toUser(await createUser(deps, input)),
|
|
4932
4936
|
seedDemo: (opts) => seedDemo(deps, opts),
|
|
4933
4937
|
async close() {
|
|
4934
4938
|
await Promise.all(servers.map((s) => new Promise((resolve6) => s.close(() => resolve6()))));
|