@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
package/dist/index.mjs CHANGED
@@ -4770,6 +4770,11 @@ var init_Pipeline = __esm({
4770
4770
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4771
4771
  */
4772
4772
  _cachedOrchestration = null;
4773
+ /**
4774
+ * Hash of the strategy docs this pipeline was assembled from (see
4775
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4776
+ */
4777
+ strategyHash;
4773
4778
  /**
4774
4779
  * Persistent tag cache. Maps cardId → tag names.
4775
4780
  *
@@ -4963,7 +4968,8 @@ var init_Pipeline = __esm({
4963
4968
  logResultCards(result);
4964
4969
  logCardProvenance(result, 3);
4965
4970
  try {
4966
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4971
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4972
+ const courseName = courseConfig?.name;
4967
4973
  const report = buildRunReport(
4968
4974
  this.course?.getCourseID() || "unknown",
4969
4975
  courseName,
@@ -4978,7 +4984,11 @@ var init_Pipeline = __esm({
4978
4984
  scoredCards,
4979
4985
  regulators
4980
4986
  );
4981
- captureRun(report);
4987
+ const versions = {
4988
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
4989
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
4990
+ };
4991
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
4982
4992
  } catch (e) {
4983
4993
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
4984
4994
  }
@@ -5475,6 +5485,43 @@ var init_Pipeline = __esm({
5475
5485
  }
5476
5486
  });
5477
5487
 
5488
+ // src/core/versionStamps.ts
5489
+ function setAppVersion(version) {
5490
+ hostAppVersion = version;
5491
+ }
5492
+ function sessionVersions() {
5493
+ return { framework: FRAMEWORK_VERSION, ...hostAppVersion ? { app: hostAppVersion } : {} };
5494
+ }
5495
+ function stableStringify(value) {
5496
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
5497
+ if (value && typeof value === "object") {
5498
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
5499
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
5500
+ }
5501
+ return JSON.stringify(value);
5502
+ }
5503
+ function strategyHash(strategies) {
5504
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
5505
+ const text = strategies.map((s) => {
5506
+ const { _rev: _ignored, ...rest } = s;
5507
+ return stableStringify(rest);
5508
+ }).sort().join("\n");
5509
+ let h = 2166136261;
5510
+ for (let i = 0; i < text.length; i++) {
5511
+ h ^= text.charCodeAt(i);
5512
+ h = Math.imul(h, 16777619);
5513
+ }
5514
+ return (h >>> 0).toString(16).padStart(8, "0");
5515
+ }
5516
+ var FRAMEWORK_VERSION, hostAppVersion, DEFAULT_STRATEGY_HASH;
5517
+ var init_versionStamps = __esm({
5518
+ "src/core/versionStamps.ts"() {
5519
+ "use strict";
5520
+ FRAMEWORK_VERSION = true ? "0.2.32" : "dev";
5521
+ DEFAULT_STRATEGY_HASH = "default";
5522
+ }
5523
+ });
5524
+
5478
5525
  // src/core/navigators/defaults.ts
5479
5526
  var defaults_exports = {};
5480
5527
  __export(defaults_exports, {
@@ -5527,7 +5574,9 @@ function createDefaultPipeline(user, course) {
5527
5574
  course,
5528
5575
  createDefaultEloDistanceStrategy(courseId)
5529
5576
  );
5530
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5577
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5578
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5579
+ return pipeline;
5531
5580
  }
5532
5581
  var init_defaults = __esm({
5533
5582
  "src/core/navigators/defaults.ts"() {
@@ -5539,6 +5588,7 @@ var init_defaults = __esm({
5539
5588
  init_srs();
5540
5589
  init_eloDistance();
5541
5590
  init_types_legacy();
5591
+ init_versionStamps();
5542
5592
  }
5543
5593
  });
5544
5594
 
@@ -5682,6 +5732,7 @@ var init_PipelineAssembler = __esm({
5682
5732
  init_logger();
5683
5733
  init_CompositeGenerator();
5684
5734
  init_pipelinePlan();
5735
+ init_versionStamps();
5685
5736
  PipelineAssembler = class {
5686
5737
  /**
5687
5738
  * Assembles a navigation pipeline from strategy documents.
@@ -5763,6 +5814,7 @@ var init_PipelineAssembler = __esm({
5763
5814
  }
5764
5815
  }
5765
5816
  const pipeline = new Pipeline(generator, filters, user, course);
5817
+ pipeline.strategyHash = strategyHash(strategies);
5766
5818
  logger.debug(
5767
5819
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5768
5820
  );
@@ -11699,6 +11751,7 @@ var init_SessionController = __esm({
11699
11751
  init_util2();
11700
11752
  init_navigators();
11701
11753
  init_Pipeline();
11754
+ init_versionStamps();
11702
11755
  init_SourceMixer();
11703
11756
  init_MixerDebugger();
11704
11757
  init_SessionDebugger();
@@ -11997,7 +12050,8 @@ var init_SessionController = __esm({
11997
12050
  ...run.discardedTail ? { discardedTail: run.discardedTail } : {},
11998
12051
  cards: persistedRunCards(run),
11999
12052
  ...run.unselectedNew ? { unselectedNew: persistedUnselectedNew(run.unselectedNew) } : {},
12000
- ...run.regulators ? { regulators: run.regulators.map(persistedReading) } : {}
12053
+ ...run.regulators ? { regulators: run.regulators.map(persistedReading) } : {},
12054
+ ...run.versions ? { versions: run.versions } : {}
12001
12055
  });
12002
12056
  }
12003
12057
  }
@@ -12034,6 +12088,7 @@ var init_SessionController = __esm({
12034
12088
  sourceCount: this.sources.length,
12035
12089
  initHints: this._sessionHints
12036
12090
  },
12091
+ versions: sessionVersions(),
12037
12092
  initialQueues: { supplyQ: this.supplyQ.length, failedQ: this.failedQ.length },
12038
12093
  runs: [...this._runLog],
12039
12094
  stateAtStart: await this._captureState("start")
@@ -15740,6 +15795,9 @@ async function initializeDataLayer(config) {
15740
15795
  if (config.options.localStoragePrefix) {
15741
15796
  ENV.LOCAL_STORAGE_PREFIX = config.options.localStoragePrefix;
15742
15797
  }
15798
+ if (config.options.appVersion) {
15799
+ setAppVersion(config.options.appVersion);
15800
+ }
15743
15801
  if (config.type === "couch") {
15744
15802
  if (!config.options.COUCHDB_SERVER_URL || !config.options.COUCHDB_SERVER_PROTOCOL) {
15745
15803
  throw new Error("Missing CouchDB server URL or protocol");
@@ -15796,6 +15854,7 @@ var init_factory = __esm({
15796
15854
  init_common();
15797
15855
  init_logger();
15798
15856
  init_navigators();
15857
+ init_versionStamps();
15799
15858
  NOT_SET = "NOT_SET";
15800
15859
  ENV = {
15801
15860
  COUCHDB_SERVER_PROTOCOL: NOT_SET,