@vue-skuilder/db 0.2.31 → 0.2.33

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 (46) hide show
  1. package/dist/{contentSource-Doh1aVBJ.d.cts → contentSource-CTQ4kWhR.d.cts} +22 -0
  2. package/dist/{contentSource-DMduBjDC.d.ts → contentSource-JmWYu8IK.d.ts} +22 -0
  3. package/dist/core/index.d.cts +3 -3
  4. package/dist/core/index.d.ts +3 -3
  5. package/dist/core/index.js +50 -3
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +50 -3
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-BW1CBAbb.d.cts → dataLayerProvider-DfI_KYAe.d.cts} +1 -1
  10. package/dist/{dataLayerProvider-Cxfe4nSK.d.ts → dataLayerProvider-rlLE2Mf-.d.ts} +1 -1
  11. package/dist/diagnostics/index.d.cts +2 -2
  12. package/dist/diagnostics/index.d.ts +2 -2
  13. package/dist/diagnostics/index.js +12 -0
  14. package/dist/diagnostics/index.js.map +1 -1
  15. package/dist/diagnostics/index.mjs +12 -0
  16. package/dist/diagnostics/index.mjs.map +1 -1
  17. package/dist/impl/couch/index.d.cts +17 -2
  18. package/dist/impl/couch/index.d.ts +17 -2
  19. package/dist/impl/couch/index.js +50 -3
  20. package/dist/impl/couch/index.js.map +1 -1
  21. package/dist/impl/couch/index.mjs +50 -3
  22. package/dist/impl/couch/index.mjs.map +1 -1
  23. package/dist/impl/static/index.d.cts +2 -2
  24. package/dist/impl/static/index.d.ts +2 -2
  25. package/dist/impl/static/index.js +50 -3
  26. package/dist/impl/static/index.js.map +1 -1
  27. package/dist/impl/static/index.mjs +50 -3
  28. package/dist/impl/static/index.mjs.map +1 -1
  29. package/dist/index.d.cts +14 -3
  30. package/dist/index.d.ts +14 -3
  31. package/dist/index.js +101 -8
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +101 -8
  34. package/dist/index.mjs.map +1 -1
  35. package/package.json +3 -3
  36. package/src/core/navigators/Pipeline.ts +13 -2
  37. package/src/core/navigators/PipelineAssembler.ts +2 -0
  38. package/src/core/navigators/PipelineDebugger.ts +12 -0
  39. package/src/core/navigators/defaults.ts +4 -1
  40. package/src/core/types/studySession.ts +11 -1
  41. package/src/core/versionStamps.ts +66 -0
  42. package/src/diagnostics/text.ts +13 -0
  43. package/src/factory.ts +6 -0
  44. package/src/study/SessionController.ts +3 -0
  45. package/src/study/services/EloService.ts +49 -4
  46. package/tsup.config.ts +5 -0
@@ -1,6 +1,6 @@
1
1
  import { C as ClassroomDBInterface, A as AdminDBInterface } from '../../classroomDB-DLTtLZct.cjs';
2
- import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, k as CourseInfo, l as StudySessionItem, D as DataLayerResult, b as ContentNavigationStrategyData, m as ContentNavigator, n as ReplanHints, G as GeneratorResult } from '../../contentSource-Doh1aVBJ.cjs';
3
- import { D as DataLayerProvider } from '../../dataLayerProvider-BW1CBAbb.cjs';
2
+ import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, k as CourseInfo, l as StudySessionItem, D as DataLayerResult, b as ContentNavigationStrategyData, m as ContentNavigator, n as ReplanHints, G as GeneratorResult } from '../../contentSource-CTQ4kWhR.cjs';
3
+ import { D as DataLayerProvider } from '../../dataLayerProvider-DfI_KYAe.cjs';
4
4
  import { S as StaticCourseManifest } from '../../types-D0oQeJAi.cjs';
5
5
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
6
6
  import { S as SkuilderCourseData, d as QualifiedCardID, e as TagStub, T as Tag } from '../../types-legacy-BkOYOR6U.cjs';
@@ -1,6 +1,6 @@
1
1
  import { C as ClassroomDBInterface, A as AdminDBInterface } from '../../classroomDB-DLTtLZct.js';
2
- import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, k as CourseInfo, l as StudySessionItem, D as DataLayerResult, b as ContentNavigationStrategyData, m as ContentNavigator, n as ReplanHints, G as GeneratorResult } from '../../contentSource-DMduBjDC.js';
3
- import { D as DataLayerProvider } from '../../dataLayerProvider-Cxfe4nSK.js';
2
+ import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, k as CourseInfo, l as StudySessionItem, D as DataLayerResult, b as ContentNavigationStrategyData, m as ContentNavigator, n as ReplanHints, G as GeneratorResult } from '../../contentSource-JmWYu8IK.js';
3
+ import { D as DataLayerProvider } from '../../dataLayerProvider-rlLE2Mf-.js';
4
4
  import { S as StaticCourseManifest } from '../../types-dXWfyz9B.js';
5
5
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
6
6
  import { S as SkuilderCourseData, d as QualifiedCardID, e as TagStub, T as Tag } from '../../types-legacy-BkOYOR6U.js';
@@ -4244,6 +4244,11 @@ var init_Pipeline = __esm({
4244
4244
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4245
4245
  */
4246
4246
  _cachedOrchestration = null;
4247
+ /**
4248
+ * Hash of the strategy docs this pipeline was assembled from (see
4249
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4250
+ */
4251
+ strategyHash;
4247
4252
  /**
4248
4253
  * Persistent tag cache. Maps cardId → tag names.
4249
4254
  *
@@ -4437,7 +4442,8 @@ var init_Pipeline = __esm({
4437
4442
  logResultCards(result);
4438
4443
  logCardProvenance(result, 3);
4439
4444
  try {
4440
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4445
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4446
+ const courseName = courseConfig?.name;
4441
4447
  const report = buildRunReport(
4442
4448
  this.course?.getCourseID() || "unknown",
4443
4449
  courseName,
@@ -4452,7 +4458,11 @@ var init_Pipeline = __esm({
4452
4458
  scoredCards,
4453
4459
  regulators
4454
4460
  );
4455
- captureRun(report);
4461
+ const versions = {
4462
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
4463
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
4464
+ };
4465
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
4456
4466
  } catch (e) {
4457
4467
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
4458
4468
  }
@@ -4949,6 +4959,36 @@ var init_Pipeline = __esm({
4949
4959
  }
4950
4960
  });
4951
4961
 
4962
+ // src/core/versionStamps.ts
4963
+ function stableStringify(value) {
4964
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
4965
+ if (value && typeof value === "object") {
4966
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
4967
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
4968
+ }
4969
+ return JSON.stringify(value);
4970
+ }
4971
+ function strategyHash(strategies) {
4972
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
4973
+ const text = strategies.map((s) => {
4974
+ const { _rev: _ignored, ...rest } = s;
4975
+ return stableStringify(rest);
4976
+ }).sort().join("\n");
4977
+ let h = 2166136261;
4978
+ for (let i = 0; i < text.length; i++) {
4979
+ h ^= text.charCodeAt(i);
4980
+ h = Math.imul(h, 16777619);
4981
+ }
4982
+ return (h >>> 0).toString(16).padStart(8, "0");
4983
+ }
4984
+ var DEFAULT_STRATEGY_HASH;
4985
+ var init_versionStamps = __esm({
4986
+ "src/core/versionStamps.ts"() {
4987
+ "use strict";
4988
+ DEFAULT_STRATEGY_HASH = "default";
4989
+ }
4990
+ });
4991
+
4952
4992
  // src/core/navigators/defaults.ts
4953
4993
  var defaults_exports = {};
4954
4994
  __export(defaults_exports, {
@@ -5001,7 +5041,9 @@ function createDefaultPipeline(user, course) {
5001
5041
  course,
5002
5042
  createDefaultEloDistanceStrategy(courseId)
5003
5043
  );
5004
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5044
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5045
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5046
+ return pipeline;
5005
5047
  }
5006
5048
  var init_defaults = __esm({
5007
5049
  "src/core/navigators/defaults.ts"() {
@@ -5013,6 +5055,7 @@ var init_defaults = __esm({
5013
5055
  init_srs();
5014
5056
  init_eloDistance();
5015
5057
  init_types_legacy();
5058
+ init_versionStamps();
5016
5059
  }
5017
5060
  });
5018
5061
 
@@ -5156,6 +5199,7 @@ var init_PipelineAssembler = __esm({
5156
5199
  init_logger();
5157
5200
  init_CompositeGenerator();
5158
5201
  init_pipelinePlan();
5202
+ init_versionStamps();
5159
5203
  PipelineAssembler = class {
5160
5204
  /**
5161
5205
  * Assembles a navigation pipeline from strategy documents.
@@ -5237,6 +5281,7 @@ var init_PipelineAssembler = __esm({
5237
5281
  }
5238
5282
  }
5239
5283
  const pipeline = new Pipeline(generator, filters, user, course);
5284
+ pipeline.strategyHash = strategyHash(strategies);
5240
5285
  logger.debug(
5241
5286
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5242
5287
  );
@@ -7733,6 +7778,7 @@ var init_SessionController = __esm({
7733
7778
  init_util2();
7734
7779
  init_navigators();
7735
7780
  init_Pipeline();
7781
+ init_versionStamps();
7736
7782
  init_SourceMixer();
7737
7783
  init_MixerDebugger();
7738
7784
  init_SessionDebugger();
@@ -9215,6 +9261,7 @@ var init_factory = __esm({
9215
9261
  init_common();
9216
9262
  init_logger();
9217
9263
  init_navigators();
9264
+ init_versionStamps();
9218
9265
  NOT_SET = "NOT_SET";
9219
9266
  ENV = {
9220
9267
  COUCHDB_SERVER_PROTOCOL: NOT_SET,