@liorandb/core 1.0.13 → 1.0.15
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.ts +81 -16
- package/dist/index.js +575 -126
- package/package.json +2 -2
- package/src/core/collection.ts +255 -89
- package/src/core/compaction.ts +123 -0
- package/src/core/database.ts +114 -2
- package/src/core/index.ts +140 -0
- package/src/core/query.ts +107 -2
- package/src/ipc/index.ts +38 -3
- package/src/ipc/queue.ts +32 -1
- package/src/ipc/server.ts +52 -7
- package/src/types/index.ts +51 -1
package/src/types/index.ts
CHANGED
|
@@ -1,13 +1,63 @@
|
|
|
1
|
+
/* ----------------------------- MANAGER OPTIONS ----------------------------- */
|
|
2
|
+
|
|
1
3
|
export interface LioranManagerOptions {
|
|
2
4
|
rootPath?: string
|
|
3
|
-
encryptionKey?: string | Buffer
|
|
5
|
+
encryptionKey?: string | Buffer
|
|
4
6
|
ipc?: boolean
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
/* ----------------------------- UPDATE OPTIONS ----------------------------- */
|
|
10
|
+
|
|
7
11
|
export interface UpdateOptions {
|
|
8
12
|
upsert?: boolean
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
/* --------------------------------- QUERY --------------------------------- */
|
|
16
|
+
|
|
11
17
|
export type Query<T = any> = Partial<T> & {
|
|
12
18
|
[key: string]: any
|
|
13
19
|
}
|
|
20
|
+
|
|
21
|
+
/* --------------------------------- INDEX --------------------------------- */
|
|
22
|
+
|
|
23
|
+
export type IndexType = "hash" | "btree"
|
|
24
|
+
|
|
25
|
+
export interface IndexDefinition<T = any> {
|
|
26
|
+
field: keyof T | string
|
|
27
|
+
unique?: boolean
|
|
28
|
+
sparse?: boolean
|
|
29
|
+
type?: IndexType
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface IndexMetadata {
|
|
33
|
+
field: string
|
|
34
|
+
unique: boolean
|
|
35
|
+
sparse: boolean
|
|
36
|
+
type: IndexType
|
|
37
|
+
createdAt: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ----------------------------- QUERY PLANNER ------------------------------ */
|
|
41
|
+
|
|
42
|
+
export interface QueryExplainPlan {
|
|
43
|
+
indexUsed?: string
|
|
44
|
+
indexType?: IndexType
|
|
45
|
+
scannedDocuments: number
|
|
46
|
+
returnedDocuments: number
|
|
47
|
+
executionTimeMs: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ------------------------------ COLLECTION -------------------------------- */
|
|
51
|
+
|
|
52
|
+
export interface CollectionIndexAPI<T = any> {
|
|
53
|
+
createIndex(def: IndexDefinition<T>): Promise<void>
|
|
54
|
+
dropIndex(field: keyof T | string): Promise<void>
|
|
55
|
+
listIndexes(): Promise<IndexMetadata[]>
|
|
56
|
+
rebuildIndexes(): Promise<void>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ------------------------------- DATABASE --------------------------------- */
|
|
60
|
+
|
|
61
|
+
export interface DatabaseIndexAPI {
|
|
62
|
+
rebuildAllIndexes(): Promise<void>
|
|
63
|
+
}
|