@vue-skuilder/db 0.2.36 → 0.2.37

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.
Files changed (33) hide show
  1. package/dist/core/index.cjs +91 -70
  2. package/dist/core/index.cjs.map +1 -1
  3. package/dist/core/navigators/generators/prescribed.mjs +29 -11
  4. package/dist/core/navigators/generators/prescribed.mjs.map +1 -1
  5. package/dist/core/versionStamps.mjs +1 -1
  6. package/dist/impl/common/BaseUserDB.mjs +14 -2
  7. package/dist/impl/common/BaseUserDB.mjs.map +1 -1
  8. package/dist/impl/couch/CourseSyncService.mjs +88 -10
  9. package/dist/impl/couch/CourseSyncService.mjs.map +1 -1
  10. package/dist/impl/couch/PouchDataLayerProvider.mjs +16 -1
  11. package/dist/impl/couch/PouchDataLayerProvider.mjs.map +1 -1
  12. package/dist/impl/couch/courseAPI.mjs +24 -10
  13. package/dist/impl/couch/courseAPI.mjs.map +1 -1
  14. package/dist/impl/couch/courseDB.mjs +15 -9
  15. package/dist/impl/couch/courseDB.mjs.map +1 -1
  16. package/dist/impl/couch/index.cjs +163 -62
  17. package/dist/impl/couch/index.cjs.map +1 -1
  18. package/dist/impl/couch/index.d.ts +22 -1
  19. package/dist/impl/couch/index.mjs +20 -3
  20. package/dist/impl/couch/index.mjs.map +1 -1
  21. package/dist/impl/static/index.cjs +39 -15
  22. package/dist/impl/static/index.cjs.map +1 -1
  23. package/dist/index.cjs +202 -92
  24. package/dist/index.cjs.map +1 -1
  25. package/package.json +3 -3
  26. package/src/core/navigators/generators/prescribed.ts +42 -16
  27. package/src/impl/common/BaseUserDB.ts +15 -2
  28. package/src/impl/couch/CourseSyncService.ts +130 -20
  29. package/src/impl/couch/PouchDataLayerProvider.ts +14 -1
  30. package/src/impl/couch/courseAPI.ts +26 -12
  31. package/src/impl/couch/courseDB.ts +20 -12
  32. package/src/impl/couch/index.ts +16 -5
  33. package/tests/impl/courseSync.test.ts +139 -0
@@ -4448,6 +4448,18 @@ Currently logged-in as ${this._username}.`
4448
4448
  update(id, update) {
4449
4449
  return this.updateQueue.update(id, update);
4450
4450
  }
4451
+ /**
4452
+ * Create a default doc after a 404. Concurrent first reads (e.g. two
4453
+ * components on a brand-new user) both see the 404 and both create; the
4454
+ * loser's conflict just means the doc now exists, which is what it wanted.
4455
+ */
4456
+ async putDefaultUnlessCreated(doc) {
4457
+ try {
4458
+ await this.localDB.put(doc);
4459
+ } catch (e) {
4460
+ if (e.status !== 409) throw e;
4461
+ }
4462
+ }
4451
4463
  async getCourseRegistrationsDoc() {
4452
4464
  logger.debug(`Fetching courseRegistrations for ${this.getUsername()}`);
4453
4465
  let ret;
@@ -4464,7 +4476,7 @@ Currently logged-in as ${this._username}.`
4464
4476
  `Cannot read course registrations for ${this._username}: the local mirror is unavailable (hydration state '${this._hydration.state}'). Refusing to create an empty registration doc \u2014 that would report an existing user as unregistered, and then lose to their real document once sync resumes.`
4465
4477
  );
4466
4478
  }
4467
- await this.localDB.put({
4479
+ await this.putDefaultUnlessCreated({
4468
4480
  _id: _BaseUser.DOC_IDS.COURSE_REGISTRATIONS,
4469
4481
  courses: [],
4470
4482
  studyWeight: {}
@@ -4711,7 +4723,7 @@ Currently logged-in as ${this._username}.`
4711
4723
  `Cannot read config for ${this._username}: the local mirror is unavailable (hydration state '${this._hydration.state}'). Refusing to write a default config over what may be an existing one.`
4712
4724
  );
4713
4725
  }
4714
- await this.localDB.put(defaultConfig);
4726
+ await this.putDefaultUnlessCreated(defaultConfig);
4715
4727
  return this.getConfig();
4716
4728
  } else {
4717
4729
  logger.error(`Error setting user default config:`, e);
@@ -5418,14 +5430,26 @@ async function addCard(courseID, course, id_displayable_data, id_view, elo, tags
5418
5430
  }
5419
5431
  return card;
5420
5432
  }
5433
+ function invalidateCourseConfigCache(courseID) {
5434
+ courseConfigCache.delete(courseID);
5435
+ }
5421
5436
  async function getCredentialledCourseConfig(courseID) {
5422
- try {
5437
+ const hit = courseConfigCache.get(courseID);
5438
+ if (hit && Date.now() - hit.at < COURSE_CONFIG_TTL_MS) {
5439
+ return structuredClone(await hit.config);
5440
+ }
5441
+ const config = (async () => {
5423
5442
  const db = getCourseDB(courseID);
5424
5443
  const ret = await db.get("CourseConfig");
5425
5444
  ret.courseID = courseID;
5426
- logger.info(`Returning course config: ${JSON.stringify(ret)}`);
5445
+ logger.debug(`Fetched course config for ${courseID}`);
5427
5446
  return ret;
5447
+ })();
5448
+ courseConfigCache.set(courseID, { at: Date.now(), config });
5449
+ try {
5450
+ return structuredClone(await config);
5428
5451
  } catch (e) {
5452
+ courseConfigCache.delete(courseID);
5429
5453
  logger.error(`Error fetching config for ${courseID}:`, e);
5430
5454
  throw e;
5431
5455
  }
@@ -5490,20 +5514,11 @@ function getTagID(tagName) {
5490
5514
  return tagPrefix + tagName;
5491
5515
  }
5492
5516
  }
5493
- function getCourseDB(courseID) {
5494
- const dbName = `coursedb-${courseID}`;
5495
- return new pouchdb_setup_default(
5496
- ENV.COUCHDB_SERVER_PROTOCOL + "://" + ENV.COUCHDB_SERVER_URL + dbName,
5497
- createPouchDBConfig()
5498
- );
5499
- }
5500
- var import_common6, import_common7, import_common8, import_uuid, AlreadyTaggedErr;
5517
+ var import_common6, import_common7, import_common8, import_uuid, COURSE_CONFIG_TTL_MS, courseConfigCache, AlreadyTaggedErr;
5501
5518
  var init_courseAPI = __esm({
5502
5519
  "src/impl/couch/courseAPI.ts"() {
5503
5520
  "use strict";
5504
- init_pouchdb_setup();
5505
5521
  init_couch();
5506
- init_factory();
5507
5522
  import_common6 = require("@vue-skuilder/common");
5508
5523
  import_common7 = require("@vue-skuilder/common");
5509
5524
  init_courseDB2();
@@ -5512,6 +5527,8 @@ var init_courseAPI = __esm({
5512
5527
  init_common();
5513
5528
  init_logger();
5514
5529
  import_uuid = require("uuid");
5530
+ COURSE_CONFIG_TTL_MS = 5 * 60 * 1e3;
5531
+ courseConfigCache = /* @__PURE__ */ new Map();
5515
5532
  AlreadyTaggedErr = class extends Error {
5516
5533
  constructor(message) {
5517
5534
  super(message);
@@ -6623,7 +6640,7 @@ async function getCourseQuestionTypes(courseID) {
6623
6640
  async function getCourseTagStubs(courseID) {
6624
6641
  logger.debug(`Getting tag stubs for course: ${courseID}`);
6625
6642
  const stubs = await filterAllDocsByPrefix2(
6626
- getCourseDB2(courseID),
6643
+ getCourseDB(courseID),
6627
6644
  "TAG" /* TAG */.valueOf() + "-"
6628
6645
  );
6629
6646
  stubs.rows.forEach((row) => {
@@ -6633,7 +6650,7 @@ async function getCourseTagStubs(courseID) {
6633
6650
  }
6634
6651
  async function deleteTag(courseID, tagName) {
6635
6652
  tagName = getTagID(tagName);
6636
- const courseDB = getCourseDB2(courseID);
6653
+ const courseDB = getCourseDB(courseID);
6637
6654
  const doc = await courseDB.get("TAG" /* TAG */.valueOf() + "-" + tagName);
6638
6655
  const resp = await courseDB.remove(doc);
6639
6656
  return resp;
@@ -6641,7 +6658,7 @@ async function deleteTag(courseID, tagName) {
6641
6658
  async function createTag(courseID, tagName, author) {
6642
6659
  logger.debug(`Creating tag: ${tagName}...`);
6643
6660
  const tagID = getTagID(tagName);
6644
- const courseDB = getCourseDB2(courseID);
6661
+ const courseDB = getCourseDB(courseID);
6645
6662
  const resp = await courseDB.put({
6646
6663
  course: courseID,
6647
6664
  docType: "TAG" /* TAG */,
@@ -6656,19 +6673,19 @@ async function createTag(courseID, tagName, author) {
6656
6673
  }
6657
6674
  async function updateTag(tag) {
6658
6675
  const prior = await getTag(tag.course, tag.name);
6659
- return await getCourseDB2(tag.course).put({
6676
+ return await getCourseDB(tag.course).put({
6660
6677
  ...tag,
6661
6678
  _rev: prior._rev
6662
6679
  });
6663
6680
  }
6664
6681
  async function getTag(courseID, tagName) {
6665
6682
  const tagID = getTagID(tagName);
6666
- const courseDB = getCourseDB2(courseID);
6683
+ const courseDB = getCourseDB(courseID);
6667
6684
  return courseDB.get(tagID);
6668
6685
  }
6669
6686
  async function removeTagFromCard(courseID, cardID, tagID) {
6670
6687
  tagID = getTagID(tagID);
6671
- const courseDB = getCourseDB2(courseID);
6688
+ const courseDB = getCourseDB(courseID);
6672
6689
  const tag = await courseDB.get(tagID);
6673
6690
  tag.taggedCards = tag.taggedCards.filter((taggedID) => {
6674
6691
  return cardID !== taggedID;
@@ -6687,10 +6704,10 @@ function getAncestorTagIDs(courseID, tagID) {
6687
6704
  }
6688
6705
  }
6689
6706
  async function getChildTagStubs(courseID, tagID) {
6690
- return await filterAllDocsByPrefix2(getCourseDB2(courseID), tagID + ">");
6707
+ return await filterAllDocsByPrefix2(getCourseDB(courseID), tagID + ">");
6691
6708
  }
6692
6709
  async function getAppliedTags(id_course, id_card) {
6693
- const db = getCourseDB2(id_course);
6710
+ const db = getCourseDB(id_course);
6694
6711
  const result = await db.query("getTags", {
6695
6712
  startkey: id_card,
6696
6713
  endkey: id_card
@@ -6700,7 +6717,7 @@ async function getAppliedTags(id_course, id_card) {
6700
6717
  }
6701
6718
  async function updateCardElo2(courseID, cardID, elo) {
6702
6719
  if (elo) {
6703
- const cDB = getCourseDB2(courseID);
6720
+ const cDB = getCourseDB(courseID);
6704
6721
  const card = await cDB.get(cardID);
6705
6722
  logger.debug(`Replacing ${JSON.stringify(card.elo)} with ${JSON.stringify(elo)}`);
6706
6723
  card.elo = elo;
@@ -6712,12 +6729,17 @@ async function updateCredentialledCourseConfig(courseID, config) {
6712
6729
 
6713
6730
  ${JSON.stringify(config)}
6714
6731
  `);
6715
- const db = getCourseDB2(courseID);
6732
+ const db = getCourseDB(courseID);
6733
+ invalidateCourseConfigCache(courseID);
6716
6734
  const old = await getCredentialledCourseConfig(courseID);
6717
- return await db.put({
6718
- ...config,
6719
- _rev: old._rev
6720
- });
6735
+ try {
6736
+ return await db.put({
6737
+ ...config,
6738
+ _rev: old._rev
6739
+ });
6740
+ } finally {
6741
+ invalidateCourseConfigCache(courseID);
6742
+ }
6721
6743
  }
6722
6744
  function isSuccessRow(row) {
6723
6745
  return "doc" in row && row.doc !== null && row.doc !== void 0;
@@ -6816,7 +6838,7 @@ var init_courseDB2 = __esm({
6816
6838
  */
6817
6839
  constructor(id, userLookup, localDB) {
6818
6840
  this.id = id;
6819
- const remote = getCourseDB2(this.id);
6841
+ const remote = getCourseDB(this.id);
6820
6842
  this.remoteDB = remote;
6821
6843
  this.db = localDB ?? remote;
6822
6844
  this._getCurrentUser = userLookup;
@@ -7020,12 +7042,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
7020
7042
  }
7021
7043
  }
7022
7044
  async getAppliedTags(cardId) {
7023
- const ret = await getAppliedTags(this.id, cardId);
7024
- if (ret) {
7025
- return ret;
7026
- } else {
7027
- throw new Error(`Failed to find tags for card ${this.id}-${cardId}`);
7028
- }
7045
+ return this.db.query("getTags", { startkey: cardId, endkey: cardId });
7029
7046
  }
7030
7047
  async getAppliedTagsBatch(cardIds) {
7031
7048
  if (cardIds.length === 0) {
@@ -7082,7 +7099,7 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
7082
7099
  return await updateTag(tag);
7083
7100
  }
7084
7101
  async getCourseTagStubs() {
7085
- return getCourseTagStubs(this.id);
7102
+ return filterAllDocsByPrefix2(this.db, "TAG" /* TAG */.valueOf() + "-");
7086
7103
  }
7087
7104
  async addNote(codeCourse, shape, data, author, tags, uploads, elo = (0, import_common12.blankCourseElo)()) {
7088
7105
  try {
@@ -7838,13 +7855,14 @@ var init_adminDB2 = __esm({
7838
7855
  });
7839
7856
 
7840
7857
  // src/impl/couch/CourseSyncService.ts
7841
- var DEFAULT_REPLICATION, CourseSyncService;
7858
+ var SYNC_MARKER_ID, DEFAULT_REPLICATION, CourseSyncService;
7842
7859
  var init_CourseSyncService = __esm({
7843
7860
  "src/impl/couch/CourseSyncService.ts"() {
7844
7861
  "use strict";
7845
7862
  init_pouchdb_setup();
7846
7863
  init_couch();
7847
7864
  init_logger();
7865
+ SYNC_MARKER_ID = "_local/sk-course-sync-complete";
7848
7866
  DEFAULT_REPLICATION = {
7849
7867
  batchSize: 1e3,
7850
7868
  batchesLimit: 5
@@ -7915,19 +7933,7 @@ var init_CourseSyncService = __esm({
7915
7933
  async ensureSynced(courseId, forceEnabled) {
7916
7934
  const existing = this.entries.get(courseId);
7917
7935
  if (existing?.status.state === "ready" && existing.localDB) {
7918
- const stale = await this.isLocalEpochStale(courseId, existing.localDB);
7919
- if (!stale) {
7920
- return;
7921
- }
7922
- logger.info(
7923
- `[CourseSyncService] Remote DB epoch changed for course ${courseId} \u2014 destroying stale local replica`
7924
- );
7925
- try {
7926
- await existing.localDB.destroy();
7927
- } catch {
7928
- }
7929
- existing.localDB = null;
7930
- existing.readyPromise = null;
7936
+ return;
7931
7937
  }
7932
7938
  if (existing?.status.state === "disabled") {
7933
7939
  return;
@@ -7941,9 +7947,97 @@ var init_CourseSyncService = __esm({
7941
7947
  readyPromise: null
7942
7948
  };
7943
7949
  this.entries.set(courseId, entry);
7944
- entry.readyPromise = this.performSync(courseId, entry, forceEnabled);
7950
+ entry.readyPromise = this.startSync(courseId, entry, forceEnabled);
7945
7951
  return entry.readyPromise;
7946
7952
  }
7953
+ /**
7954
+ * A replica completed on an earlier page load is ready now, refreshed in the
7955
+ * background; anything else goes through a full performSync.
7956
+ */
7957
+ async startSync(courseId, entry, forceEnabled) {
7958
+ const localDB = new pouchdb_setup_default(this.localDBName(courseId));
7959
+ if (await this.hasSyncMarker(localDB)) {
7960
+ entry.localDB = localDB;
7961
+ entry.status = { state: "ready" };
7962
+ entry.readyPromise = null;
7963
+ logger.info(
7964
+ `[CourseSyncService] Using this device's replica of course ${courseId}; refreshing in the background`
7965
+ );
7966
+ void this.refreshInBackground(courseId, entry, forceEnabled);
7967
+ return;
7968
+ }
7969
+ return this.performSync(courseId, entry, forceEnabled);
7970
+ }
7971
+ /**
7972
+ * Bring a ready replica up to date without taking it away from readers.
7973
+ * Failures leave it ready (and outdated).
7974
+ */
7975
+ async refreshInBackground(courseId, entry, forceEnabled) {
7976
+ const localDB = entry.localDB;
7977
+ try {
7978
+ if (!forceEnabled && !await this.checkLocalSyncEnabled(courseId)) {
7979
+ await this.clearSyncMarker(localDB);
7980
+ logger.info(
7981
+ `[CourseSyncService] Local sync no longer enabled for course ${courseId}; replica kept for this page only`
7982
+ );
7983
+ return;
7984
+ }
7985
+ if (await this.isLocalEpochStale(courseId, localDB)) {
7986
+ await this.clearSyncMarker(localDB);
7987
+ logger.info(
7988
+ `[CourseSyncService] Remote DB recreated for course ${courseId}: keeping the outdated replica for this page; it is rebuilt on the next page load`
7989
+ );
7990
+ return;
7991
+ }
7992
+ const start = Date.now();
7993
+ const result = await this.replicate(this.getRemoteDB(courseId), localDB);
7994
+ const syncTimeMs = Date.now() - start;
7995
+ const warmStart = Date.now();
7996
+ await this.warmViewIndices(localDB);
7997
+ const viewWarmTimeMs = Date.now() - warmStart;
7998
+ await this.writeSyncMarker(localDB);
7999
+ entry.status = {
8000
+ state: "ready",
8001
+ docsReplicated: result.docs_written,
8002
+ syncTimeMs,
8003
+ viewWarmTimeMs
8004
+ };
8005
+ logger.info(
8006
+ `[CourseSyncService] Background refresh of course ${courseId}: ${result.docs_written} docs in ${syncTimeMs}ms, views ${viewWarmTimeMs}ms`
8007
+ );
8008
+ } catch (e) {
8009
+ logger.warn(
8010
+ `[CourseSyncService] Background refresh of course ${courseId} failed; replica kept as is: ${e}`
8011
+ );
8012
+ }
8013
+ }
8014
+ async hasSyncMarker(localDB) {
8015
+ try {
8016
+ await localDB.get(SYNC_MARKER_ID);
8017
+ return true;
8018
+ } catch {
8019
+ return false;
8020
+ }
8021
+ }
8022
+ async writeSyncMarker(localDB) {
8023
+ try {
8024
+ let _rev;
8025
+ try {
8026
+ _rev = (await localDB.get(SYNC_MARKER_ID))._rev;
8027
+ } catch {
8028
+ }
8029
+ await localDB.put({ _id: SYNC_MARKER_ID, _rev, completedAt: (/* @__PURE__ */ new Date()).toISOString() });
8030
+ } catch (e) {
8031
+ logger.warn(`[CourseSyncService] Could not write sync marker: ${e}`);
8032
+ }
8033
+ }
8034
+ async clearSyncMarker(localDB) {
8035
+ try {
8036
+ const marker = await localDB.get(SYNC_MARKER_ID);
8037
+ await localDB.remove(marker);
8038
+ } catch {
8039
+ }
8040
+ }
7947
8041
  /**
7948
8042
  * Get the local PouchDB for a course, or null if not available.
7949
8043
  *
@@ -8018,6 +8112,7 @@ var init_CourseSyncService = __esm({
8018
8112
  logger.info(
8019
8113
  `[CourseSyncService] View indices warmed for course ${courseId} in ${viewWarmTimeMs}ms`
8020
8114
  );
8115
+ await this.writeSyncMarker(localDB);
8021
8116
  entry.status = {
8022
8117
  state: "ready",
8023
8118
  docsReplicated: result.docs_written,
@@ -8122,7 +8217,7 @@ var init_CourseSyncService = __esm({
8122
8217
  * Get a remote PouchDB handle for a course.
8123
8218
  */
8124
8219
  getRemoteDB(courseId) {
8125
- return getCourseDB2(courseId);
8220
+ return getCourseDB(courseId);
8126
8221
  }
8127
8222
  /**
8128
8223
  * Local DB naming convention.
@@ -8521,7 +8616,7 @@ __export(couch_exports, {
8521
8616
  getClassroomConfig: () => getClassroomConfig,
8522
8617
  getClassroomDB: () => getClassroomDB,
8523
8618
  getCouchUserDB: () => getCouchUserDB,
8524
- getCourseDB: () => getCourseDB2,
8619
+ getCourseDB: () => getCourseDB,
8525
8620
  getCourseDataShapes: () => getCourseDataShapes,
8526
8621
  getCourseDoc: () => getCourseDoc,
8527
8622
  getCourseDocs: () => getCourseDocs,
@@ -8536,6 +8631,7 @@ __export(couch_exports, {
8536
8631
  getTag: () => getTag,
8537
8632
  getTagID: () => getTagID,
8538
8633
  hexEncode: () => hexEncode,
8634
+ invalidateCourseConfigCache: () => invalidateCourseConfigCache,
8539
8635
  isReview: () => isReview,
8540
8636
  localUserDB: () => localUserDB,
8541
8637
  removeTagFromCard: () => removeTagFromCard,
@@ -8572,11 +8668,14 @@ function getCouchDB(dbName) {
8572
8668
  createPouchDBConfig()
8573
8669
  );
8574
8670
  }
8575
- function getCourseDB2(courseID) {
8576
- return new pouchdb_setup_default(
8577
- ENV.COUCHDB_SERVER_PROTOCOL + "://" + ENV.COUCHDB_SERVER_URL + "coursedb-" + courseID,
8578
- createPouchDBConfig()
8579
- );
8671
+ function getCourseDB(courseID) {
8672
+ const url = ENV.COUCHDB_SERVER_PROTOCOL + "://" + ENV.COUCHDB_SERVER_URL + "coursedb-" + courseID;
8673
+ let db = courseDBHandles.get(url);
8674
+ if (!db) {
8675
+ db = new pouchdb_setup_default(url, { ...createPouchDBConfig(), skip_setup: true });
8676
+ courseDBHandles.set(url, db);
8677
+ }
8678
+ return db;
8580
8679
  }
8581
8680
  async function getLatestVersion() {
8582
8681
  try {
@@ -8621,13 +8720,13 @@ function updateGuestAccountExpirationDate2(guestDB) {
8621
8720
  });
8622
8721
  }
8623
8722
  function getCourseDocs(courseID, docIDs, options = {}) {
8624
- return getCourseDB2(courseID).allDocs({
8723
+ return getCourseDB(courseID).allDocs({
8625
8724
  ...options,
8626
8725
  keys: docIDs
8627
8726
  });
8628
8727
  }
8629
8728
  function getCourseDoc(courseID, docID, options = {}) {
8630
- return getCourseDB2(courseID).get(docID, options);
8729
+ return getCourseDB(courseID).get(docID, options);
8631
8730
  }
8632
8731
  async function getRandomCards(courseIDs) {
8633
8732
  if (courseIDs.length === 0) {
@@ -8636,7 +8735,7 @@ async function getRandomCards(courseIDs) {
8636
8735
  } else {
8637
8736
  const courseResults = await Promise.all(
8638
8737
  courseIDs.map((course) => {
8639
- return getCourseDB2(course).find({
8738
+ return getCourseDB(course).find({
8640
8739
  selector: {
8641
8740
  docType: "CARD" /* CARD */
8642
8741
  },
@@ -8697,7 +8796,7 @@ function getStartAndEndKeys2(key) {
8697
8796
  endkey: key + "\uFFF0"
8698
8797
  };
8699
8798
  }
8700
- var import_cross_fetch2, import_moment8, expiryDocID, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT2;
8799
+ var import_cross_fetch2, import_moment8, expiryDocID, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, courseDBHandles, REVIEW_TIME_FORMAT2;
8701
8800
  var init_couch = __esm({
8702
8801
  "src/impl/couch/index.ts"() {
8703
8802
  init_factory();
@@ -8723,6 +8822,7 @@ var init_couch = __esm({
8723
8822
  return pouchdb_setup_default.fetch(url, opts);
8724
8823
  }
8725
8824
  };
8825
+ courseDBHandles = /* @__PURE__ */ new Map();
8726
8826
  REVIEW_TIME_FORMAT2 = "YYYY-MM-DD--kk:mm:ss-SSS";
8727
8827
  }
8728
8828
  });
@@ -8766,6 +8866,7 @@ init_couch();
8766
8866
  getTag,
8767
8867
  getTagID,
8768
8868
  hexEncode,
8869
+ invalidateCourseConfigCache,
8769
8870
  isReview,
8770
8871
  localUserDB,
8771
8872
  removeTagFromCard,