@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
@@ -4659,6 +4659,11 @@ var init_Pipeline = __esm({
4659
4659
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4660
4660
  */
4661
4661
  _cachedOrchestration = null;
4662
+ /**
4663
+ * Hash of the strategy docs this pipeline was assembled from (see
4664
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4665
+ */
4666
+ strategyHash;
4662
4667
  /**
4663
4668
  * Persistent tag cache. Maps cardId → tag names.
4664
4669
  *
@@ -4852,7 +4857,8 @@ var init_Pipeline = __esm({
4852
4857
  logResultCards(result);
4853
4858
  logCardProvenance(result, 3);
4854
4859
  try {
4855
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4860
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4861
+ const courseName = courseConfig?.name;
4856
4862
  const report = buildRunReport(
4857
4863
  this.course?.getCourseID() || "unknown",
4858
4864
  courseName,
@@ -4867,7 +4873,11 @@ var init_Pipeline = __esm({
4867
4873
  scoredCards,
4868
4874
  regulators
4869
4875
  );
4870
- captureRun(report);
4876
+ const versions = {
4877
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
4878
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
4879
+ };
4880
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
4871
4881
  } catch (e) {
4872
4882
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
4873
4883
  }
@@ -5364,6 +5374,36 @@ var init_Pipeline = __esm({
5364
5374
  }
5365
5375
  });
5366
5376
 
5377
+ // src/core/versionStamps.ts
5378
+ function stableStringify(value) {
5379
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
5380
+ if (value && typeof value === "object") {
5381
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
5382
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
5383
+ }
5384
+ return JSON.stringify(value);
5385
+ }
5386
+ function strategyHash(strategies) {
5387
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
5388
+ const text = strategies.map((s) => {
5389
+ const { _rev: _ignored, ...rest } = s;
5390
+ return stableStringify(rest);
5391
+ }).sort().join("\n");
5392
+ let h = 2166136261;
5393
+ for (let i = 0; i < text.length; i++) {
5394
+ h ^= text.charCodeAt(i);
5395
+ h = Math.imul(h, 16777619);
5396
+ }
5397
+ return (h >>> 0).toString(16).padStart(8, "0");
5398
+ }
5399
+ var DEFAULT_STRATEGY_HASH;
5400
+ var init_versionStamps = __esm({
5401
+ "src/core/versionStamps.ts"() {
5402
+ "use strict";
5403
+ DEFAULT_STRATEGY_HASH = "default";
5404
+ }
5405
+ });
5406
+
5367
5407
  // src/core/navigators/defaults.ts
5368
5408
  var defaults_exports = {};
5369
5409
  __export(defaults_exports, {
@@ -5416,7 +5456,9 @@ function createDefaultPipeline(user, course) {
5416
5456
  course,
5417
5457
  createDefaultEloDistanceStrategy(courseId)
5418
5458
  );
5419
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5459
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5460
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5461
+ return pipeline;
5420
5462
  }
5421
5463
  var init_defaults = __esm({
5422
5464
  "src/core/navigators/defaults.ts"() {
@@ -5428,6 +5470,7 @@ var init_defaults = __esm({
5428
5470
  init_srs();
5429
5471
  init_eloDistance();
5430
5472
  init_types_legacy();
5473
+ init_versionStamps();
5431
5474
  }
5432
5475
  });
5433
5476
 
@@ -5571,6 +5614,7 @@ var init_PipelineAssembler = __esm({
5571
5614
  init_logger();
5572
5615
  init_CompositeGenerator();
5573
5616
  init_pipelinePlan();
5617
+ init_versionStamps();
5574
5618
  PipelineAssembler = class {
5575
5619
  /**
5576
5620
  * Assembles a navigation pipeline from strategy documents.
@@ -5652,6 +5696,7 @@ var init_PipelineAssembler = __esm({
5652
5696
  }
5653
5697
  }
5654
5698
  const pipeline = new Pipeline(generator, filters, user, course);
5699
+ pipeline.strategyHash = strategyHash(strategies);
5655
5700
  logger.debug(
5656
5701
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5657
5702
  );
@@ -9103,6 +9148,7 @@ var init_SessionController = __esm({
9103
9148
  init_util2();
9104
9149
  init_navigators();
9105
9150
  init_Pipeline();
9151
+ init_versionStamps();
9106
9152
  init_SourceMixer();
9107
9153
  init_MixerDebugger();
9108
9154
  init_SessionDebugger();
@@ -10663,6 +10709,7 @@ var init_factory = __esm({
10663
10709
  init_common();
10664
10710
  init_logger();
10665
10711
  init_navigators();
10712
+ init_versionStamps();
10666
10713
  NOT_SET = "NOT_SET";
10667
10714
  ENV = {
10668
10715
  COUCHDB_SERVER_PROTOCOL: NOT_SET,