@vue-skuilder/db 0.1.4 → 0.1.6

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 (83) hide show
  1. package/CLAUDE.md +43 -0
  2. package/dist/SyncStrategy-DnJRj-Xp.d.mts +74 -0
  3. package/dist/SyncStrategy-DnJRj-Xp.d.ts +74 -0
  4. package/dist/core/index.d.mts +90 -2
  5. package/dist/core/index.d.ts +90 -2
  6. package/dist/core/index.js +856 -6155
  7. package/dist/core/index.js.map +1 -1
  8. package/dist/core/index.mjs +778 -6097
  9. package/dist/core/index.mjs.map +1 -1
  10. package/dist/dataLayerProvider-BZmLyBVw.d.mts +41 -0
  11. package/dist/dataLayerProvider-BuntXkCs.d.ts +41 -0
  12. package/dist/impl/couch/index.d.mts +292 -0
  13. package/dist/impl/couch/index.d.ts +292 -0
  14. package/dist/impl/couch/index.js +3075 -0
  15. package/dist/impl/couch/index.js.map +1 -0
  16. package/dist/impl/couch/index.mjs +3007 -0
  17. package/dist/impl/couch/index.mjs.map +1 -0
  18. package/dist/impl/static/index.d.mts +188 -0
  19. package/dist/impl/static/index.d.ts +188 -0
  20. package/dist/impl/static/index.js +3055 -0
  21. package/dist/impl/static/index.js.map +1 -0
  22. package/dist/impl/static/index.mjs +3025 -0
  23. package/dist/impl/static/index.mjs.map +1 -0
  24. package/dist/index.d.mts +13 -4
  25. package/dist/index.d.ts +13 -4
  26. package/dist/index.js +2920 -6846
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +3567 -7513
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/types-D6SnlHPm.d.ts +58 -0
  31. package/dist/types-DPRvCrIk.d.mts +58 -0
  32. package/dist/types-legacy-WPe8CtO-.d.mts +139 -0
  33. package/dist/types-legacy-WPe8CtO-.d.ts +139 -0
  34. package/dist/{index-QMtzQI65.d.mts → userDB-31gsvxyd.d.mts} +11 -252
  35. package/dist/{index-QMtzQI65.d.ts → userDB-D9EuWTp1.d.ts} +11 -252
  36. package/dist/util/packer/index.d.mts +65 -0
  37. package/dist/util/packer/index.d.ts +65 -0
  38. package/dist/util/packer/index.js +512 -0
  39. package/dist/util/packer/index.js.map +1 -0
  40. package/dist/util/packer/index.mjs +485 -0
  41. package/dist/util/packer/index.mjs.map +1 -0
  42. package/package.json +12 -2
  43. package/src/core/interfaces/contentSource.ts +8 -6
  44. package/src/core/interfaces/courseDB.ts +1 -1
  45. package/src/core/interfaces/dataLayerProvider.ts +5 -0
  46. package/src/core/interfaces/userDB.ts +7 -2
  47. package/src/core/types/types-legacy.ts +2 -0
  48. package/src/factory.ts +10 -7
  49. package/src/impl/{pouch/userDB.ts → common/BaseUserDB.ts} +283 -260
  50. package/src/impl/common/SyncStrategy.ts +90 -0
  51. package/src/impl/common/index.ts +23 -0
  52. package/src/impl/common/types.ts +50 -0
  53. package/src/impl/common/userDBHelpers.ts +144 -0
  54. package/src/impl/couch/CouchDBSyncStrategy.ts +209 -0
  55. package/src/impl/{pouch → couch}/PouchDataLayerProvider.ts +16 -7
  56. package/src/impl/{pouch → couch}/adminDB.ts +3 -3
  57. package/src/impl/{pouch → couch}/auth.ts +2 -2
  58. package/src/impl/{pouch → couch}/classroomDB.ts +6 -6
  59. package/src/impl/{pouch → couch}/courseAPI.ts +59 -21
  60. package/src/impl/{pouch → couch}/courseDB.ts +32 -17
  61. package/src/impl/{pouch → couch}/courseLookupDB.ts +1 -1
  62. package/src/impl/{pouch → couch}/index.ts +27 -20
  63. package/src/impl/{pouch → couch}/updateQueue.ts +5 -1
  64. package/src/impl/{pouch → couch}/user-course-relDB.ts +6 -1
  65. package/src/impl/static/NoOpSyncStrategy.ts +70 -0
  66. package/src/impl/static/StaticDataLayerProvider.ts +93 -0
  67. package/src/impl/static/StaticDataUnpacker.ts +549 -0
  68. package/src/impl/static/courseDB.ts +275 -0
  69. package/src/impl/static/coursesDB.ts +37 -0
  70. package/src/impl/static/index.ts +7 -0
  71. package/src/index.ts +1 -1
  72. package/src/study/SessionController.ts +4 -4
  73. package/src/study/SpacedRepetition.ts +3 -3
  74. package/src/study/getCardDataShape.ts +2 -2
  75. package/src/util/index.ts +1 -0
  76. package/src/util/packer/CouchDBToStaticPacker.ts +620 -0
  77. package/src/util/packer/index.ts +4 -0
  78. package/src/util/packer/types.ts +64 -0
  79. package/tsconfig.json +7 -10
  80. package/tsup.config.ts +5 -3
  81. /package/src/impl/{pouch → couch}/clientCache.ts +0 -0
  82. /package/src/impl/{pouch → couch}/pouchdb-setup.ts +0 -0
  83. /package/src/impl/{pouch → couch}/types.ts +0 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,43 @@
1
+ # @vue-skuilder/db Package
2
+
3
+ Database abstraction layer providing unified interfaces for CouchDB/PouchDB and static data providers.
4
+
5
+ ## Commands
6
+ - Build: `yarn workspace @vue-skuilder/db build`
7
+ - Dev (watch): `yarn workspace @vue-skuilder/db dev`
8
+ - Lint: `yarn workspace @vue-skuilder/db lint:fix`
9
+ - Type check: `tsc --noEmit` (no dedicated script)
10
+
11
+ ## Build System
12
+ Uses **tsup** for dual CommonJS/ESM output:
13
+ - **ESM**: `dist/index.mjs` (primary)
14
+ - **CommonJS**: `dist/index.js` (Jest compatibility)
15
+ - **Types**: `dist/index.d.ts`
16
+
17
+ ## Package Exports
18
+ Multiple entry points for different use cases:
19
+ - **Main**: Core interfaces and factory
20
+ - **Core**: Core types and interfaces only
21
+ - **Pouch**: PouchDB implementation
22
+ - **Packer**: Static data packing utilities
23
+ - **Static**: Static data provider implementation
24
+
25
+ ## Dependencies
26
+ - `@vue-skuilder/common` - Shared types and utilities
27
+ - `pouchdb` - Client-side database
28
+ - `pouchdb-find` - Query plugin
29
+ - `@nilock2/pouchdb-authentication` - Auth plugin
30
+
31
+ ## Architecture
32
+ - **Interfaces**: Abstract DB layer contracts (`core/interfaces/`)
33
+ - **Implementations**:
34
+ - CouchDB/PouchDB provider (`impl/couch/`)
35
+ - Static data provider (`impl/static/`)
36
+ - **Study System**: Spaced repetition logic (`study/`)
37
+ - **Utilities**: Logging, packing tools (`util/`)
38
+
39
+ ## Key Features
40
+ - **Provider Pattern**: Switchable backend implementations
41
+ - **Dual Export**: Works in both Node.js and browser environments
42
+ - **Type Safety**: Full TypeScript coverage with strict mode
43
+ - **Sync Strategy**: Configurable online/offline data synchronization
@@ -0,0 +1,74 @@
1
+ import { Status } from '@vue-skuilder/common';
2
+
3
+ /**
4
+ * Common types used by UserDB implementations across different sync strategies
5
+ */
6
+
7
+ /**
8
+ * Result type for account creation operations
9
+ */
10
+ interface AccountCreationResult {
11
+ status: Status;
12
+ error?: string;
13
+ }
14
+ /**
15
+ * Result type for authentication operations
16
+ */
17
+ interface AuthenticationResult {
18
+ ok: boolean;
19
+ error?: string;
20
+ }
21
+
22
+ /**
23
+ * Strategy interface for handling user data synchronization
24
+ * Different implementations handle remote sync vs local-only storage
25
+ */
26
+ interface SyncStrategy {
27
+ /**
28
+ * Set up the remote database for a user
29
+ * @param username The username to set up remote DB for
30
+ * @returns PouchDB database instance (may be same as local for no-op)
31
+ */
32
+ setupRemoteDB(username: string): PouchDB.Database;
33
+ /**
34
+ * Start synchronization between local and remote databases
35
+ * @param localDB The local PouchDB instance
36
+ * @param remoteDB The remote PouchDB instance
37
+ */
38
+ startSync(localDB: PouchDB.Database, remoteDB: PouchDB.Database): void;
39
+ /**
40
+ * Stop synchronization (optional - for cleanup)
41
+ */
42
+ stopSync?(): void;
43
+ /**
44
+ * Whether this strategy supports account creation
45
+ */
46
+ canCreateAccount(): boolean;
47
+ /**
48
+ * Whether this strategy supports authentication
49
+ */
50
+ canAuthenticate(): boolean;
51
+ /**
52
+ * Create a new user account (if supported)
53
+ * @param username The username for the new account
54
+ * @param password The password for the new account
55
+ */
56
+ createAccount?(username: string, password: string): Promise<AccountCreationResult>;
57
+ /**
58
+ * Authenticate a user (if supported)
59
+ * @param username The username to authenticate
60
+ * @param password The password to authenticate with
61
+ */
62
+ authenticate?(username: string, password: string): Promise<AuthenticationResult>;
63
+ /**
64
+ * Log out the current user (if supported)
65
+ */
66
+ logout?(): Promise<AuthenticationResult>;
67
+ /**
68
+ * Get the current logged-in username
69
+ * Returns the username if logged in, or a default guest username
70
+ */
71
+ getCurrentUsername(): Promise<string>;
72
+ }
73
+
74
+ export type { AccountCreationResult as A, SyncStrategy as S, AuthenticationResult as a };
@@ -0,0 +1,74 @@
1
+ import { Status } from '@vue-skuilder/common';
2
+
3
+ /**
4
+ * Common types used by UserDB implementations across different sync strategies
5
+ */
6
+
7
+ /**
8
+ * Result type for account creation operations
9
+ */
10
+ interface AccountCreationResult {
11
+ status: Status;
12
+ error?: string;
13
+ }
14
+ /**
15
+ * Result type for authentication operations
16
+ */
17
+ interface AuthenticationResult {
18
+ ok: boolean;
19
+ error?: string;
20
+ }
21
+
22
+ /**
23
+ * Strategy interface for handling user data synchronization
24
+ * Different implementations handle remote sync vs local-only storage
25
+ */
26
+ interface SyncStrategy {
27
+ /**
28
+ * Set up the remote database for a user
29
+ * @param username The username to set up remote DB for
30
+ * @returns PouchDB database instance (may be same as local for no-op)
31
+ */
32
+ setupRemoteDB(username: string): PouchDB.Database;
33
+ /**
34
+ * Start synchronization between local and remote databases
35
+ * @param localDB The local PouchDB instance
36
+ * @param remoteDB The remote PouchDB instance
37
+ */
38
+ startSync(localDB: PouchDB.Database, remoteDB: PouchDB.Database): void;
39
+ /**
40
+ * Stop synchronization (optional - for cleanup)
41
+ */
42
+ stopSync?(): void;
43
+ /**
44
+ * Whether this strategy supports account creation
45
+ */
46
+ canCreateAccount(): boolean;
47
+ /**
48
+ * Whether this strategy supports authentication
49
+ */
50
+ canAuthenticate(): boolean;
51
+ /**
52
+ * Create a new user account (if supported)
53
+ * @param username The username for the new account
54
+ * @param password The password for the new account
55
+ */
56
+ createAccount?(username: string, password: string): Promise<AccountCreationResult>;
57
+ /**
58
+ * Authenticate a user (if supported)
59
+ * @param username The username to authenticate
60
+ * @param password The password to authenticate with
61
+ */
62
+ authenticate?(username: string, password: string): Promise<AuthenticationResult>;
63
+ /**
64
+ * Log out the current user (if supported)
65
+ */
66
+ logout?(): Promise<AuthenticationResult>;
67
+ /**
68
+ * Get the current logged-in username
69
+ * Returns the username if logged in, or a default guest username
70
+ */
71
+ getCurrentUsername(): Promise<string>;
72
+ }
73
+
74
+ export type { AccountCreationResult as A, SyncStrategy as S, AuthenticationResult as a };
@@ -1,3 +1,91 @@
1
- export { V as ActivityRecord, A as AdminDBInterface, g as AssignedCard, d as AssignedContent, f as AssignedCourse, e as AssignedTag, a7 as BulkCardProcessorConfig, H as CardData, O as CardHistory, C as CardRecord, b as ClassroomDBInterface, w as ClassroomRegistration, v as ClassroomRegistrationDesignation, x as ClassroomRegistrationDoc, a3 as ContentNavigator, n as ContentSourceID, r as CourseDBInterface, q as CourseInfo, I as CourseListData, W as CourseRegistration, X as CourseRegistrationDoc, p as CoursesDBInterface, D as DataLayerProvider, M as DataShapeData, J as DisplayableData, z as DocType, K as Field, G as GuestUsername, a6 as ImportResult, L as Loggable, a2 as Navigators, Q as QuestionData, P as QuestionRecord, Y as ScheduledCard, B as SkuilderCourseData, c as StudentClassroomDBInterface, a as StudyContentSource, h as StudySessionFailedItem, i as StudySessionFailedNewItem, j as StudySessionFailedReviewItem, S as StudySessionItem, k as StudySessionNewItem, l as StudySessionReviewItem, E as Tag, F as TagStub, T as TeacherClassroomDBInterface, R as UserConfig, t as UserCourseSetting, s as UserCourseSettings, U as UserDBInterface, u as UsrCrsDataInterface, Z as areQuestionRecords, N as cardHistoryPrefix, a1 as docIsDeleted, $ as getCardHistoryID, o as getStudySource, a4 as importParsedCards, _ as isQuestionRecord, m as isReview, y as log, a0 as parseCardHistoryID, a5 as validateProcessorConfig } from '../index-QMtzQI65.mjs';
2
- import '@vue-skuilder/common';
1
+ import { c as StudyContentSource, U as UserDBInterface, C as CourseDBInterface, H as ContentNavigationStrategyData, m as StudySessionReviewItem, D as ScheduledCard, l as StudySessionNewItem } from '../userDB-31gsvxyd.mjs';
2
+ export { y as ActivityRecord, A as AdminDBInterface, h as AssignedCard, e as AssignedContent, g as AssignedCourse, f as AssignedTag, b as ClassroomDBInterface, v as ClassroomRegistration, u as ClassroomRegistrationDesignation, w as ClassroomRegistrationDoc, o as ContentSourceID, q as CourseInfo, z as CourseRegistration, B as CourseRegistrationDoc, a as CoursesDBInterface, d as StudentClassroomDBInterface, i as StudySessionFailedItem, j as StudySessionFailedNewItem, k as StudySessionFailedReviewItem, S as StudySessionItem, T as TeacherClassroomDBInterface, x as UserConfig, s as UserCourseSetting, r as UserCourseSettings, t as UsrCrsDataInterface, p as getStudySource, n as isReview } from '../userDB-31gsvxyd.mjs';
3
+ export { D as DataLayerProvider } from '../dataLayerProvider-BZmLyBVw.mjs';
4
+ import { g as CardHistory, C as CardRecord, h as QuestionRecord } from '../types-legacy-WPe8CtO-.mjs';
5
+ export { b as CardData, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, F as Field, G as GuestUsername, Q as QuestionData, S as SkuilderCourseData, T as Tag, a as TagStub, f as cardHistoryPrefix, l as log } from '../types-legacy-WPe8CtO-.mjs';
6
+ import { DataShape, ParsedCard } from '@vue-skuilder/common';
3
7
  import 'moment';
8
+
9
+ declare abstract class Loggable {
10
+ protected abstract readonly _className: string;
11
+ protected log(...args: unknown[]): void;
12
+ protected error(...args: unknown[]): void;
13
+ }
14
+
15
+ declare function areQuestionRecords(h: CardHistory<CardRecord>): h is CardHistory<QuestionRecord>;
16
+ declare function isQuestionRecord(c: CardRecord): c is QuestionRecord;
17
+ declare function getCardHistoryID(courseID: string, cardID: string): PouchDB.Core.DocumentId;
18
+ declare function parseCardHistoryID(id: string): {
19
+ courseID: string;
20
+ cardID: string;
21
+ };
22
+ interface PouchDBError extends Error {
23
+ error?: string;
24
+ reason?: string;
25
+ }
26
+ declare function docIsDeleted(e: PouchDBError): boolean;
27
+
28
+ declare enum Navigators {
29
+ ELO = "elo"
30
+ }
31
+ /**
32
+ * A content-navigator provides runtime steering of study sessions.
33
+ */
34
+ declare abstract class ContentNavigator implements StudyContentSource {
35
+ /**
36
+ *
37
+ * @param user
38
+ * @param strategyData
39
+ * @returns the runtime object used to steer a study session.
40
+ */
41
+ static create(user: UserDBInterface, course: CourseDBInterface, strategyData: ContentNavigationStrategyData): Promise<ContentNavigator>;
42
+ abstract getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
43
+ abstract getNewCards(n?: number): Promise<StudySessionNewItem[]>;
44
+ }
45
+
46
+ /**
47
+ * Interface representing the result of a bulk import operation for a single card
48
+ */
49
+ interface ImportResult {
50
+ /** The original text input for the card */
51
+ originalText: string;
52
+ /** Status of the import operation */
53
+ status: 'success' | 'error';
54
+ /** Message describing the result or error */
55
+ message: string;
56
+ /** ID of the newly created card (only for success) */
57
+ cardId?: string;
58
+ }
59
+ /**
60
+ * Configuration for the bulk card processor
61
+ */
62
+ interface BulkCardProcessorConfig {
63
+ /** The data shape to use for the cards */
64
+ dataShape: DataShape;
65
+ /** The course code used for adding notes */
66
+ courseCode: string;
67
+ /** The username of the current user */
68
+ userName: string;
69
+ }
70
+
71
+ /**
72
+ * Processes multiple cards from bulk text input
73
+ *
74
+ * @param parsedCards - Array of parsed cards to import
75
+ * @param courseDB - Course database interface
76
+ * @param config - Configuration for the card processor
77
+ * @returns Array of import results
78
+ */
79
+ declare function importParsedCards(parsedCards: ParsedCard[], courseDB: CourseDBInterface, config: BulkCardProcessorConfig): Promise<ImportResult[]>;
80
+ /**
81
+ * Validates the configuration for bulk card processing
82
+ *
83
+ * @param config - Configuration to validate
84
+ * @returns Object with validation result and error message if any
85
+ */
86
+ declare function validateProcessorConfig(config: Partial<BulkCardProcessorConfig>): {
87
+ isValid: boolean;
88
+ errorMessage?: string;
89
+ };
90
+
91
+ export { type BulkCardProcessorConfig, CardHistory, CardRecord, ContentNavigator, CourseDBInterface, type ImportResult, Loggable, Navigators, QuestionRecord, ScheduledCard, StudyContentSource, StudySessionNewItem, StudySessionReviewItem, UserDBInterface, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig };
@@ -1,3 +1,91 @@
1
- export { V as ActivityRecord, A as AdminDBInterface, g as AssignedCard, d as AssignedContent, f as AssignedCourse, e as AssignedTag, a7 as BulkCardProcessorConfig, H as CardData, O as CardHistory, C as CardRecord, b as ClassroomDBInterface, w as ClassroomRegistration, v as ClassroomRegistrationDesignation, x as ClassroomRegistrationDoc, a3 as ContentNavigator, n as ContentSourceID, r as CourseDBInterface, q as CourseInfo, I as CourseListData, W as CourseRegistration, X as CourseRegistrationDoc, p as CoursesDBInterface, D as DataLayerProvider, M as DataShapeData, J as DisplayableData, z as DocType, K as Field, G as GuestUsername, a6 as ImportResult, L as Loggable, a2 as Navigators, Q as QuestionData, P as QuestionRecord, Y as ScheduledCard, B as SkuilderCourseData, c as StudentClassroomDBInterface, a as StudyContentSource, h as StudySessionFailedItem, i as StudySessionFailedNewItem, j as StudySessionFailedReviewItem, S as StudySessionItem, k as StudySessionNewItem, l as StudySessionReviewItem, E as Tag, F as TagStub, T as TeacherClassroomDBInterface, R as UserConfig, t as UserCourseSetting, s as UserCourseSettings, U as UserDBInterface, u as UsrCrsDataInterface, Z as areQuestionRecords, N as cardHistoryPrefix, a1 as docIsDeleted, $ as getCardHistoryID, o as getStudySource, a4 as importParsedCards, _ as isQuestionRecord, m as isReview, y as log, a0 as parseCardHistoryID, a5 as validateProcessorConfig } from '../index-QMtzQI65.js';
2
- import '@vue-skuilder/common';
1
+ import { c as StudyContentSource, U as UserDBInterface, C as CourseDBInterface, H as ContentNavigationStrategyData, m as StudySessionReviewItem, D as ScheduledCard, l as StudySessionNewItem } from '../userDB-D9EuWTp1.js';
2
+ export { y as ActivityRecord, A as AdminDBInterface, h as AssignedCard, e as AssignedContent, g as AssignedCourse, f as AssignedTag, b as ClassroomDBInterface, v as ClassroomRegistration, u as ClassroomRegistrationDesignation, w as ClassroomRegistrationDoc, o as ContentSourceID, q as CourseInfo, z as CourseRegistration, B as CourseRegistrationDoc, a as CoursesDBInterface, d as StudentClassroomDBInterface, i as StudySessionFailedItem, j as StudySessionFailedNewItem, k as StudySessionFailedReviewItem, S as StudySessionItem, T as TeacherClassroomDBInterface, x as UserConfig, s as UserCourseSetting, r as UserCourseSettings, t as UsrCrsDataInterface, p as getStudySource, n as isReview } from '../userDB-D9EuWTp1.js';
3
+ export { D as DataLayerProvider } from '../dataLayerProvider-BuntXkCs.js';
4
+ import { g as CardHistory, C as CardRecord, h as QuestionRecord } from '../types-legacy-WPe8CtO-.js';
5
+ export { b as CardData, c as CourseListData, e as DataShapeData, d as DisplayableData, D as DocType, F as Field, G as GuestUsername, Q as QuestionData, S as SkuilderCourseData, T as Tag, a as TagStub, f as cardHistoryPrefix, l as log } from '../types-legacy-WPe8CtO-.js';
6
+ import { DataShape, ParsedCard } from '@vue-skuilder/common';
3
7
  import 'moment';
8
+
9
+ declare abstract class Loggable {
10
+ protected abstract readonly _className: string;
11
+ protected log(...args: unknown[]): void;
12
+ protected error(...args: unknown[]): void;
13
+ }
14
+
15
+ declare function areQuestionRecords(h: CardHistory<CardRecord>): h is CardHistory<QuestionRecord>;
16
+ declare function isQuestionRecord(c: CardRecord): c is QuestionRecord;
17
+ declare function getCardHistoryID(courseID: string, cardID: string): PouchDB.Core.DocumentId;
18
+ declare function parseCardHistoryID(id: string): {
19
+ courseID: string;
20
+ cardID: string;
21
+ };
22
+ interface PouchDBError extends Error {
23
+ error?: string;
24
+ reason?: string;
25
+ }
26
+ declare function docIsDeleted(e: PouchDBError): boolean;
27
+
28
+ declare enum Navigators {
29
+ ELO = "elo"
30
+ }
31
+ /**
32
+ * A content-navigator provides runtime steering of study sessions.
33
+ */
34
+ declare abstract class ContentNavigator implements StudyContentSource {
35
+ /**
36
+ *
37
+ * @param user
38
+ * @param strategyData
39
+ * @returns the runtime object used to steer a study session.
40
+ */
41
+ static create(user: UserDBInterface, course: CourseDBInterface, strategyData: ContentNavigationStrategyData): Promise<ContentNavigator>;
42
+ abstract getPendingReviews(): Promise<(StudySessionReviewItem & ScheduledCard)[]>;
43
+ abstract getNewCards(n?: number): Promise<StudySessionNewItem[]>;
44
+ }
45
+
46
+ /**
47
+ * Interface representing the result of a bulk import operation for a single card
48
+ */
49
+ interface ImportResult {
50
+ /** The original text input for the card */
51
+ originalText: string;
52
+ /** Status of the import operation */
53
+ status: 'success' | 'error';
54
+ /** Message describing the result or error */
55
+ message: string;
56
+ /** ID of the newly created card (only for success) */
57
+ cardId?: string;
58
+ }
59
+ /**
60
+ * Configuration for the bulk card processor
61
+ */
62
+ interface BulkCardProcessorConfig {
63
+ /** The data shape to use for the cards */
64
+ dataShape: DataShape;
65
+ /** The course code used for adding notes */
66
+ courseCode: string;
67
+ /** The username of the current user */
68
+ userName: string;
69
+ }
70
+
71
+ /**
72
+ * Processes multiple cards from bulk text input
73
+ *
74
+ * @param parsedCards - Array of parsed cards to import
75
+ * @param courseDB - Course database interface
76
+ * @param config - Configuration for the card processor
77
+ * @returns Array of import results
78
+ */
79
+ declare function importParsedCards(parsedCards: ParsedCard[], courseDB: CourseDBInterface, config: BulkCardProcessorConfig): Promise<ImportResult[]>;
80
+ /**
81
+ * Validates the configuration for bulk card processing
82
+ *
83
+ * @param config - Configuration to validate
84
+ * @returns Object with validation result and error message if any
85
+ */
86
+ declare function validateProcessorConfig(config: Partial<BulkCardProcessorConfig>): {
87
+ isValid: boolean;
88
+ errorMessage?: string;
89
+ };
90
+
91
+ export { type BulkCardProcessorConfig, CardHistory, CardRecord, ContentNavigator, CourseDBInterface, type ImportResult, Loggable, Navigators, QuestionRecord, ScheduledCard, StudyContentSource, StudySessionNewItem, StudySessionReviewItem, UserDBInterface, areQuestionRecords, docIsDeleted, getCardHistoryID, importParsedCards, isQuestionRecord, parseCardHistoryID, validateProcessorConfig };