@vue-skuilder/db 0.2.33 → 0.2.34

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.
package/dist/index.d.cts CHANGED
@@ -6,7 +6,7 @@ import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-
6
6
  export { C as CardData, g as CourseListData, h as DataShapeData, a as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, d as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, T as Tag, e as TagStub, l as log } from './types-legacy-BkOYOR6U.cjs';
7
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.cjs';
8
8
  export { BulkCardProcessorConfig, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PressureGaugeDebug, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.cjs';
9
- import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
+ import { TaggedPerformance, TagFilter, DataShape, SeedMeta, CourseConfig } from '@vue-skuilder/common';
10
10
  import { S as StaticCourseManifest } from './types-D0oQeJAi.cjs';
11
11
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-D0oQeJAi.cjs';
12
12
  import { F as FileSystemAdapter } from './index-Ktg72jKb.cjs';
@@ -1460,6 +1460,7 @@ interface CustomQuestionsData {
1460
1460
  name?: string;
1461
1461
  }[];
1462
1462
  seedData?: unknown[];
1463
+ seedMeta?: (item: unknown) => SeedMeta;
1463
1464
  }[];
1464
1465
  dataShapes: DataShape[];
1465
1466
  views: {
@@ -1487,6 +1488,7 @@ interface ProcessedQuestionData {
1487
1488
  name?: string;
1488
1489
  }[];
1489
1490
  seedData?: unknown[];
1491
+ seedMeta?: (item: unknown) => SeedMeta;
1490
1492
  };
1491
1493
  dataShapes: DataShape[];
1492
1494
  views: {
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-
6
6
  export { C as CardData, g as CourseListData, h as DataShapeData, a as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, d as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, T as Tag, e as TagStub, l as log } from './types-legacy-BkOYOR6U.js';
7
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.js';
8
8
  export { BulkCardProcessorConfig, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PressureGaugeDebug, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.js';
9
- import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
+ import { TaggedPerformance, TagFilter, DataShape, SeedMeta, CourseConfig } from '@vue-skuilder/common';
10
10
  import { S as StaticCourseManifest } from './types-dXWfyz9B.js';
11
11
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-dXWfyz9B.js';
12
12
  import { F as FileSystemAdapter } from './index-CVGehe_t.js';
@@ -1460,6 +1460,7 @@ interface CustomQuestionsData {
1460
1460
  name?: string;
1461
1461
  }[];
1462
1462
  seedData?: unknown[];
1463
+ seedMeta?: (item: unknown) => SeedMeta;
1463
1464
  }[];
1464
1465
  dataShapes: DataShape[];
1465
1466
  views: {
@@ -1487,6 +1488,7 @@ interface ProcessedQuestionData {
1487
1488
  name?: string;
1488
1489
  }[];
1489
1490
  seedData?: unknown[];
1491
+ seedMeta?: (item: unknown) => SeedMeta;
1490
1492
  };
1491
1493
  dataShapes: DataShape[];
1492
1494
  views: {
package/dist/index.js CHANGED
@@ -5539,7 +5539,7 @@ var FRAMEWORK_VERSION, hostAppVersion, DEFAULT_STRATEGY_HASH;
5539
5539
  var init_versionStamps = __esm({
5540
5540
  "src/core/versionStamps.ts"() {
5541
5541
  "use strict";
5542
- FRAMEWORK_VERSION = true ? "0.2.33" : "dev";
5542
+ FRAMEWORK_VERSION = true ? "0.2.34" : "dev";
5543
5543
  DEFAULT_STRATEGY_HASH = "default";
5544
5544
  }
5545
5545
  });
@@ -8121,21 +8121,26 @@ function newQuestionInterval(user, cardHistory) {
8121
8121
  const interval = lastInterval * (0.75 + skill);
8122
8122
  cardHistory.lapses = getLapses(cardHistory.records);
8123
8123
  cardHistory.streak = getStreak(cardHistory.records);
8124
+ let ret = interval;
8124
8125
  if (cardHistory.lapses && cardHistory.streak && cardHistory.bestInterval && (cardHistory.lapses >= 0 || cardHistory.streak >= 0)) {
8125
- const ret = (cardHistory.lapses * interval + cardHistory.streak * cardHistory.bestInterval) / (cardHistory.lapses + cardHistory.streak);
8126
+ ret = (cardHistory.lapses * interval + cardHistory.streak * cardHistory.bestInterval) / (cardHistory.lapses + cardHistory.streak);
8126
8127
  logger.debug(`Weighted average interval calculation:
8127
8128
  (${cardHistory.lapses} * ${interval} + ${cardHistory.streak} * ${cardHistory.bestInterval}) / (${cardHistory.lapses} + ${cardHistory.streak}) = ${ret}`);
8128
- return ret;
8129
- } else {
8130
- return interval;
8131
8129
  }
8130
+ if (currentAttempt.fluent === false) {
8131
+ logger.debug(
8132
+ `Correct but not fluent: capping interval ${ret}s at ${SLOW_CORRECT_MAX_INTERVAL}s`
8133
+ );
8134
+ return Math.min(ret, SLOW_CORRECT_MAX_INTERVAL);
8135
+ }
8136
+ return ret;
8132
8137
  } else {
8133
8138
  return 0;
8134
8139
  }
8135
8140
  }
8136
8141
  function lastSuccessfulInterval(cardHistory) {
8137
8142
  for (let i = cardHistory.length - 1; i >= 1; i--) {
8138
- if (cardHistory[i].priorAttemps === 0 && cardHistory[i].isCorrect) {
8143
+ if (cardHistory[i].priorAttemps === 0 && cardHistory[i].isCorrect && cardHistory[i].fluent !== false) {
8139
8144
  const lastInterval = secondsBetween(cardHistory[i - 1].timeStamp, cardHistory[i].timeStamp);
8140
8145
  const ret = Math.max(lastInterval, 20 * 60 * 60);
8141
8146
  logger.debug(`Last interval w/ this card was: ${lastInterval}s, returning ${ret}s`);
@@ -8166,7 +8171,7 @@ function secondsBetween(start, end) {
8166
8171
  const ret = duration(end.diff(start)).asSeconds();
8167
8172
  return ret;
8168
8173
  }
8169
- var import_moment4, import_common14, duration;
8174
+ var import_moment4, import_common14, duration, SLOW_CORRECT_MAX_INTERVAL;
8170
8175
  var init_SpacedRepetition = __esm({
8171
8176
  "src/study/SpacedRepetition.ts"() {
8172
8177
  "use strict";
@@ -8175,6 +8180,7 @@ var init_SpacedRepetition = __esm({
8175
8180
  import_common14 = require("@vue-skuilder/common");
8176
8181
  init_logger();
8177
8182
  duration = import_moment4.default.duration;
8183
+ SLOW_CORRECT_MAX_INTERVAL = 20 * 60 * 60;
8178
8184
  }
8179
8185
  });
8180
8186
 
@@ -16826,16 +16832,20 @@ async function registerSeedData(question, courseDB, username) {
16826
16832
  if (question.questionClass.seedData && Array.isArray(question.questionClass.seedData)) {
16827
16833
  logger.info(`Registering seed data for question: ${question.name}`);
16828
16834
  try {
16829
- const seedDataPromises = question.questionClass.seedData.filter(() => question.dataShapes.length > 0).map(
16830
- (seedDataItem) => courseDB.addNote(
16831
- question.course,
16832
- question.dataShapes[0],
16833
- seedDataItem,
16834
- username,
16835
- []
16836
- )
16837
- );
16838
- await Promise.all(seedDataPromises);
16835
+ if (question.dataShapes.length > 0) {
16836
+ for (const seedDataItem of question.questionClass.seedData) {
16837
+ const meta = question.questionClass.seedMeta?.(seedDataItem) ?? {};
16838
+ await courseDB.addNote(
16839
+ question.course,
16840
+ question.dataShapes[0],
16841
+ seedDataItem,
16842
+ username,
16843
+ meta.tags ?? [],
16844
+ void 0,
16845
+ meta.elo !== void 0 ? (0, import_common28.toCourseElo)(meta.elo) : void 0
16846
+ );
16847
+ }
16848
+ }
16839
16849
  logger.info(`Seed data registered for question: ${question.name}`);
16840
16850
  } catch (error) {
16841
16851
  logger.warn(