@vue-skuilder/db 0.2.31 → 0.2.32

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 (45) 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 +8 -2
  18. package/dist/impl/couch/index.d.ts +8 -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 +5 -3
  30. package/dist/index.d.ts +5 -3
  31. package/dist/index.js +63 -4
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +63 -4
  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/tsup.config.ts +5 -0
@@ -4221,6 +4221,11 @@ var init_Pipeline = __esm({
4221
4221
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4222
4222
  */
4223
4223
  _cachedOrchestration = null;
4224
+ /**
4225
+ * Hash of the strategy docs this pipeline was assembled from (see
4226
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4227
+ */
4228
+ strategyHash;
4224
4229
  /**
4225
4230
  * Persistent tag cache. Maps cardId → tag names.
4226
4231
  *
@@ -4414,7 +4419,8 @@ var init_Pipeline = __esm({
4414
4419
  logResultCards(result);
4415
4420
  logCardProvenance(result, 3);
4416
4421
  try {
4417
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4422
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4423
+ const courseName = courseConfig?.name;
4418
4424
  const report = buildRunReport(
4419
4425
  this.course?.getCourseID() || "unknown",
4420
4426
  courseName,
@@ -4429,7 +4435,11 @@ var init_Pipeline = __esm({
4429
4435
  scoredCards,
4430
4436
  regulators
4431
4437
  );
4432
- captureRun(report);
4438
+ const versions = {
4439
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
4440
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
4441
+ };
4442
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
4433
4443
  } catch (e) {
4434
4444
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
4435
4445
  }
@@ -4926,6 +4936,36 @@ var init_Pipeline = __esm({
4926
4936
  }
4927
4937
  });
4928
4938
 
4939
+ // src/core/versionStamps.ts
4940
+ function stableStringify(value) {
4941
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
4942
+ if (value && typeof value === "object") {
4943
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
4944
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
4945
+ }
4946
+ return JSON.stringify(value);
4947
+ }
4948
+ function strategyHash(strategies) {
4949
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
4950
+ const text = strategies.map((s) => {
4951
+ const { _rev: _ignored, ...rest } = s;
4952
+ return stableStringify(rest);
4953
+ }).sort().join("\n");
4954
+ let h = 2166136261;
4955
+ for (let i = 0; i < text.length; i++) {
4956
+ h ^= text.charCodeAt(i);
4957
+ h = Math.imul(h, 16777619);
4958
+ }
4959
+ return (h >>> 0).toString(16).padStart(8, "0");
4960
+ }
4961
+ var DEFAULT_STRATEGY_HASH;
4962
+ var init_versionStamps = __esm({
4963
+ "src/core/versionStamps.ts"() {
4964
+ "use strict";
4965
+ DEFAULT_STRATEGY_HASH = "default";
4966
+ }
4967
+ });
4968
+
4929
4969
  // src/core/navigators/defaults.ts
4930
4970
  var defaults_exports = {};
4931
4971
  __export(defaults_exports, {
@@ -4978,7 +5018,9 @@ function createDefaultPipeline(user, course) {
4978
5018
  course,
4979
5019
  createDefaultEloDistanceStrategy(courseId)
4980
5020
  );
4981
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5021
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5022
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5023
+ return pipeline;
4982
5024
  }
4983
5025
  var init_defaults = __esm({
4984
5026
  "src/core/navigators/defaults.ts"() {
@@ -4990,6 +5032,7 @@ var init_defaults = __esm({
4990
5032
  init_srs();
4991
5033
  init_eloDistance();
4992
5034
  init_types_legacy();
5035
+ init_versionStamps();
4993
5036
  }
4994
5037
  });
4995
5038
 
@@ -5133,6 +5176,7 @@ var init_PipelineAssembler = __esm({
5133
5176
  init_logger();
5134
5177
  init_CompositeGenerator();
5135
5178
  init_pipelinePlan();
5179
+ init_versionStamps();
5136
5180
  PipelineAssembler = class {
5137
5181
  /**
5138
5182
  * Assembles a navigation pipeline from strategy documents.
@@ -5214,6 +5258,7 @@ var init_PipelineAssembler = __esm({
5214
5258
  }
5215
5259
  }
5216
5260
  const pipeline = new Pipeline(generator, filters, user, course);
5261
+ pipeline.strategyHash = strategyHash(strategies);
5217
5262
  logger.debug(
5218
5263
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5219
5264
  );
@@ -7716,6 +7761,7 @@ var init_SessionController = __esm({
7716
7761
  init_util2();
7717
7762
  init_navigators();
7718
7763
  init_Pipeline();
7764
+ init_versionStamps();
7719
7765
  init_SourceMixer();
7720
7766
  init_MixerDebugger();
7721
7767
  init_SessionDebugger();
@@ -9197,6 +9243,7 @@ var init_factory = __esm({
9197
9243
  init_common();
9198
9244
  init_logger();
9199
9245
  init_navigators();
9246
+ init_versionStamps();
9200
9247
  NOT_SET = "NOT_SET";
9201
9248
  ENV = {
9202
9249
  COUCHDB_SERVER_PROTOCOL: NOT_SET,