mindoodb 0.0.1 → 0.0.3
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/README.md +97 -24
- package/dist/__mocks__/expo-standard-web-crypto.d.ts +10 -0
- package/dist/__mocks__/expo-standard-web-crypto.d.ts.map +1 -0
- package/dist/__mocks__/expo-standard-web-crypto.js +22 -0
- package/dist/__mocks__/expo-standard-web-crypto.js.map +1 -0
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts +8 -0
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts.map +1 -0
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js +16 -0
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js.map +1 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts +1 -1
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts.map +1 -1
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js +2 -2
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +19 -2
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +133 -22
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.d.ts +20 -3
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.js +136 -21
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +33 -3
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +148 -27
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/index.d.ts +1 -1
- package/dist/appendonlystores/network/index.d.ts.map +1 -1
- package/dist/appendonlystores/network/index.js.map +1 -1
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts +61 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts.map +1 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js +685 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js.map +1 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStoreFactory.d.ts +25 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStoreFactory.d.ts.map +1 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStoreFactory.js +41 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStoreFactory.js.map +1 -0
- package/dist/browser/index.d.ts +5 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +13 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/core/BaseMindooDB.d.ts +38 -4
- package/dist/core/BaseMindooDB.d.ts.map +1 -1
- package/dist/core/BaseMindooDB.js +810 -329
- package/dist/core/BaseMindooDB.js.map +1 -1
- package/dist/core/BaseMindooTenant.d.ts +42 -6
- package/dist/core/BaseMindooTenant.d.ts.map +1 -1
- package/dist/core/BaseMindooTenant.js +259 -93
- package/dist/core/BaseMindooTenant.js.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts +3 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.js +50 -40
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
- package/dist/core/BaseMindooTenantFactory.d.ts +25 -29
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantFactory.js +175 -73
- package/dist/core/BaseMindooTenantFactory.js.map +1 -1
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +68 -0
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -0
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js +659 -0
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +50 -4
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +204 -39
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/bloom.d.ts +85 -0
- package/dist/core/appendonlystores/bloom.d.ts.map +1 -0
- package/dist/core/appendonlystores/bloom.js +228 -0
- package/dist/core/appendonlystores/bloom.js.map +1 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +3 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.js +21 -17
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -1
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts +36 -2
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.d.ts +10 -0
- package/dist/core/appendonlystores/network/types.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.js.map +1 -1
- package/dist/core/appendonlystores/types.d.ts +137 -1
- package/dist/core/appendonlystores/types.d.ts.map +1 -1
- package/dist/core/automerge-adapter.d.ts +15 -0
- package/dist/core/automerge-adapter.d.ts.map +1 -0
- package/dist/core/automerge-adapter.js +73 -0
- package/dist/core/automerge-adapter.js.map +1 -0
- package/dist/core/crypto/MindooDocSigner.d.ts +3 -1
- package/dist/core/crypto/MindooDocSigner.d.ts.map +1 -1
- package/dist/core/crypto/MindooDocSigner.js +9 -5
- package/dist/core/crypto/MindooDocSigner.js.map +1 -1
- package/dist/core/crypto/RSAEncryption.d.ts +3 -1
- package/dist/core/crypto/RSAEncryption.d.ts.map +1 -1
- package/dist/core/crypto/RSAEncryption.js +13 -9
- package/dist/core/crypto/RSAEncryption.js.map +1 -1
- package/dist/core/crypto/pbkdf2Iterations.d.ts +12 -0
- package/dist/core/crypto/pbkdf2Iterations.d.ts.map +1 -0
- package/dist/core/crypto/pbkdf2Iterations.js +55 -0
- package/dist/core/crypto/pbkdf2Iterations.js.map +1 -0
- package/dist/core/index.d.ts +7 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +30 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +2 -2
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -1
- package/dist/core/indexing/virtualviews/index.d.ts +1 -1
- package/dist/core/indexing/virtualviews/index.js +1 -1
- package/dist/core/keys/KeyBag.d.ts +36 -13
- package/dist/core/keys/KeyBag.d.ts.map +1 -1
- package/dist/core/keys/KeyBag.js +96 -31
- package/dist/core/keys/KeyBag.js.map +1 -1
- package/dist/core/keys/KeyContext.d.ts +4 -0
- package/dist/core/keys/KeyContext.d.ts.map +1 -0
- package/dist/core/keys/KeyContext.js +11 -0
- package/dist/core/keys/KeyContext.js.map +1 -0
- package/dist/core/logging/LogLevel.d.ts +21 -0
- package/dist/core/logging/LogLevel.d.ts.map +1 -0
- package/dist/core/logging/LogLevel.js +56 -0
- package/dist/core/logging/LogLevel.js.map +1 -0
- package/dist/core/logging/Logger.d.ts +37 -0
- package/dist/core/logging/Logger.d.ts.map +1 -0
- package/dist/core/logging/Logger.js +3 -0
- package/dist/core/logging/Logger.js.map +1 -0
- package/dist/core/logging/MindooLogger.d.ts +28 -0
- package/dist/core/logging/MindooLogger.d.ts.map +1 -0
- package/dist/core/logging/MindooLogger.js +217 -0
- package/dist/core/logging/MindooLogger.js.map +1 -0
- package/dist/core/logging/index.d.ts +4 -0
- package/dist/core/logging/index.d.ts.map +1 -0
- package/dist/core/logging/index.js +10 -0
- package/dist/core/logging/index.js.map +1 -0
- package/dist/core/types.d.ts +313 -77
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -1
- package/dist/core/uri/MindooURI.d.ts +58 -0
- package/dist/core/uri/MindooURI.d.ts.map +1 -0
- package/dist/core/uri/MindooURI.js +169 -0
- package/dist/core/uri/MindooURI.js.map +1 -0
- package/dist/core/userid/index.d.ts +0 -10
- package/dist/core/userid/index.d.ts.map +1 -1
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +541 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js +1334 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +5 -1
- package/dist/node/index.js.map +1 -1
- package/dist/reactnative/crypto/AESAdapter.d.ts +18 -0
- package/dist/reactnative/crypto/AESAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/AESAdapter.js +112 -0
- package/dist/reactnative/crypto/AESAdapter.js.map +1 -0
- package/dist/reactnative/crypto/Ed25519Adapter.d.ts +34 -0
- package/dist/reactnative/crypto/Ed25519Adapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/Ed25519Adapter.js +386 -0
- package/dist/reactnative/crypto/Ed25519Adapter.js.map +1 -0
- package/dist/reactnative/crypto/ExpoGoCryptoAdapter.d.ts +23 -0
- package/dist/reactnative/crypto/ExpoGoCryptoAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/ExpoGoCryptoAdapter.js +51 -0
- package/dist/reactnative/crypto/ExpoGoCryptoAdapter.js.map +1 -0
- package/dist/reactnative/crypto/HMACAdapter.d.ts +13 -0
- package/dist/reactnative/crypto/HMACAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/HMACAdapter.js +50 -0
- package/dist/reactnative/crypto/HMACAdapter.js.map +1 -0
- package/dist/reactnative/crypto/KeyFormatConverter.d.ts +21 -0
- package/dist/reactnative/crypto/KeyFormatConverter.d.ts.map +1 -0
- package/dist/reactnative/crypto/KeyFormatConverter.js +72 -0
- package/dist/reactnative/crypto/KeyFormatConverter.js.map +1 -0
- package/dist/reactnative/crypto/PBKDF2Adapter.d.ts +19 -0
- package/dist/reactnative/crypto/PBKDF2Adapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/PBKDF2Adapter.js +67 -0
- package/dist/reactnative/crypto/PBKDF2Adapter.js.map +1 -0
- package/dist/reactnative/crypto/QuickCryptoAdapter.d.ts +37 -0
- package/dist/reactnative/crypto/QuickCryptoAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/QuickCryptoAdapter.js +72 -0
- package/dist/reactnative/crypto/QuickCryptoAdapter.js.map +1 -0
- package/dist/reactnative/crypto/RSAAdapter.d.ts +38 -0
- package/dist/reactnative/crypto/RSAAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/RSAAdapter.js +184 -0
- package/dist/reactnative/crypto/RSAAdapter.js.map +1 -0
- package/dist/reactnative/crypto/ReactNativeCryptoAdapter.d.ts +33 -0
- package/dist/reactnative/crypto/ReactNativeCryptoAdapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/ReactNativeCryptoAdapter.js +61 -0
- package/dist/reactnative/crypto/ReactNativeCryptoAdapter.js.map +1 -0
- package/dist/reactnative/crypto/SHA256Adapter.d.ts +9 -0
- package/dist/reactnative/crypto/SHA256Adapter.d.ts.map +1 -0
- package/dist/reactnative/crypto/SHA256Adapter.js +29 -0
- package/dist/reactnative/crypto/SHA256Adapter.js.map +1 -0
- package/dist/reactnative/crypto/SubtleCryptoPolyfill.d.ts +63 -0
- package/dist/reactnative/crypto/SubtleCryptoPolyfill.d.ts.map +1 -0
- package/dist/reactnative/crypto/SubtleCryptoPolyfill.js +350 -0
- package/dist/reactnative/crypto/SubtleCryptoPolyfill.js.map +1 -0
- package/dist/reactnative/index.d.ts +8 -0
- package/dist/reactnative/index.d.ts.map +1 -0
- package/dist/reactnative/index.js +38 -0
- package/dist/reactnative/index.js.map +1 -0
- package/package.json +51 -6
- package/patches/PATCHES.md +111 -0
- package/patches/react-native+0.76.9.patch +34 -0
- package/patches/react-native-quick-crypto+1.0.7.patch +42 -0
- package/scripts/cli.js +21 -0
- package/scripts/setup-react-native.js +228 -0
- package/templates/reactnative/App.js +252 -0
- package/templates/reactnative/app.json +29 -0
- package/templates/reactnative/babel.config.js +6 -0
- package/templates/reactnative/index.js +26 -0
- package/templates/reactnative/metro.config.snippet.js +39 -0
- package/templates/reactnative/mindoodb-polyfills.js +116 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/types.ts"],"names":[],"mappings":";;;AAwIA;;GAEG;AACH,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,kCAAkC;IAClC,mDAA+B,CAAA;IAC/B,4BAA4B;IAC5B,iDAA6B,CAAA;IAC7B,oCAAoC;IACpC,2DAAuC,CAAA;IACvC,wCAAwC;IACxC,2DAAuC,CAAA;IACvC,kCAAkC;IAClC,mDAA+B,CAAA;IAC/B,wBAAwB;IACxB,iDAA6B,CAAA;IAC7B,kCAAkC;IAClC,qDAAiC,CAAA;AACnC,CAAC,EAfW,gBAAgB,gCAAhB,gBAAgB,QAe3B;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YACkB,IAAsB,EACtC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAkB;QAItC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AARD,oCAQC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StoreEntry, StoreEntryMetadata } from "../types";
|
|
1
|
+
import type { StoreEntry, StoreEntryMetadata, StoreEntryType } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Options for opening/creating a database store.
|
|
4
4
|
* Factory implementations can use these to customize store behavior.
|
|
@@ -10,8 +10,100 @@ import type { StoreEntry, StoreEntryMetadata } from "../types";
|
|
|
10
10
|
* - syncMode: "eager" | "lazy" - Synchronization strategy
|
|
11
11
|
*/
|
|
12
12
|
export interface OpenStoreOptions {
|
|
13
|
+
/**
|
|
14
|
+
* If true, local persisted data is cleared during store initialization.
|
|
15
|
+
* Useful for deterministic test setups that need a clean slate.
|
|
16
|
+
*/
|
|
17
|
+
clearLocalDataOnStartup?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Optional base path for persistent store implementations.
|
|
20
|
+
* In-memory and remote stores can ignore this option.
|
|
21
|
+
*/
|
|
22
|
+
basePath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Controls whether store-level indexing is enabled.
|
|
25
|
+
* Implementations may fall back to scan-based behavior when false.
|
|
26
|
+
*/
|
|
27
|
+
indexingEnabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Minimum number of metadata segment files before compaction runs.
|
|
30
|
+
* Applies to append-only on-disk stores. Use 0 or negative to disable.
|
|
31
|
+
*/
|
|
32
|
+
metadataSegmentCompactionMinFiles?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum total bytes of metadata segment files before compaction runs.
|
|
35
|
+
* Applies to append-only on-disk stores. Use 0 or negative to disable.
|
|
36
|
+
*/
|
|
37
|
+
metadataSegmentCompactionMaxBytes?: number;
|
|
13
38
|
[key: string]: unknown;
|
|
14
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Represents index build state for stores that support indexing.
|
|
42
|
+
*/
|
|
43
|
+
export interface StoreIndexBuildStatus {
|
|
44
|
+
phase: "idle" | "building" | "ready";
|
|
45
|
+
indexingEnabled: boolean;
|
|
46
|
+
progress01: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Optional compaction status for stores using appendable index segments.
|
|
50
|
+
*/
|
|
51
|
+
export interface StoreCompactionStatus {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
compactionMinFiles: number;
|
|
54
|
+
compactionMaxBytes: number;
|
|
55
|
+
totalCompactions: number;
|
|
56
|
+
totalCompactedFiles: number;
|
|
57
|
+
totalCompactedBytes: number;
|
|
58
|
+
totalCompactionDurationMs: number;
|
|
59
|
+
lastCompactionAt: number | null;
|
|
60
|
+
lastCompactedFiles: number;
|
|
61
|
+
lastCompactedBytes: number;
|
|
62
|
+
lastCompactionDurationMs: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Options for waiting on index readiness.
|
|
66
|
+
*/
|
|
67
|
+
export interface AwaitIndexReadyOptions {
|
|
68
|
+
timeoutMs?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Cursor used by cursor-based store scans.
|
|
72
|
+
* Entries are ordered by (createdAt, id) ascending.
|
|
73
|
+
*/
|
|
74
|
+
export interface StoreScanCursor {
|
|
75
|
+
createdAt: number;
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Optional filters for cursor-based metadata scans.
|
|
80
|
+
*/
|
|
81
|
+
export interface StoreScanFilters {
|
|
82
|
+
docId?: string;
|
|
83
|
+
entryTypes?: StoreEntryType[];
|
|
84
|
+
creationDateFrom?: number | null;
|
|
85
|
+
creationDateUntil?: number | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Result payload for cursor-based metadata scans.
|
|
89
|
+
*/
|
|
90
|
+
export interface StoreScanResult {
|
|
91
|
+
entries: StoreEntryMetadata[];
|
|
92
|
+
nextCursor: StoreScanCursor | null;
|
|
93
|
+
hasMore: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Bloom filter summary over entry IDs for sync optimization.
|
|
97
|
+
* Can be exchanged between stores/transports to reduce hasEntries checks.
|
|
98
|
+
*/
|
|
99
|
+
export interface StoreIdBloomSummary {
|
|
100
|
+
version: "bloom-v1";
|
|
101
|
+
totalIds: number;
|
|
102
|
+
bitCount: number;
|
|
103
|
+
hashCount: number;
|
|
104
|
+
salt: string;
|
|
105
|
+
bitsetBase64: string;
|
|
106
|
+
}
|
|
15
107
|
/**
|
|
16
108
|
* Result of creating stores for a database.
|
|
17
109
|
* Contains the document store and an optional separate attachment store.
|
|
@@ -115,6 +207,19 @@ export interface ContentAddressedStore {
|
|
|
115
207
|
* @return A list of entry metadata for entries we have that aren't in knownIds
|
|
116
208
|
*/
|
|
117
209
|
findNewEntriesForDoc(knownIds: string[], docId: string): Promise<StoreEntryMetadata[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Find entries by type and creation date range.
|
|
212
|
+
*
|
|
213
|
+
* This method allows efficient filtering of entries at the store level,
|
|
214
|
+
* which is especially important for network stores where server-side filtering
|
|
215
|
+
* reduces data transfer.
|
|
216
|
+
*
|
|
217
|
+
* @param type The entry type to filter by (e.g., "doc_create", "doc_delete")
|
|
218
|
+
* @param creationDateFrom Optional start timestamp (inclusive). If null, no lower bound.
|
|
219
|
+
* @param creationDateUntil Optional end timestamp (exclusive). If null, no upper bound.
|
|
220
|
+
* @return A list of entry metadata matching the criteria
|
|
221
|
+
*/
|
|
222
|
+
findEntries(type: StoreEntryType, creationDateFrom: number | null, creationDateUntil: number | null): Promise<StoreEntryMetadata[]>;
|
|
118
223
|
/**
|
|
119
224
|
* Get all entry IDs in the store.
|
|
120
225
|
* Used for synchronization to identify which entries we have.
|
|
@@ -122,6 +227,19 @@ export interface ContentAddressedStore {
|
|
|
122
227
|
* @return A list of all entry IDs in the store
|
|
123
228
|
*/
|
|
124
229
|
getAllIds(): Promise<string[]>;
|
|
230
|
+
/**
|
|
231
|
+
* Cursor-based metadata scan.
|
|
232
|
+
* Preferred for large stores to avoid known-id set exchange.
|
|
233
|
+
*
|
|
234
|
+
* Ordering is deterministic: (createdAt ASC, id ASC).
|
|
235
|
+
* Returned entries are strictly after `cursor`.
|
|
236
|
+
*/
|
|
237
|
+
scanEntriesSince?(cursor: StoreScanCursor | null, limit?: number, filters?: StoreScanFilters): Promise<StoreScanResult>;
|
|
238
|
+
/**
|
|
239
|
+
* Optional probabilistic summary over entry IDs for sync optimization.
|
|
240
|
+
* Callers must still perform exact reconciliation for correctness.
|
|
241
|
+
*/
|
|
242
|
+
getIdBloomSummary?(): Promise<StoreIdBloomSummary>;
|
|
125
243
|
/**
|
|
126
244
|
* Resolve the dependency chain starting from an entry ID.
|
|
127
245
|
* Returns IDs in dependency order, traversing backward through dependencyIds.
|
|
@@ -153,5 +271,23 @@ export interface ContentAddressedStore {
|
|
|
153
271
|
* @throws Error if the store implementation does not support purging
|
|
154
272
|
*/
|
|
155
273
|
purgeDocHistory(docId: string): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* Optional lifecycle hook for stores that persist local data.
|
|
276
|
+
* Implementations should delete all local store data and reset in-memory state.
|
|
277
|
+
*/
|
|
278
|
+
clearAllLocalData?(): Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Optional readiness API for stores with background index creation.
|
|
281
|
+
* Stores without indexing should resolve immediately with ready status.
|
|
282
|
+
*/
|
|
283
|
+
awaitIndexReady?(options?: AwaitIndexReadyOptions): Promise<StoreIndexBuildStatus>;
|
|
284
|
+
/**
|
|
285
|
+
* Optional status API for index build progress.
|
|
286
|
+
*/
|
|
287
|
+
getIndexBuildStatus?(): StoreIndexBuildStatus;
|
|
288
|
+
/**
|
|
289
|
+
* Optional status API for metadata-segment compaction observability.
|
|
290
|
+
*/
|
|
291
|
+
getCompactionStatus?(): Promise<StoreCompactionStatus>;
|
|
156
292
|
}
|
|
157
293
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/appendonlystores/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE/
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/appendonlystores/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/E;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C;;;OAGG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IACrC,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB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9C;;;OAGG;IACH,iBAAiB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;OAGG;IACH,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEnF;;OAEG;IACH,mBAAmB,CAAC,IAAI,qBAAqB,CAAC;IAE9C;;OAEG;IACH,mBAAmB,CAAC,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-specific Automerge adapter for MindooDB
|
|
3
|
+
*
|
|
4
|
+
* - React Native: Uses react-native-automerge-generated (native Rust via UniFFI)
|
|
5
|
+
* - Browser/Node.js: Uses @automerge/automerge (WASM)
|
|
6
|
+
*
|
|
7
|
+
* Both implementations now provide the same WASM-compatible API.
|
|
8
|
+
*/
|
|
9
|
+
import * as AutomergeWasm from "@automerge/automerge";
|
|
10
|
+
type AutomergeAPI = typeof AutomergeWasm;
|
|
11
|
+
declare let Automerge: AutomergeAPI;
|
|
12
|
+
declare let isNative: boolean;
|
|
13
|
+
export { Automerge, isNative };
|
|
14
|
+
export default Automerge;
|
|
15
|
+
//# sourceMappingURL=automerge-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automerge-adapter.d.ts","sourceRoot":"","sources":["../../src/core/automerge-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAGtD,KAAK,YAAY,GAAG,OAAO,aAAa,CAAC;AAGzC,QAAA,IAAI,SAAS,EAAE,YAAY,CAAC;AAC5B,QAAA,IAAI,QAAQ,SAAQ,CAAC;AAyBrB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC/B,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Platform-specific Automerge adapter for MindooDB
|
|
4
|
+
*
|
|
5
|
+
* - React Native: Uses react-native-automerge-generated (native Rust via UniFFI)
|
|
6
|
+
* - Browser/Node.js: Uses @automerge/automerge (WASM)
|
|
7
|
+
*
|
|
8
|
+
* Both implementations now provide the same WASM-compatible API.
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.isNative = exports.Automerge = void 0;
|
|
45
|
+
const AutomergeWasm = __importStar(require("@automerge/automerge"));
|
|
46
|
+
// Runtime detection of available Automerge implementation
|
|
47
|
+
let Automerge;
|
|
48
|
+
let isNative = false;
|
|
49
|
+
exports.isNative = isNative;
|
|
50
|
+
try {
|
|
51
|
+
// Try to load native Automerge (React Native only)
|
|
52
|
+
// @ts-ignore - Module may not exist on Node.js/Browser
|
|
53
|
+
const nativeModule = require('react-native-automerge-generated');
|
|
54
|
+
if (nativeModule?.Automerge) {
|
|
55
|
+
// Use the WASM-compatible API from react-native-automerge-generated
|
|
56
|
+
exports.Automerge = Automerge = nativeModule.Automerge;
|
|
57
|
+
exports.isNative = isNative = true;
|
|
58
|
+
console.log('[MindooDB] ✓ Using native Rust Automerge (react-native-automerge-generated)');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Module loaded but Automerge API not available
|
|
62
|
+
exports.Automerge = Automerge = AutomergeWasm;
|
|
63
|
+
console.log('[MindooDB] ⚠ Native module loaded but Automerge API unavailable, using WASM');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// Native module not available (Browser/Node.js)
|
|
68
|
+
exports.Automerge = Automerge = AutomergeWasm;
|
|
69
|
+
exports.isNative = isNative = false;
|
|
70
|
+
console.log('[MindooDB] ℹ Using WASM Automerge (Browser/Node.js mode)');
|
|
71
|
+
}
|
|
72
|
+
exports.default = Automerge;
|
|
73
|
+
//# sourceMappingURL=automerge-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automerge-adapter.js","sourceRoot":"","sources":["../../src/core/automerge-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oEAAsD;AAKtD,0DAA0D;AAC1D,IAAI,SAAuB,CAAC;AAC5B,IAAI,QAAQ,GAAG,KAAK,CAAC;AAyBD,4BAAQ;AAvB5B,IAAI,CAAC;IACH,mDAAmD;IACnD,uDAAuD;IACvD,MAAM,YAAY,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;IAEjE,IAAI,YAAY,EAAE,SAAS,EAAE,CAAC;QAC5B,oEAAoE;QACpE,oBAAA,SAAS,GAAG,YAAY,CAAC,SAAyB,CAAC;QACnD,mBAAA,QAAQ,GAAG,IAAI,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACN,gDAAgD;QAChD,oBAAA,SAAS,GAAG,aAAa,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,gDAAgD;IAChD,oBAAA,SAAS,GAAG,aAAa,CAAC;IAC1B,mBAAA,QAAQ,GAAG,KAAK,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;AAC1E,CAAC;AAID,kBAAe,SAAS,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MindooDoc, SigningKeyPair } from "../types";
|
|
2
2
|
import { BaseMindooTenant } from "../BaseMindooTenant";
|
|
3
|
+
import { Logger } from "../logging";
|
|
3
4
|
/**
|
|
4
5
|
* MindooDocSigner provides functionality to create and verify combined signatures
|
|
5
6
|
* for multiple document items in a MindooDoc.
|
|
@@ -65,7 +66,8 @@ import { BaseMindooTenant } from "../BaseMindooTenant";
|
|
|
65
66
|
export declare class MindooDocSigner {
|
|
66
67
|
private tenant;
|
|
67
68
|
private signKey;
|
|
68
|
-
|
|
69
|
+
private logger;
|
|
70
|
+
constructor(tenant: BaseMindooTenant, signKey: SigningKeyPair, logger?: Logger);
|
|
69
71
|
/**
|
|
70
72
|
* Creates a canonical JSON representation of the selected document items.
|
|
71
73
|
* This ensures deterministic serialization regardless of object key order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MindooDocSigner.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/MindooDocSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"MindooDocSigner.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/MindooDocSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAoB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAoC,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM;IAQ9E;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,mBAAmB;IA6C3B;;;;;;;;OAQG;IACG,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA4C3F;;;;;;;;OAQG;IACG,WAAW,CACf,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;CAyCpB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MindooDocSigner = void 0;
|
|
4
|
+
const logging_1 = require("../logging");
|
|
4
5
|
/**
|
|
5
6
|
* MindooDocSigner provides functionality to create and verify combined signatures
|
|
6
7
|
* for multiple document items in a MindooDoc.
|
|
@@ -64,9 +65,12 @@ exports.MindooDocSigner = void 0;
|
|
|
64
65
|
* @see BaseMindooTenant For the tenant infrastructure used for key management
|
|
65
66
|
*/
|
|
66
67
|
class MindooDocSigner {
|
|
67
|
-
constructor(tenant, signKey) {
|
|
68
|
+
constructor(tenant, signKey, logger) {
|
|
68
69
|
this.tenant = tenant;
|
|
69
70
|
this.signKey = signKey;
|
|
71
|
+
this.logger =
|
|
72
|
+
logger ||
|
|
73
|
+
new logging_1.MindooLogger((0, logging_1.getDefaultLogLevel)(), "MindooDocSigner", true);
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
72
76
|
* Creates a canonical JSON representation of the selected document items.
|
|
@@ -136,7 +140,7 @@ class MindooDocSigner {
|
|
|
136
140
|
const docPayload = doc.getData();
|
|
137
141
|
// Create canonical JSON representation
|
|
138
142
|
const canonicalJSON = this.createCanonicalJSON(docPayload, items);
|
|
139
|
-
|
|
143
|
+
this.logger.debug(`Canonical JSON for signing: ${canonicalJSON}`);
|
|
140
144
|
// Convert to bytes (UTF-8 encoding)
|
|
141
145
|
const encoder = new TextEncoder();
|
|
142
146
|
const payloadBytes = encoder.encode(canonicalJSON);
|
|
@@ -152,7 +156,7 @@ class MindooDocSigner {
|
|
|
152
156
|
const signature = await subtle.sign({
|
|
153
157
|
name: "Ed25519",
|
|
154
158
|
}, signingKey, payloadBytes.buffer);
|
|
155
|
-
|
|
159
|
+
this.logger.debug(`Signed ${items.length} items (signature: ${signature.byteLength} bytes)`);
|
|
156
160
|
return new Uint8Array(signature);
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
@@ -168,7 +172,7 @@ class MindooDocSigner {
|
|
|
168
172
|
const docPayload = doc.getData();
|
|
169
173
|
// Create the same canonical JSON representation
|
|
170
174
|
const canonicalJSON = this.createCanonicalJSON(docPayload, items);
|
|
171
|
-
|
|
175
|
+
this.logger.debug(`Canonical JSON for verification: ${canonicalJSON}`);
|
|
172
176
|
// Convert to bytes (UTF-8 encoding)
|
|
173
177
|
const encoder = new TextEncoder();
|
|
174
178
|
const payloadBytes = encoder.encode(canonicalJSON);
|
|
@@ -184,7 +188,7 @@ class MindooDocSigner {
|
|
|
184
188
|
const isValid = await subtle.verify({
|
|
185
189
|
name: "Ed25519",
|
|
186
190
|
}, cryptoKey, signature.buffer, payloadBytes.buffer);
|
|
187
|
-
|
|
191
|
+
this.logger.debug(`Signature verification: ${isValid ? "valid" : "invalid"}`);
|
|
188
192
|
return isValid;
|
|
189
193
|
}
|
|
190
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MindooDocSigner.js","sourceRoot":"","sources":["../../../src/core/crypto/MindooDocSigner.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MindooDocSigner.js","sourceRoot":"","sources":["../../../src/core/crypto/MindooDocSigner.ts"],"names":[],"mappings":";;;AAEA,wCAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAa,eAAe;IAK1B,YAAY,MAAwB,EAAE,OAAuB,EAAE,MAAe;QAC5E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM;YACT,MAAM;gBACN,IAAI,sBAAY,CAAC,IAAA,4BAAkB,GAAE,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACK,mBAAmB,CAAC,OAAyB,EAAE,KAAe;QACpE,mCAAmC;QACnC,uE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|
|
1
1
|
import type { CryptoAdapter } from "./CryptoAdapter";
|
|
2
|
+
import { Logger } from "../logging";
|
|
2
3
|
/**
|
|
3
4
|
* RSA Encryption utilities for network transport security.
|
|
4
5
|
*
|
|
@@ -11,7 +12,8 @@ import type { CryptoAdapter } from "./CryptoAdapter";
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class RSAEncryption {
|
|
13
14
|
private cryptoAdapter;
|
|
14
|
-
|
|
15
|
+
private logger;
|
|
16
|
+
constructor(cryptoAdapter: CryptoAdapter, logger?: Logger);
|
|
15
17
|
/**
|
|
16
18
|
* Import an RSA public key from PEM format.
|
|
17
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RSAEncryption.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/RSAEncryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"RSAEncryption.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/RSAEncryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAoC,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAS;gBAEX,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM;IAOzD;;;;;OAKG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA4BzD;;;;;OAKG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA4B1D;;;;;;;;;;;OAWG;IACG,OAAO,CACX,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,SAAS,GAAG,MAAM,GAC5B,OAAO,CAAC,UAAU,CAAC;IAoEtB;;;;;;;;;OASG;IACG,OAAO,CACX,aAAa,EAAE,UAAU,EACzB,UAAU,EAAE,SAAS,GAAG,MAAM,GAC7B,OAAO,CAAC,UAAU,CAAC;IAgDtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAO3B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RSAEncryption = void 0;
|
|
4
|
+
const logging_1 = require("../logging");
|
|
4
5
|
/**
|
|
5
6
|
* RSA Encryption utilities for network transport security.
|
|
6
7
|
*
|
|
@@ -12,8 +13,11 @@ exports.RSAEncryption = void 0;
|
|
|
12
13
|
* symmetric encryption (AES-256-GCM) used for storage.
|
|
13
14
|
*/
|
|
14
15
|
class RSAEncryption {
|
|
15
|
-
constructor(cryptoAdapter) {
|
|
16
|
+
constructor(cryptoAdapter, logger) {
|
|
16
17
|
this.cryptoAdapter = cryptoAdapter;
|
|
18
|
+
this.logger =
|
|
19
|
+
logger ||
|
|
20
|
+
new logging_1.MindooLogger((0, logging_1.getDefaultLogLevel)(), "RSAEncryption", true);
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* Import an RSA public key from PEM format.
|
|
@@ -22,7 +26,7 @@ class RSAEncryption {
|
|
|
22
26
|
* @returns The imported CryptoKey for encryption
|
|
23
27
|
*/
|
|
24
28
|
async importPublicKey(pemKey) {
|
|
25
|
-
|
|
29
|
+
this.logger.debug(`Importing RSA public key`);
|
|
26
30
|
// Remove PEM headers and decode base64
|
|
27
31
|
const pemContents = pemKey
|
|
28
32
|
.replace(/-----BEGIN PUBLIC KEY-----/g, "")
|
|
@@ -35,7 +39,7 @@ class RSAEncryption {
|
|
|
35
39
|
hash: "SHA-256",
|
|
36
40
|
}, false, // not extractable
|
|
37
41
|
["encrypt"]);
|
|
38
|
-
|
|
42
|
+
this.logger.debug(`Successfully imported RSA public key`);
|
|
39
43
|
return cryptoKey;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
@@ -45,7 +49,7 @@ class RSAEncryption {
|
|
|
45
49
|
* @returns The imported CryptoKey for decryption
|
|
46
50
|
*/
|
|
47
51
|
async importPrivateKey(pemKey) {
|
|
48
|
-
|
|
52
|
+
this.logger.debug(`Importing RSA private key`);
|
|
49
53
|
// Remove PEM headers and decode base64
|
|
50
54
|
const pemContents = pemKey
|
|
51
55
|
.replace(/-----BEGIN PRIVATE KEY-----/g, "")
|
|
@@ -58,7 +62,7 @@ class RSAEncryption {
|
|
|
58
62
|
hash: "SHA-256",
|
|
59
63
|
}, false, // not extractable
|
|
60
64
|
["decrypt"]);
|
|
61
|
-
|
|
65
|
+
this.logger.debug(`Successfully imported RSA private key`);
|
|
62
66
|
return cryptoKey;
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
@@ -74,7 +78,7 @@ class RSAEncryption {
|
|
|
74
78
|
* @returns The encrypted data
|
|
75
79
|
*/
|
|
76
80
|
async encrypt(data, publicKey) {
|
|
77
|
-
|
|
81
|
+
this.logger.debug(`Encrypting ${data.length} bytes`);
|
|
78
82
|
// Import key if it's a PEM string
|
|
79
83
|
const cryptoKey = typeof publicKey === "string"
|
|
80
84
|
? await this.importPublicKey(publicKey)
|
|
@@ -106,7 +110,7 @@ class RSAEncryption {
|
|
|
106
110
|
result.set(iv, 2 + encryptedKeyBytes.length);
|
|
107
111
|
// Write encrypted data
|
|
108
112
|
result.set(encryptedDataBytes, 2 + encryptedKeyBytes.length + iv.length);
|
|
109
|
-
|
|
113
|
+
this.logger.debug(`Encrypted to ${result.length} bytes (hybrid encryption)`);
|
|
110
114
|
return result;
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
@@ -120,7 +124,7 @@ class RSAEncryption {
|
|
|
120
124
|
* @returns The decrypted data
|
|
121
125
|
*/
|
|
122
126
|
async decrypt(encryptedData, privateKey) {
|
|
123
|
-
|
|
127
|
+
this.logger.debug(`Decrypting ${encryptedData.length} bytes`);
|
|
124
128
|
// Import key if it's a PEM string
|
|
125
129
|
const cryptoKey = typeof privateKey === "string"
|
|
126
130
|
? await this.importPrivateKey(privateKey)
|
|
@@ -138,7 +142,7 @@ class RSAEncryption {
|
|
|
138
142
|
// Decrypt the data with AES-GCM
|
|
139
143
|
const decryptedData = await subtle.decrypt({ name: "AES-GCM", iv: iv.buffer.slice(iv.byteOffset, iv.byteOffset + iv.byteLength) }, aesKeyObj, ciphertext.buffer.slice(ciphertext.byteOffset, ciphertext.byteOffset + ciphertext.byteLength));
|
|
140
144
|
const result = new Uint8Array(decryptedData);
|
|
141
|
-
|
|
145
|
+
this.logger.debug(`Decrypted to ${result.length} bytes`);
|
|
142
146
|
return result;
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RSAEncryption.js","sourceRoot":"","sources":["../../../src/core/crypto/RSAEncryption.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RSAEncryption.js","sourceRoot":"","sources":["../../../src/core/crypto/RSAEncryption.ts"],"names":[],"mappings":";;;AACA,wCAAsE;AAEtE;;;;;;;;;GASG;AACH,MAAa,aAAa;IAIxB,YAAY,aAA4B,EAAE,MAAe;QACvD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM;YACT,MAAM;gBACN,IAAI,sBAAY,CAAC,IAAA,4BAAkB,GAAE,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE9C,uCAAuC;QACvC,MAAM,WAAW,GAAG,MAAM;aACvB,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC;aAC1C,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC;aACxC,OAAO,CAAC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EF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,MAAM,QAAQ,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,MAAc;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,KAAiB;QAC1C,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;CACF;AArPD,sCAqPC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const DEFAULT_PBKDF2_ITERATIONS = 310000;
|
|
2
|
+
export declare const MIN_PBKDF2_ITERATIONS = 60000;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve PBKDF2 iterations from runtime overrides with safe bounds.
|
|
5
|
+
*
|
|
6
|
+
* Override order:
|
|
7
|
+
* 1) globalThis.__MINDOODB_PBKDF2_ITERATIONS (useful for RN/Expo runtime config)
|
|
8
|
+
* 2) process.env.MINDOODB_PBKDF2_ITERATIONS
|
|
9
|
+
* 3) defaultIterations
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolvePbkdf2Iterations(defaultIterations?: number): number;
|
|
12
|
+
//# sourceMappingURL=pbkdf2Iterations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf2Iterations.d.ts","sourceRoot":"","sources":["../../../src/core/crypto/pbkdf2Iterations.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,iBAAiB,GAAE,MAAkC,GAAG,MAAM,CAgBrG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MIN_PBKDF2_ITERATIONS = exports.DEFAULT_PBKDF2_ITERATIONS = void 0;
|
|
4
|
+
exports.resolvePbkdf2Iterations = resolvePbkdf2Iterations;
|
|
5
|
+
exports.DEFAULT_PBKDF2_ITERATIONS = 310000;
|
|
6
|
+
exports.MIN_PBKDF2_ITERATIONS = 60000;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve PBKDF2 iterations from runtime overrides with safe bounds.
|
|
9
|
+
*
|
|
10
|
+
* Override order:
|
|
11
|
+
* 1) globalThis.__MINDOODB_PBKDF2_ITERATIONS (useful for RN/Expo runtime config)
|
|
12
|
+
* 2) process.env.MINDOODB_PBKDF2_ITERATIONS
|
|
13
|
+
* 3) defaultIterations
|
|
14
|
+
*/
|
|
15
|
+
function resolvePbkdf2Iterations(defaultIterations = exports.DEFAULT_PBKDF2_ITERATIONS) {
|
|
16
|
+
const override = readOverride();
|
|
17
|
+
if (override === undefined) {
|
|
18
|
+
return defaultIterations;
|
|
19
|
+
}
|
|
20
|
+
const parsed = Number(override);
|
|
21
|
+
if (!Number.isFinite(parsed)) {
|
|
22
|
+
return defaultIterations;
|
|
23
|
+
}
|
|
24
|
+
const intValue = Math.floor(parsed);
|
|
25
|
+
if (intValue < exports.MIN_PBKDF2_ITERATIONS) {
|
|
26
|
+
return exports.MIN_PBKDF2_ITERATIONS;
|
|
27
|
+
}
|
|
28
|
+
return intValue;
|
|
29
|
+
}
|
|
30
|
+
function readOverride() {
|
|
31
|
+
try {
|
|
32
|
+
if (typeof globalThis !== "undefined") {
|
|
33
|
+
const g = globalThis;
|
|
34
|
+
if (g.__MINDOODB_PBKDF2_ITERATIONS !== undefined) {
|
|
35
|
+
return g.__MINDOODB_PBKDF2_ITERATIONS;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// no-op
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
if (typeof process !== "undefined" && process.env) {
|
|
44
|
+
const fromEnv = process.env.MINDOODB_PBKDF2_ITERATIONS;
|
|
45
|
+
if (fromEnv !== undefined) {
|
|
46
|
+
return fromEnv;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// no-op
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=pbkdf2Iterations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf2Iterations.js","sourceRoot":"","sources":["../../../src/core/crypto/pbkdf2Iterations.ts"],"names":[],"mappings":";;;AAWA,0DAgBC;AA3BY,QAAA,yBAAyB,GAAG,MAAM,CAAC;AACnC,QAAA,qBAAqB,GAAG,KAAK,CAAC;AAE3C;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,oBAA4B,iCAAyB;IAC3F,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,QAAQ,GAAG,6BAAqB,EAAE,CAAC;QACrC,OAAO,6BAAqB,CAAC;IAC/B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,YAAY;IACnB,IAAI,CAAC;QACH,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,UAA4E,CAAC;YACvF,IAAI,CAAC,CAAC,4BAA4B,KAAK,SAAS,EAAE,CAAC;gBACjD,OAAO,CAAC,CAAC,4BAA4B,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ;IACV,CAAC;IAED,IAAI,CAAC;QACH,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAClD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;YACvD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ;IACV,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
export { PublicUserId, PrivateUserId } from "./userid";
|
|
3
|
+
export { BaseMindooDB } from "./BaseMindooDB";
|
|
4
|
+
export { BaseMindooTenant } from "./BaseMindooTenant";
|
|
5
|
+
export { BaseMindooTenantFactory } from "./BaseMindooTenantFactory";
|
|
3
6
|
export { CryptoAdapter } from "./crypto/CryptoAdapter";
|
|
4
7
|
export { RSAEncryption } from "./crypto/RSAEncryption";
|
|
5
8
|
export { MindooDocSigner } from "./crypto/MindooDocSigner";
|
|
6
9
|
export { KeyBag } from "./keys/KeyBag";
|
|
10
|
+
export { encodeMindooURI, decodeMindooURI, isMindooURI, type MindooURIType, type DecodedMindooURI, } from "./uri/MindooURI";
|
|
7
11
|
export { SymmetricKeyNotFoundError } from "./errors";
|
|
8
12
|
export { generateDocEntryId, generateDepsFingerprint, generateAttachmentChunkId, generateFileUuid7, generateChunkUuid7, parseDocEntryId, parseAttachmentChunkId, isDocEntryId, isAttachmentChunkId, extractDocIdFromEntryId, computeContentHash, } from "./utils";
|
|
9
|
-
export { ContentAddressedStore, ContentAddressedStoreFactory, CreateStoreResult, OpenStoreOptions } from "./appendonlystores/types";
|
|
13
|
+
export { ContentAddressedStore, ContentAddressedStoreFactory, CreateStoreResult, OpenStoreOptions, StoreCompactionStatus, StoreScanCursor, StoreScanFilters, StoreScanResult, StoreIdBloomSummary, } from "./appendonlystores/types";
|
|
10
14
|
export { InMemoryContentAddressedStore, InMemoryContentAddressedStoreFactory } from "./appendonlystores/InMemoryContentAddressedStore";
|
|
11
15
|
export { AuthenticationService } from "./appendonlystores/network/AuthenticationService";
|
|
12
16
|
export { NetworkTransport, NetworkTransportConfig } from "./appendonlystores/network/NetworkTransport";
|
|
13
|
-
export { NetworkEncryptedEntry, UserPublicKeys, NetworkAuthTokenPayload, AuthChallenge, AuthResult, NetworkErrorType, NetworkError, } from "./appendonlystores/network/types";
|
|
17
|
+
export { NetworkEncryptedEntry, UserPublicKeys, NetworkAuthTokenPayload, AuthChallenge, AuthResult, NetworkSyncCapabilities, NetworkErrorType, NetworkError, } from "./appendonlystores/network/types";
|
|
18
|
+
export { VirtualView, VirtualViewFactory, VirtualViewBuilder, VirtualViewNavigatorBuilder, VirtualViewColumn, VirtualViewNavigator, VirtualViewEntryData, VirtualViewDataChange, MindooDBVirtualViewDataProvider, ColumnSorting, TotalMode, CategorizationStyle, WithCategories, WithDocuments, SelectedOnly, type VirtualViewColumnOptions, type IVirtualViewDataProvider, type MindooDBVirtualViewDataProviderOptions, type ScopedDocId, type ColumnValueFunction, type DocumentFilterFunction, } from "./indexing/virtualviews";
|
|
14
19
|
//# sourceMappingURL=index.d.ts.map
|