@vue-skuilder/db 0.1.6 → 0.1.8-0
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/{SyncStrategy-DnJRj-Xp.d.mts → SyncStrategy-CyATpyLQ.d.mts} +6 -0
- package/dist/{SyncStrategy-DnJRj-Xp.d.ts → SyncStrategy-CyATpyLQ.d.ts} +6 -0
- package/dist/core/index.d.mts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +825 -762
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +812 -750
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-BZmLyBVw.d.mts → dataLayerProvider-BInqI_RF.d.mts} +1 -1
- package/dist/{dataLayerProvider-BuntXkCs.d.ts → dataLayerProvider-DqtNroSh.d.ts} +1 -1
- package/dist/impl/couch/index.d.mts +6 -6
- package/dist/impl/couch/index.d.ts +6 -6
- package/dist/impl/couch/index.js +2261 -2081
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +2274 -2095
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.mts +8 -6
- package/dist/impl/static/index.d.ts +8 -6
- package/dist/impl/static/index.js +524 -1064
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +515 -1058
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index-CLL31bEy.d.ts +137 -0
- package/dist/index-CUNnL38E.d.mts +137 -0
- package/dist/index.d.mts +200 -9
- package/dist/index.d.ts +200 -9
- package/dist/index.js +4123 -2820
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4119 -2830
- package/dist/index.mjs.map +1 -1
- package/dist/{types-D6SnlHPm.d.ts → types-BefDGkKa.d.ts} +1 -1
- package/dist/{types-DPRvCrIk.d.mts → types-DC-ckZug.d.mts} +1 -1
- package/dist/{types-legacy-WPe8CtO-.d.mts → types-legacy-Birv-Jx6.d.mts} +2 -2
- package/dist/{types-legacy-WPe8CtO-.d.ts → types-legacy-Birv-Jx6.d.ts} +2 -2
- package/dist/{userDB-D9EuWTp1.d.ts → userDB-C33Hzjgn.d.mts} +11 -4
- package/dist/{userDB-31gsvxyd.d.mts → userDB-DusL7OXe.d.ts} +11 -4
- package/dist/util/packer/index.d.mts +3 -63
- package/dist/util/packer/index.d.ts +3 -63
- package/dist/util/packer/index.js +53 -1
- package/dist/util/packer/index.js.map +1 -1
- package/dist/util/packer/index.mjs +53 -1
- package/dist/util/packer/index.mjs.map +1 -1
- package/package.json +7 -4
- package/src/core/types/types-legacy.ts +13 -1
- package/src/core/types/user.ts +9 -2
- package/src/core/util/index.ts +5 -4
- package/src/factory.ts +25 -0
- package/src/impl/common/BaseUserDB.ts +62 -28
- package/src/impl/common/SyncStrategy.ts +7 -0
- package/src/impl/common/index.ts +0 -1
- package/src/impl/common/userDBHelpers.ts +15 -5
- package/src/impl/couch/CouchDBSyncStrategy.ts +10 -0
- package/src/impl/couch/courseAPI.ts +7 -6
- package/src/impl/couch/courseLookupDB.ts +24 -0
- package/src/impl/couch/index.ts +10 -5
- package/src/impl/couch/updateQueue.ts +12 -8
- package/src/impl/couch/user-course-relDB.ts +17 -27
- package/src/impl/static/NoOpSyncStrategy.ts +5 -0
- package/src/impl/static/StaticDataUnpacker.ts +18 -36
- package/src/impl/static/courseDB.ts +135 -17
- package/src/util/dataDirectory.test.ts +53 -0
- package/src/util/dataDirectory.ts +52 -0
- package/src/util/index.ts +3 -0
- package/src/util/migrator/FileSystemAdapter.ts +79 -0
- package/src/util/migrator/StaticToCouchDBMigrator.ts +713 -0
- package/src/util/migrator/index.ts +18 -0
- package/src/util/migrator/types.ts +84 -0
- package/src/util/migrator/validation.ts +517 -0
- package/src/util/packer/CouchDBToStaticPacker.ts +92 -2
- package/src/util/tuiLogger.ts +139 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// packages/db/src/util/migrator/FileSystemAdapter.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Abstraction for file system operations needed by the migrator.
|
|
5
|
+
* This allows dependency injection of file system operations,
|
|
6
|
+
* avoiding bundling issues with Node.js fs module.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileSystemAdapter {
|
|
9
|
+
/**
|
|
10
|
+
* Read a text file and return its contents as a string
|
|
11
|
+
*/
|
|
12
|
+
readFile(filePath: string): Promise<string>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Read a binary file and return its contents as a Buffer
|
|
16
|
+
*/
|
|
17
|
+
readBinary(filePath: string): Promise<Buffer>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Check if a file or directory exists
|
|
21
|
+
*/
|
|
22
|
+
exists(filePath: string): Promise<boolean>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get file/directory statistics
|
|
26
|
+
*/
|
|
27
|
+
stat(filePath: string): Promise<FileStats>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Write text data to a file
|
|
31
|
+
*/
|
|
32
|
+
writeFile(filePath: string, data: string | Buffer): Promise<void>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Write JSON data to a file with formatting
|
|
36
|
+
*/
|
|
37
|
+
writeJson(filePath: string, data: any, options?: { spaces?: number }): Promise<void>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Ensure a directory exists, creating it and parent directories if needed
|
|
41
|
+
*/
|
|
42
|
+
ensureDir(dirPath: string): Promise<void>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Join path segments into a complete path
|
|
46
|
+
*/
|
|
47
|
+
joinPath(...segments: string[]): string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the directory name of a path
|
|
51
|
+
*/
|
|
52
|
+
dirname(filePath: string): string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Check if a path is absolute
|
|
56
|
+
*/
|
|
57
|
+
isAbsolute(filePath: string): boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface FileStats {
|
|
61
|
+
isDirectory(): boolean;
|
|
62
|
+
isFile(): boolean;
|
|
63
|
+
size: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Error thrown when file system operations fail
|
|
68
|
+
*/
|
|
69
|
+
export class FileSystemError extends Error {
|
|
70
|
+
constructor(
|
|
71
|
+
message: string,
|
|
72
|
+
public readonly operation: string,
|
|
73
|
+
public readonly filePath: string,
|
|
74
|
+
public readonly cause?: Error
|
|
75
|
+
) {
|
|
76
|
+
super(message);
|
|
77
|
+
this.name = 'FileSystemError';
|
|
78
|
+
}
|
|
79
|
+
}
|