@vue-skuilder/db 0.2.30 → 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 (51) hide show
  1. package/dist/{contentSource-B6FrSihy.d.cts → contentSource-CTQ4kWhR.d.cts} +41 -4
  2. package/dist/{contentSource-CqJmbOZN.d.ts → contentSource-JmWYu8IK.d.ts} +41 -4
  3. package/dist/core/index.d.cts +3 -3
  4. package/dist/core/index.d.ts +3 -3
  5. package/dist/core/index.js +138 -79
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +90 -30
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-DUxDqMtZ.d.cts → dataLayerProvider-DfI_KYAe.d.cts} +1 -1
  10. package/dist/{dataLayerProvider-B9_UCvkR.d.ts → dataLayerProvider-rlLE2Mf-.d.ts} +1 -1
  11. package/dist/diagnostics/index.d.cts +18 -3
  12. package/dist/diagnostics/index.d.ts +18 -3
  13. package/dist/diagnostics/index.js +171 -135
  14. package/dist/diagnostics/index.js.map +1 -1
  15. package/dist/diagnostics/index.mjs +168 -135
  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 +142 -83
  20. package/dist/impl/couch/index.js.map +1 -1
  21. package/dist/impl/couch/index.mjs +90 -30
  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 +129 -70
  26. package/dist/impl/static/index.js.map +1 -1
  27. package/dist/impl/static/index.mjs +90 -30
  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 +204 -114
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +128 -37
  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 +54 -23
  39. package/src/core/navigators/defaults.ts +4 -1
  40. package/src/core/navigators/filters/eloDistance.ts +7 -8
  41. package/src/core/navigators/generators/elo.ts +8 -2
  42. package/src/core/navigators/generators/prescribed.ts +7 -5
  43. package/src/core/types/studySession.ts +23 -2
  44. package/src/core/versionStamps.ts +66 -0
  45. package/src/diagnostics/derive.ts +5 -2
  46. package/src/diagnostics/pipeline.ts +28 -0
  47. package/src/diagnostics/text.ts +24 -4
  48. package/src/factory.ts +6 -0
  49. package/src/study/SessionController.ts +6 -1
  50. package/src/study/services/EloService.ts +33 -6
  51. package/tsup.config.ts +5 -0
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  adjustCourseScores,
3
3
  adjustCourseScoresPerTag,
4
+ isCountOnlyTag,
4
5
  toCourseElo,
5
6
  TaggedPerformance,
6
7
  } from '@vue-skuilder/common';
@@ -14,6 +15,28 @@ import { StudySessionRecord } from '../SessionController';
14
15
  import { logger } from '@db/util/logger';
15
16
  import { recordTagPresentations } from './tagRecent';
16
17
 
18
+ /**
19
+ * The question's performance with bookkeeping-role tags (`expose`, `intro`;
20
+ * see common's tagRoles.ts) as count-only. A score sent for one is counted,
21
+ * not graded, and logged: it's a question-side slip against the convention.
22
+ */
23
+ function withCountOnlyRoles(perf: TaggedPerformance, cardId: string): TaggedPerformance {
24
+ const out: TaggedPerformance = { ...perf };
25
+ const counted: string[] = [];
26
+ for (const [tag, score] of Object.entries(perf)) {
27
+ if (tag === '_global' || score === null || !isCountOnlyTag(tag)) continue;
28
+ out[tag] = null;
29
+ counted.push(tag);
30
+ }
31
+ if (counted.length) {
32
+ logger.warn(
33
+ `[EloService] ${cardId} sent scores for bookkeeping tags [${counted.join(', ')}]; ` +
34
+ `counted, not graded`
35
+ );
36
+ }
37
+ return out;
38
+ }
39
+
17
40
  /**
18
41
  * Service responsible for ELO rating calculations and updates.
19
42
  */
@@ -77,10 +100,12 @@ export class EloService {
77
100
 
78
101
  const tags: NonNullable<SessionEloEvent['tags']> = {};
79
102
  for (const tag of cardTagKeys) {
103
+ // Bookkeeping roles are only counted: recorded as count-only, as below.
104
+ const countOnly = isCountOnlyTag(tag);
80
105
  tags[tag] = {
81
106
  before: beforeUserTag[tag],
82
- after: eloUpdate.userElo.tags[tag].score,
83
- score: userScore,
107
+ after: countOnly ? beforeUserTag[tag] : eloUpdate.userElo.tags[tag].score,
108
+ score: countOnly ? null : userScore,
84
109
  };
85
110
  }
86
111
  const event: SessionEloEvent = {
@@ -174,13 +199,15 @@ export class EloService {
174
199
  // the question's evaluate(). Category tags (concept:*, ui:*, etc.) are not
175
200
  // emitted by individual question types; applying the global score as a proxy
176
201
  // keeps hierarchy filter ELO thresholds functional without overriding any
177
- // fine-grained per-GPC scores the question already provided.
202
+ // fine-grained per-GPC scores the question already provided. Bookkeeping
203
+ // roles (expose, intro) are counted instead, whoever supplies them.
178
204
  const cardTags = cardTagsMap.get(card_id) ?? [];
179
- const enriched: TaggedPerformance = { ...taggedPerformance };
205
+ const graded = withCountOnlyRoles(taggedPerformance, card_id);
206
+ const enriched: TaggedPerformance = { ...graded };
180
207
  const globalScore = taggedPerformance._global;
181
208
  for (const tag of cardTags) {
182
209
  if (!(tag in enriched)) {
183
- enriched[tag] = globalScore;
210
+ enriched[tag] = isCountOnlyTag(tag) ? null : globalScore;
184
211
  }
185
212
  }
186
213
 
@@ -207,7 +234,7 @@ export class EloService {
207
234
  // enriched with the global score above.
208
235
  const recorded = recordTagPresentations(
209
236
  eloUpdate.userElo,
210
- taggedPerformance,
237
+ graded,
211
238
  currentCard.records,
212
239
  card_id,
213
240
  at
package/tsup.config.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { readFileSync } from 'node:fs';
1
2
  import { defineConfig } from 'tsup';
2
3
 
4
+ const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8'));
5
+
3
6
  export default defineConfig({
4
7
  entry: [
5
8
  'src/index.ts',
@@ -15,6 +18,8 @@ export default defineConfig({
15
18
  splitting: false,
16
19
  sourcemap: true,
17
20
  clean: true,
21
+ // Session records stamp the framework version (core/versionStamps.ts).
22
+ define: { __SKUILDER_DB_VERSION__: JSON.stringify(version) },
18
23
  outExtension: ({ format }) => ({
19
24
  js: format === 'esm' ? '.mjs' : '.js',
20
25
  }),