zam-core 0.15.2 → 0.15.4

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.
@@ -2755,6 +2755,9 @@ async function addPrerequisite(db, tokenId, requiresId) {
2755
2755
  "INSERT OR IGNORE INTO prerequisites (token_id, requires_id) VALUES (?, ?)"
2756
2756
  ).run(tokenId, requiresId);
2757
2757
  }
2758
+ async function removePrerequisite(db, tokenId, requiresId) {
2759
+ await db.prepare("DELETE FROM prerequisites WHERE token_id = ? AND requires_id = ?").run(tokenId, requiresId);
2760
+ }
2758
2761
  async function getPrerequisites(db, tokenId) {
2759
2762
  return await db.prepare(
2760
2763
  `SELECT p.token_id, p.requires_id, t.slug, t.title, t.concept, t.domain, t.bloom_level
@@ -7227,6 +7230,7 @@ __export(kernel_exports, {
7227
7230
  readMonitorLog: () => readMonitorLog,
7228
7231
  readUiObservationLog: () => readUiObservationLog,
7229
7232
  removeConfiguredWorkspace: () => removeConfiguredWorkspace,
7233
+ removePrerequisite: () => removePrerequisite,
7230
7234
  resetCardsForToken: () => resetCardsForToken,
7231
7235
  resolveAllBeliefPaths: () => resolveAllBeliefPaths,
7232
7236
  resolveAllGoalPaths: () => resolveAllGoalPaths,
@@ -10663,6 +10667,13 @@ async function importOkfTokens(db, params) {
10663
10667
  (input.prerequisites ?? []).map((s) => s.trim()).filter(Boolean)
10664
10668
  )
10665
10669
  ];
10670
+ const desiredPrerequisites = new Set(prereqSlugs);
10671
+ const existingPrerequisites = await getPrerequisites(tx, token.id);
10672
+ for (const existing of existingPrerequisites) {
10673
+ if (!desiredPrerequisites.has(existing.slug)) {
10674
+ await removePrerequisite(tx, token.id, existing.requires_id);
10675
+ }
10676
+ }
10666
10677
  for (const prereqSlug of prereqSlugs) {
10667
10678
  const target = inImport.get(prereqSlug) ?? await getTokenBySlug(tx, prereqSlug);
10668
10679
  if (!target) {
@@ -12251,7 +12262,7 @@ async function readWebLink(url) {
12251
12262
  redirect: "manual",
12252
12263
  signal: controller.signal,
12253
12264
  headers: {
12254
- "User-Agent": "ZAM-Content-Studio/0.15.2"
12265
+ "User-Agent": "ZAM-Content-Studio/0.15.4"
12255
12266
  }
12256
12267
  });
12257
12268
  if (res.status >= 300 && res.status < 400) {