mindoodb 0.0.1
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 +263 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts +5 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.d.ts.map +1 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js +17 -0
- package/dist/appendonlystores/InMemoryContentAddressedStoreFactory.js.map +1 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +111 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +237 -0
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -0
- package/dist/appendonlystores/network/HttpTransport.d.ts +78 -0
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -0
- package/dist/appendonlystores/network/HttpTransport.js +356 -0
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +131 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +248 -0
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -0
- package/dist/appendonlystores/network/index.d.ts +8 -0
- package/dist/appendonlystores/network/index.d.ts.map +1 -0
- package/dist/appendonlystores/network/index.js +21 -0
- package/dist/appendonlystores/network/index.js.map +1 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.d.ts +14 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.d.ts.map +1 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.js +30 -0
- package/dist/browser/crypto/BrowserCryptoAdapter.js.map +1 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +26 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/core/BaseMindooDB.d.ts +182 -0
- package/dist/core/BaseMindooDB.d.ts.map +1 -0
- package/dist/core/BaseMindooDB.js +1701 -0
- package/dist/core/BaseMindooDB.js.map +1 -0
- package/dist/core/BaseMindooTenant.d.ts +155 -0
- package/dist/core/BaseMindooTenant.d.ts.map +1 -0
- package/dist/core/BaseMindooTenant.js +673 -0
- package/dist/core/BaseMindooTenant.js.map +1 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts +99 -0
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -0
- package/dist/core/BaseMindooTenantDirectory.js +776 -0
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -0
- package/dist/core/BaseMindooTenantFactory.d.ts +91 -0
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -0
- package/dist/core/BaseMindooTenantFactory.js +297 -0
- package/dist/core/BaseMindooTenantFactory.js.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +111 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +293 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +78 -0
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/AuthenticationService.js +297 -0
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -0
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts +174 -0
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/NetworkTransport.js +3 -0
- package/dist/core/appendonlystores/network/NetworkTransport.js.map +1 -0
- package/dist/core/appendonlystores/network/types.d.ts +135 -0
- package/dist/core/appendonlystores/network/types.d.ts.map +1 -0
- package/dist/core/appendonlystores/network/types.js +35 -0
- package/dist/core/appendonlystores/network/types.js.map +1 -0
- package/dist/core/appendonlystores/types.d.ts +157 -0
- package/dist/core/appendonlystores/types.d.ts.map +1 -0
- package/dist/core/appendonlystores/types.js +3 -0
- package/dist/core/appendonlystores/types.js.map +1 -0
- package/dist/core/crypto/CryptoAdapter.d.ts +19 -0
- package/dist/core/crypto/CryptoAdapter.d.ts.map +1 -0
- package/dist/core/crypto/CryptoAdapter.js +3 -0
- package/dist/core/crypto/CryptoAdapter.js.map +1 -0
- package/dist/core/crypto/MindooDocSigner.d.ts +106 -0
- package/dist/core/crypto/MindooDocSigner.d.ts.map +1 -0
- package/dist/core/crypto/MindooDocSigner.js +192 -0
- package/dist/core/crypto/MindooDocSigner.js.map +1 -0
- package/dist/core/crypto/RSAEncryption.d.ts +62 -0
- package/dist/core/crypto/RSAEncryption.d.ts.map +1 -0
- package/dist/core/crypto/RSAEncryption.js +167 -0
- package/dist/core/crypto/RSAEncryption.js.map +1 -0
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +53 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.d.ts +33 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.js +27 -0
- package/dist/core/indexing/virtualviews/IViewEntryAccessCheck.js.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts +31 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.js +3 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +52 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +106 -0
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts +44 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js +107 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts +28 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js +133 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKeyComparator.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualView.d.ts +109 -0
- package/dist/core/indexing/virtualviews/VirtualView.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualView.js +504 -0
- package/dist/core/indexing/virtualviews/VirtualView.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts +59 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js +70 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.d.ts +49 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.js +69 -0
- package/dist/core/indexing/virtualviews/VirtualViewDataChange.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts +121 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js +365 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts +131 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js +236 -0
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.d.ts +330 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.js +1010 -0
- package/dist/core/indexing/virtualviews/VirtualViewNavigator.js.map +1 -0
- package/dist/core/indexing/virtualviews/index.d.ts +53 -0
- package/dist/core/indexing/virtualviews/index.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/index.js +89 -0
- package/dist/core/indexing/virtualviews/index.js.map +1 -0
- package/dist/core/indexing/virtualviews/types.d.ts +115 -0
- package/dist/core/indexing/virtualviews/types.d.ts.map +1 -0
- package/dist/core/indexing/virtualviews/types.js +175 -0
- package/dist/core/indexing/virtualviews/types.js.map +1 -0
- package/dist/core/keys/KeyBag.d.ts +122 -0
- package/dist/core/keys/KeyBag.d.ts.map +1 -0
- package/dist/core/keys/KeyBag.js +401 -0
- package/dist/core/keys/KeyBag.js.map +1 -0
- package/dist/core/types.d.ts +1004 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/userid/index.d.ts +53 -0
- package/dist/core/userid/index.d.ts.map +1 -0
- package/dist/core/userid/index.js +3 -0
- package/dist/core/userid/index.js.map +1 -0
- package/dist/core/utils/idGeneration.d.ts +109 -0
- package/dist/core/utils/idGeneration.d.ts.map +1 -0
- package/dist/core/utils/idGeneration.js +182 -0
- package/dist/core/utils/idGeneration.js.map +1 -0
- package/dist/core/utils/index.d.ts +5 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +19 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/node/crypto/NodeCryptoAdapter.d.ts +16 -0
- package/dist/node/crypto/NodeCryptoAdapter.d.ts.map +1 -0
- package/dist/node/crypto/NodeCryptoAdapter.js +53 -0
- package/dist/node/crypto/NodeCryptoAdapter.js.map +1 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +26 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RSAEncryption = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* RSA Encryption utilities for network transport security.
|
|
6
|
+
*
|
|
7
|
+
* Uses RSA-OAEP for encrypting change payloads during network transport.
|
|
8
|
+
* The encrypted data can only be decrypted by the recipient who has
|
|
9
|
+
* the corresponding private key.
|
|
10
|
+
*
|
|
11
|
+
* This provides an additional layer of security on top of the existing
|
|
12
|
+
* symmetric encryption (AES-256-GCM) used for storage.
|
|
13
|
+
*/
|
|
14
|
+
class RSAEncryption {
|
|
15
|
+
constructor(cryptoAdapter) {
|
|
16
|
+
this.cryptoAdapter = cryptoAdapter;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Import an RSA public key from PEM format.
|
|
20
|
+
*
|
|
21
|
+
* @param pemKey The public key in PEM format (SPKI)
|
|
22
|
+
* @returns The imported CryptoKey for encryption
|
|
23
|
+
*/
|
|
24
|
+
async importPublicKey(pemKey) {
|
|
25
|
+
console.log(`[RSAEncryption] Importing RSA public key`);
|
|
26
|
+
// Remove PEM headers and decode base64
|
|
27
|
+
const pemContents = pemKey
|
|
28
|
+
.replace(/-----BEGIN PUBLIC KEY-----/g, "")
|
|
29
|
+
.replace(/-----END PUBLIC KEY-----/g, "")
|
|
30
|
+
.replace(/\s/g, "");
|
|
31
|
+
const keyData = this.base64ToUint8Array(pemContents);
|
|
32
|
+
const subtle = this.cryptoAdapter.getSubtle();
|
|
33
|
+
const cryptoKey = await subtle.importKey("spki", keyData.buffer, {
|
|
34
|
+
name: "RSA-OAEP",
|
|
35
|
+
hash: "SHA-256",
|
|
36
|
+
}, false, // not extractable
|
|
37
|
+
["encrypt"]);
|
|
38
|
+
console.log(`[RSAEncryption] Successfully imported RSA public key`);
|
|
39
|
+
return cryptoKey;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Import an RSA private key from PEM format.
|
|
43
|
+
*
|
|
44
|
+
* @param pemKey The private key in PEM format (PKCS#8)
|
|
45
|
+
* @returns The imported CryptoKey for decryption
|
|
46
|
+
*/
|
|
47
|
+
async importPrivateKey(pemKey) {
|
|
48
|
+
console.log(`[RSAEncryption] Importing RSA private key`);
|
|
49
|
+
// Remove PEM headers and decode base64
|
|
50
|
+
const pemContents = pemKey
|
|
51
|
+
.replace(/-----BEGIN PRIVATE KEY-----/g, "")
|
|
52
|
+
.replace(/-----END PRIVATE KEY-----/g, "")
|
|
53
|
+
.replace(/\s/g, "");
|
|
54
|
+
const keyData = this.base64ToUint8Array(pemContents);
|
|
55
|
+
const subtle = this.cryptoAdapter.getSubtle();
|
|
56
|
+
const cryptoKey = await subtle.importKey("pkcs8", keyData.buffer, {
|
|
57
|
+
name: "RSA-OAEP",
|
|
58
|
+
hash: "SHA-256",
|
|
59
|
+
}, false, // not extractable
|
|
60
|
+
["decrypt"]);
|
|
61
|
+
console.log(`[RSAEncryption] Successfully imported RSA private key`);
|
|
62
|
+
return cryptoKey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Encrypt data with an RSA public key.
|
|
66
|
+
*
|
|
67
|
+
* Note: RSA-OAEP with 3072-bit keys and SHA-256 can only encrypt
|
|
68
|
+
* up to 318 bytes directly. For larger payloads, this method uses
|
|
69
|
+
* hybrid encryption: generates a random AES key, encrypts the data
|
|
70
|
+
* with AES-GCM, then encrypts the AES key with RSA.
|
|
71
|
+
*
|
|
72
|
+
* @param data The data to encrypt
|
|
73
|
+
* @param publicKey The RSA public key (CryptoKey or PEM string)
|
|
74
|
+
* @returns The encrypted data
|
|
75
|
+
*/
|
|
76
|
+
async encrypt(data, publicKey) {
|
|
77
|
+
console.log(`[RSAEncryption] Encrypting ${data.length} bytes`);
|
|
78
|
+
// Import key if it's a PEM string
|
|
79
|
+
const cryptoKey = typeof publicKey === "string"
|
|
80
|
+
? await this.importPublicKey(publicKey)
|
|
81
|
+
: publicKey;
|
|
82
|
+
const subtle = this.cryptoAdapter.getSubtle();
|
|
83
|
+
// For small payloads (< 318 bytes for 3072-bit RSA with SHA-256),
|
|
84
|
+
// we could encrypt directly. But for consistency and safety,
|
|
85
|
+
// always use hybrid encryption.
|
|
86
|
+
// Generate a random 256-bit AES key
|
|
87
|
+
const aesKey = this.cryptoAdapter.getRandomValues(new Uint8Array(32));
|
|
88
|
+
// Generate a random 96-bit IV for AES-GCM
|
|
89
|
+
const iv = this.cryptoAdapter.getRandomValues(new Uint8Array(12));
|
|
90
|
+
// Import the AES key
|
|
91
|
+
const aesKeyObj = await subtle.importKey("raw", aesKey.buffer, { name: "AES-GCM", length: 256 }, false, ["encrypt"]);
|
|
92
|
+
// Encrypt the data with AES-GCM
|
|
93
|
+
const encryptedData = await subtle.encrypt({ name: "AES-GCM", iv: iv.buffer }, aesKeyObj, data.buffer);
|
|
94
|
+
// Encrypt the AES key with RSA-OAEP
|
|
95
|
+
const encryptedKey = await subtle.encrypt({ name: "RSA-OAEP" }, cryptoKey, aesKey.buffer);
|
|
96
|
+
// Pack the result: [encryptedKeyLength (2 bytes)][encryptedKey][iv][encryptedData]
|
|
97
|
+
const encryptedKeyBytes = new Uint8Array(encryptedKey);
|
|
98
|
+
const encryptedDataBytes = new Uint8Array(encryptedData);
|
|
99
|
+
const result = new Uint8Array(2 + encryptedKeyBytes.length + iv.length + encryptedDataBytes.length);
|
|
100
|
+
// Write encrypted key length (big-endian 16-bit)
|
|
101
|
+
result[0] = (encryptedKeyBytes.length >> 8) & 0xff;
|
|
102
|
+
result[1] = encryptedKeyBytes.length & 0xff;
|
|
103
|
+
// Write encrypted key
|
|
104
|
+
result.set(encryptedKeyBytes, 2);
|
|
105
|
+
// Write IV
|
|
106
|
+
result.set(iv, 2 + encryptedKeyBytes.length);
|
|
107
|
+
// Write encrypted data
|
|
108
|
+
result.set(encryptedDataBytes, 2 + encryptedKeyBytes.length + iv.length);
|
|
109
|
+
console.log(`[RSAEncryption] Encrypted to ${result.length} bytes (hybrid encryption)`);
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Decrypt data with an RSA private key.
|
|
114
|
+
*
|
|
115
|
+
* Handles hybrid encryption: extracts the RSA-encrypted AES key,
|
|
116
|
+
* decrypts it with RSA, then uses AES-GCM to decrypt the payload.
|
|
117
|
+
*
|
|
118
|
+
* @param encryptedData The encrypted data
|
|
119
|
+
* @param privateKey The RSA private key (CryptoKey or PEM string)
|
|
120
|
+
* @returns The decrypted data
|
|
121
|
+
*/
|
|
122
|
+
async decrypt(encryptedData, privateKey) {
|
|
123
|
+
console.log(`[RSAEncryption] Decrypting ${encryptedData.length} bytes`);
|
|
124
|
+
// Import key if it's a PEM string
|
|
125
|
+
const cryptoKey = typeof privateKey === "string"
|
|
126
|
+
? await this.importPrivateKey(privateKey)
|
|
127
|
+
: privateKey;
|
|
128
|
+
const subtle = this.cryptoAdapter.getSubtle();
|
|
129
|
+
// Unpack the data: [encryptedKeyLength (2 bytes)][encryptedKey][iv][encryptedData]
|
|
130
|
+
const encryptedKeyLength = (encryptedData[0] << 8) | encryptedData[1];
|
|
131
|
+
const encryptedKey = encryptedData.slice(2, 2 + encryptedKeyLength);
|
|
132
|
+
const iv = encryptedData.slice(2 + encryptedKeyLength, 2 + encryptedKeyLength + 12);
|
|
133
|
+
const ciphertext = encryptedData.slice(2 + encryptedKeyLength + 12);
|
|
134
|
+
// Decrypt the AES key with RSA-OAEP
|
|
135
|
+
const aesKey = await subtle.decrypt({ name: "RSA-OAEP" }, cryptoKey, encryptedKey.buffer.slice(encryptedKey.byteOffset, encryptedKey.byteOffset + encryptedKey.byteLength));
|
|
136
|
+
// Import the AES key
|
|
137
|
+
const aesKeyObj = await subtle.importKey("raw", aesKey, { name: "AES-GCM", length: 256 }, false, ["decrypt"]);
|
|
138
|
+
// Decrypt the data with AES-GCM
|
|
139
|
+
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
|
+
const result = new Uint8Array(decryptedData);
|
|
141
|
+
console.log(`[RSAEncryption] Decrypted to ${result.length} bytes`);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Convert a base64 string to Uint8Array.
|
|
146
|
+
*/
|
|
147
|
+
base64ToUint8Array(base64) {
|
|
148
|
+
const binary = atob(base64);
|
|
149
|
+
const bytes = new Uint8Array(binary.length);
|
|
150
|
+
for (let i = 0; i < binary.length; i++) {
|
|
151
|
+
bytes[i] = binary.charCodeAt(i);
|
|
152
|
+
}
|
|
153
|
+
return bytes;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Convert a Uint8Array to base64 string.
|
|
157
|
+
*/
|
|
158
|
+
uint8ArrayToBase64(bytes) {
|
|
159
|
+
let binary = "";
|
|
160
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
161
|
+
binary += String.fromCharCode(bytes[i]);
|
|
162
|
+
}
|
|
163
|
+
return btoa(binary);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.RSAEncryption = RSAEncryption;
|
|
167
|
+
//# sourceMappingURL=RSAEncryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RSAEncryption.js","sourceRoot":"","sources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jPD,sCAiPC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a symmetric encryption key is not found in the KeyBag.
|
|
3
|
+
* This error is used to identify documents that cannot be decrypted because
|
|
4
|
+
* the user doesn't have access to the required encryption key.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SymmetricKeyNotFoundError extends Error {
|
|
7
|
+
readonly keyId: string;
|
|
8
|
+
constructor(keyId: string);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,KAAK,EAAE,MAAM,CAAC;gBAElB,KAAK,EAAE,MAAM;CAK1B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SymmetricKeyNotFoundError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when a symmetric encryption key is not found in the KeyBag.
|
|
6
|
+
* This error is used to identify documents that cannot be decrypted because
|
|
7
|
+
* the user doesn't have access to the required encryption key.
|
|
8
|
+
*/
|
|
9
|
+
class SymmetricKeyNotFoundError extends Error {
|
|
10
|
+
constructor(keyId) {
|
|
11
|
+
super(`Symmetric key not found: ${keyId}`);
|
|
12
|
+
this.name = "SymmetricKeyNotFoundError";
|
|
13
|
+
this.keyId = keyId;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.SymmetricKeyNotFoundError = SymmetricKeyNotFoundError;
|
|
17
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAGlD,YAAY,KAAa;QACvB,KAAK,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,8DAQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { PublicUserId, PrivateUserId } from "./userid";
|
|
3
|
+
export { CryptoAdapter } from "./crypto/CryptoAdapter";
|
|
4
|
+
export { RSAEncryption } from "./crypto/RSAEncryption";
|
|
5
|
+
export { MindooDocSigner } from "./crypto/MindooDocSigner";
|
|
6
|
+
export { KeyBag } from "./keys/KeyBag";
|
|
7
|
+
export { SymmetricKeyNotFoundError } from "./errors";
|
|
8
|
+
export { generateDocEntryId, generateDepsFingerprint, generateAttachmentChunkId, generateFileUuid7, generateChunkUuid7, parseDocEntryId, parseAttachmentChunkId, isDocEntryId, isAttachmentChunkId, extractDocIdFromEntryId, computeContentHash, } from "./utils";
|
|
9
|
+
export { ContentAddressedStore, ContentAddressedStoreFactory, CreateStoreResult, OpenStoreOptions } from "./appendonlystores/types";
|
|
10
|
+
export { InMemoryContentAddressedStore, InMemoryContentAddressedStoreFactory } from "./appendonlystores/InMemoryContentAddressedStore";
|
|
11
|
+
export { AuthenticationService } from "./appendonlystores/network/AuthenticationService";
|
|
12
|
+
export { NetworkTransport, NetworkTransportConfig } from "./appendonlystores/network/NetworkTransport";
|
|
13
|
+
export { NetworkEncryptedEntry, UserPublicKeys, NetworkAuthTokenPayload, AuthChallenge, AuthResult, NetworkErrorType, NetworkError, } from "./appendonlystores/network/types";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpI,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AAGvI,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACvG,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,GACb,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Core platform-agnostic exports
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NetworkError = exports.NetworkErrorType = exports.AuthenticationService = exports.InMemoryContentAddressedStoreFactory = exports.InMemoryContentAddressedStore = exports.computeContentHash = exports.extractDocIdFromEntryId = exports.isAttachmentChunkId = exports.isDocEntryId = exports.parseAttachmentChunkId = exports.parseDocEntryId = exports.generateChunkUuid7 = exports.generateFileUuid7 = exports.generateAttachmentChunkId = exports.generateDepsFingerprint = exports.generateDocEntryId = exports.SymmetricKeyNotFoundError = exports.KeyBag = exports.MindooDocSigner = exports.RSAEncryption = void 0;
|
|
19
|
+
// Types
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
var RSAEncryption_1 = require("./crypto/RSAEncryption");
|
|
22
|
+
Object.defineProperty(exports, "RSAEncryption", { enumerable: true, get: function () { return RSAEncryption_1.RSAEncryption; } });
|
|
23
|
+
var MindooDocSigner_1 = require("./crypto/MindooDocSigner");
|
|
24
|
+
Object.defineProperty(exports, "MindooDocSigner", { enumerable: true, get: function () { return MindooDocSigner_1.MindooDocSigner; } });
|
|
25
|
+
// Keys
|
|
26
|
+
var KeyBag_1 = require("./keys/KeyBag");
|
|
27
|
+
Object.defineProperty(exports, "KeyBag", { enumerable: true, get: function () { return KeyBag_1.KeyBag; } });
|
|
28
|
+
// Errors
|
|
29
|
+
var errors_1 = require("./errors");
|
|
30
|
+
Object.defineProperty(exports, "SymmetricKeyNotFoundError", { enumerable: true, get: function () { return errors_1.SymmetricKeyNotFoundError; } });
|
|
31
|
+
// Utilities
|
|
32
|
+
var utils_1 = require("./utils");
|
|
33
|
+
Object.defineProperty(exports, "generateDocEntryId", { enumerable: true, get: function () { return utils_1.generateDocEntryId; } });
|
|
34
|
+
Object.defineProperty(exports, "generateDepsFingerprint", { enumerable: true, get: function () { return utils_1.generateDepsFingerprint; } });
|
|
35
|
+
Object.defineProperty(exports, "generateAttachmentChunkId", { enumerable: true, get: function () { return utils_1.generateAttachmentChunkId; } });
|
|
36
|
+
Object.defineProperty(exports, "generateFileUuid7", { enumerable: true, get: function () { return utils_1.generateFileUuid7; } });
|
|
37
|
+
Object.defineProperty(exports, "generateChunkUuid7", { enumerable: true, get: function () { return utils_1.generateChunkUuid7; } });
|
|
38
|
+
Object.defineProperty(exports, "parseDocEntryId", { enumerable: true, get: function () { return utils_1.parseDocEntryId; } });
|
|
39
|
+
Object.defineProperty(exports, "parseAttachmentChunkId", { enumerable: true, get: function () { return utils_1.parseAttachmentChunkId; } });
|
|
40
|
+
Object.defineProperty(exports, "isDocEntryId", { enumerable: true, get: function () { return utils_1.isDocEntryId; } });
|
|
41
|
+
Object.defineProperty(exports, "isAttachmentChunkId", { enumerable: true, get: function () { return utils_1.isAttachmentChunkId; } });
|
|
42
|
+
Object.defineProperty(exports, "extractDocIdFromEntryId", { enumerable: true, get: function () { return utils_1.extractDocIdFromEntryId; } });
|
|
43
|
+
Object.defineProperty(exports, "computeContentHash", { enumerable: true, get: function () { return utils_1.computeContentHash; } });
|
|
44
|
+
var InMemoryContentAddressedStore_1 = require("./appendonlystores/InMemoryContentAddressedStore");
|
|
45
|
+
Object.defineProperty(exports, "InMemoryContentAddressedStore", { enumerable: true, get: function () { return InMemoryContentAddressedStore_1.InMemoryContentAddressedStore; } });
|
|
46
|
+
Object.defineProperty(exports, "InMemoryContentAddressedStoreFactory", { enumerable: true, get: function () { return InMemoryContentAddressedStore_1.InMemoryContentAddressedStoreFactory; } });
|
|
47
|
+
// Network
|
|
48
|
+
var AuthenticationService_1 = require("./appendonlystores/network/AuthenticationService");
|
|
49
|
+
Object.defineProperty(exports, "AuthenticationService", { enumerable: true, get: function () { return AuthenticationService_1.AuthenticationService; } });
|
|
50
|
+
var types_1 = require("./appendonlystores/network/types");
|
|
51
|
+
Object.defineProperty(exports, "NetworkErrorType", { enumerable: true, get: function () { return types_1.NetworkErrorType; } });
|
|
52
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return types_1.NetworkError; } });
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;;;;;;;;;;;;;;;;;AAEjC,QAAQ;AACR,0CAAwB;AAOxB,wDAAuD;AAA9C,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,kHAAA,eAAe,OAAA;AAExB,OAAO;AACP,wCAAuC;AAA9B,gGAAA,MAAM,OAAA;AAEf,SAAS;AACT,mCAAqD;AAA5C,mHAAA,yBAAyB,OAAA;AAElC,YAAY;AACZ,iCAYiB;AAXf,2GAAA,kBAAkB,OAAA;AAClB,gHAAA,uBAAuB,OAAA;AACvB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,2GAAA,kBAAkB,OAAA;AAClB,wGAAA,eAAe,OAAA;AACf,+GAAA,sBAAsB,OAAA;AACtB,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,gHAAA,uBAAuB,OAAA;AACvB,2GAAA,kBAAkB,OAAA;AAKpB,kGAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AAAE,qJAAA,oCAAoC,OAAA;AAE5E,UAAU;AACV,0FAAyF;AAAhF,8HAAA,qBAAqB,OAAA;AAE9B,0DAQ0C;AAFxC,yGAAA,gBAAgB,OAAA;AAChB,qGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { VirtualViewNavigator } from "../virtualviews/VirtualViewNavigator";
|
|
2
|
+
import type { VirtualViewEntryData } from "./VirtualViewEntryData";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for checking if a user has access to view a specific entry.
|
|
5
|
+
* Implement this interface to provide custom access control logic.
|
|
6
|
+
*/
|
|
7
|
+
export interface IViewEntryAccessCheck {
|
|
8
|
+
/**
|
|
9
|
+
* Check if the user has read access to the provided entry.
|
|
10
|
+
*
|
|
11
|
+
* @param nav The navigator (provides context about the view and navigation state)
|
|
12
|
+
* @param entry The entry to check access for
|
|
13
|
+
* @returns true if the user can see the entry, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
isVisible(nav: VirtualViewNavigator, entry: VirtualViewEntryData): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Default access check implementation that allows all entries.
|
|
19
|
+
* Use this as a base class or directly when no access control is needed.
|
|
20
|
+
*/
|
|
21
|
+
export declare class AllowAllAccessCheck implements IViewEntryAccessCheck {
|
|
22
|
+
isVisible(nav: VirtualViewNavigator, entry: VirtualViewEntryData): boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Callback-based access check implementation.
|
|
26
|
+
* Allows providing a simple function for access control without implementing the full interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare class CallbackAccessCheck implements IViewEntryAccessCheck {
|
|
29
|
+
private readonly callback;
|
|
30
|
+
constructor(callback: (nav: VirtualViewNavigator, entry: VirtualViewEntryData) => boolean);
|
|
31
|
+
isVisible(nav: VirtualViewNavigator, entry: VirtualViewEntryData): boolean;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=IViewEntryAccessCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IViewEntryAccessCheck.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/IViewEntryAccessCheck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC;CAC5E;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,qBAAqB;IAC/D,SAAS,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO;CAG3E;AAED;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,qBAAqB;IAC/D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsE;gBAEnF,QAAQ,EAAE,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,KAAK,OAAO;IAIzF,SAAS,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO;CAG3E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallbackAccessCheck = exports.AllowAllAccessCheck = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Default access check implementation that allows all entries.
|
|
6
|
+
* Use this as a base class or directly when no access control is needed.
|
|
7
|
+
*/
|
|
8
|
+
class AllowAllAccessCheck {
|
|
9
|
+
isVisible(nav, entry) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AllowAllAccessCheck = AllowAllAccessCheck;
|
|
14
|
+
/**
|
|
15
|
+
* Callback-based access check implementation.
|
|
16
|
+
* Allows providing a simple function for access control without implementing the full interface.
|
|
17
|
+
*/
|
|
18
|
+
class CallbackAccessCheck {
|
|
19
|
+
constructor(callback) {
|
|
20
|
+
this.callback = callback;
|
|
21
|
+
}
|
|
22
|
+
isVisible(nav, entry) {
|
|
23
|
+
return this.callback(nav, entry);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CallbackAccessCheck = CallbackAccessCheck;
|
|
27
|
+
//# sourceMappingURL=IViewEntryAccessCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IViewEntryAccessCheck.js","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/IViewEntryAccessCheck.ts"],"names":[],"mappings":";;;AAkBA;;;GAGG;AACH,MAAa,mBAAmB;IAC9B,SAAS,CAAC,GAAyB,EAAE,KAA2B;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAJD,kDAIC;AAED;;;GAGG;AACH,MAAa,mBAAmB;IAG9B,YAAY,QAA6E;QACvF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,GAAyB,EAAE,KAA2B;QAC9D,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;CACF;AAVD,kDAUC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VirtualView } from "./VirtualView";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for classes that provide data to a VirtualView.
|
|
4
|
+
* Data providers fetch documents from a source (like MindooDB) and
|
|
5
|
+
* generate VirtualViewDataChange objects to update the view.
|
|
6
|
+
*/
|
|
7
|
+
export interface IVirtualViewDataProvider {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a unique identifier for this data provider.
|
|
10
|
+
* Used as the "origin" in view entries to track which provider
|
|
11
|
+
* each document came from.
|
|
12
|
+
*
|
|
13
|
+
* @returns The origin identifier
|
|
14
|
+
*/
|
|
15
|
+
getOrigin(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Called when this data provider is added to a VirtualView.
|
|
18
|
+
* Use this to store a reference to the view and perform initialization.
|
|
19
|
+
*
|
|
20
|
+
* @param view The VirtualView this provider is attached to
|
|
21
|
+
*/
|
|
22
|
+
init(view: VirtualView): void;
|
|
23
|
+
/**
|
|
24
|
+
* Fetches the latest data and sends updates to the VirtualView.
|
|
25
|
+
* This should be idempotent and handle incremental updates efficiently.
|
|
26
|
+
*
|
|
27
|
+
* @returns A promise that resolves when the update is complete
|
|
28
|
+
*/
|
|
29
|
+
update(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=IVirtualViewDataProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IVirtualViewDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/IVirtualViewDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAE9B;;;;;OAKG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IVirtualViewDataProvider.js","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/IVirtualViewDataProvider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { MindooDB, ProcessChangesCursor } from "../../types";
|
|
2
|
+
import type { IVirtualViewDataProvider } from "./IVirtualViewDataProvider";
|
|
3
|
+
import type { VirtualView } from "./VirtualView";
|
|
4
|
+
import type { DocumentFilterFunction } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Options for creating a MindooDBVirtualViewDataProvider
|
|
7
|
+
*/
|
|
8
|
+
export interface MindooDBVirtualViewDataProviderOptions {
|
|
9
|
+
/** Unique origin identifier for this data provider */
|
|
10
|
+
origin: string;
|
|
11
|
+
/** The MindooDB to read documents from */
|
|
12
|
+
db: MindooDB;
|
|
13
|
+
/** Optional filter function to select which documents to include */
|
|
14
|
+
filterFunction?: DocumentFilterFunction;
|
|
15
|
+
/** Page size for incremental processing (default: 100) */
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Data provider that reads documents from a MindooDB and provides them
|
|
20
|
+
* to a VirtualView. Uses processChangesSince for incremental updates.
|
|
21
|
+
*/
|
|
22
|
+
export declare class MindooDBVirtualViewDataProvider implements IVirtualViewDataProvider {
|
|
23
|
+
private readonly origin;
|
|
24
|
+
private readonly db;
|
|
25
|
+
private readonly filterFunction;
|
|
26
|
+
private readonly pageSize;
|
|
27
|
+
private view;
|
|
28
|
+
private cursor;
|
|
29
|
+
/** Track documents currently in the view from this provider */
|
|
30
|
+
private knownDocIds;
|
|
31
|
+
constructor(options: MindooDBVirtualViewDataProviderOptions);
|
|
32
|
+
getOrigin(): string;
|
|
33
|
+
init(view: VirtualView): void;
|
|
34
|
+
update(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Compute column values for a document using column value functions
|
|
37
|
+
*/
|
|
38
|
+
private computeColumnValues;
|
|
39
|
+
/**
|
|
40
|
+
* Reset the provider state (useful for full rebuilds)
|
|
41
|
+
*/
|
|
42
|
+
reset(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get the current cursor position
|
|
45
|
+
*/
|
|
46
|
+
getCursor(): ProcessChangesCursor | null;
|
|
47
|
+
/**
|
|
48
|
+
* Get the number of documents currently tracked by this provider
|
|
49
|
+
*/
|
|
50
|
+
getKnownDocCount(): number;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=MindooDBVirtualViewDataProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MindooDBVirtualViewDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA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Provider = void 0;
|
|
4
|
+
const VirtualViewDataChange_1 = require("./VirtualViewDataChange");
|
|
5
|
+
/**
|
|
6
|
+
* Data provider that reads documents from a MindooDB and provides them
|
|
7
|
+
* to a VirtualView. Uses processChangesSince for incremental updates.
|
|
8
|
+
*/
|
|
9
|
+
class MindooDBVirtualViewDataProvider {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.view = null;
|
|
12
|
+
this.cursor = null;
|
|
13
|
+
/** Track documents currently in the view from this provider */
|
|
14
|
+
this.knownDocIds = new Set();
|
|
15
|
+
this.origin = options.origin;
|
|
16
|
+
this.db = options.db;
|
|
17
|
+
this.filterFunction = options.filterFunction ?? null;
|
|
18
|
+
this.pageSize = options.pageSize ?? 100;
|
|
19
|
+
}
|
|
20
|
+
getOrigin() {
|
|
21
|
+
return this.origin;
|
|
22
|
+
}
|
|
23
|
+
init(view) {
|
|
24
|
+
this.view = view;
|
|
25
|
+
}
|
|
26
|
+
async update() {
|
|
27
|
+
if (!this.view) {
|
|
28
|
+
throw new Error("Data provider not initialized - call init() first");
|
|
29
|
+
}
|
|
30
|
+
const change = new VirtualViewDataChange_1.VirtualViewDataChange(this.origin);
|
|
31
|
+
const columns = this.view.getColumns();
|
|
32
|
+
// Process documents using iterateChangesSince for incremental updates
|
|
33
|
+
for await (const { doc, cursor } of this.db.iterateChangesSince(this.cursor, this.pageSize)) {
|
|
34
|
+
const docId = doc.getId();
|
|
35
|
+
const isDeleted = doc.isDeleted();
|
|
36
|
+
// Check if document passes filter
|
|
37
|
+
const passesFilter = !isDeleted && (!this.filterFunction || this.filterFunction(doc));
|
|
38
|
+
if (passesFilter) {
|
|
39
|
+
// Document should be in the view
|
|
40
|
+
// Compute column values
|
|
41
|
+
const columnValues = this.computeColumnValues(doc, columns);
|
|
42
|
+
change.addEntry(docId, columnValues);
|
|
43
|
+
this.knownDocIds.add(docId);
|
|
44
|
+
}
|
|
45
|
+
else if (this.knownDocIds.has(docId)) {
|
|
46
|
+
// Document was in the view but no longer matches (deleted or filter changed)
|
|
47
|
+
change.removeEntry(docId);
|
|
48
|
+
this.knownDocIds.delete(docId);
|
|
49
|
+
}
|
|
50
|
+
// Update cursor to track progress
|
|
51
|
+
this.cursor = cursor;
|
|
52
|
+
}
|
|
53
|
+
// Apply changes to the view if there are any
|
|
54
|
+
if (change.hasChanges()) {
|
|
55
|
+
this.view.applyChanges(change);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Compute column values for a document using column value functions
|
|
60
|
+
*/
|
|
61
|
+
computeColumnValues(doc, columns) {
|
|
62
|
+
const values = {};
|
|
63
|
+
const docData = doc.getData();
|
|
64
|
+
// First, copy all fields from the document
|
|
65
|
+
for (const [key, value] of Object.entries(docData)) {
|
|
66
|
+
// Skip internal fields
|
|
67
|
+
if (!key.startsWith("_")) {
|
|
68
|
+
values[key] = value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Then, apply column value functions (which may override or add values)
|
|
72
|
+
for (const column of columns) {
|
|
73
|
+
if (column.valueFunction) {
|
|
74
|
+
const computedValue = column.valueFunction(doc, values, this.origin);
|
|
75
|
+
values[column.name] = computedValue;
|
|
76
|
+
}
|
|
77
|
+
else if (values[column.name] === undefined) {
|
|
78
|
+
// If no value function and no value from doc, use the document data directly
|
|
79
|
+
// This handles the case where the column name matches a document field
|
|
80
|
+
values[column.name] = docData[column.name];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return values;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Reset the provider state (useful for full rebuilds)
|
|
87
|
+
*/
|
|
88
|
+
reset() {
|
|
89
|
+
this.cursor = null;
|
|
90
|
+
this.knownDocIds.clear();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the current cursor position
|
|
94
|
+
*/
|
|
95
|
+
getCursor() {
|
|
96
|
+
return this.cursor;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the number of documents currently tracked by this provider
|
|
100
|
+
*/
|
|
101
|
+
getKnownDocCount() {
|
|
102
|
+
return this.knownDocIds.size;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.MindooDBVirtualViewDataProvider = MindooDBVirtualViewDataProvider;
|
|
106
|
+
//# sourceMappingURL=MindooDBVirtualViewDataProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MindooDBVirtualViewDataProvider.js","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.ts"],"names":[],"mappings":";;;AAIA,mEAAgE;AAoBhE;;;GAGG;AACH,MAAa,+BAA+B;IAY1C,YAAY,OAA+C;QANnD,SAAI,GAAuB,IAAI,CAAC;QAChC,WAAM,GAAgC,IAAI,CAAC;QAEnD,+DAA+D;QACvD,gBAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;QAG3C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC;QACrD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,GAAG,CAAC;IAC1C,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,IAAiB;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,6CAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAEvC,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ViewEntryData objects within one level of the
|
|
3
|
+
* VirtualView tree structure. It sorts category elements at the top followed by documents and
|
|
4
|
+
* contains the values of the columns that are used for sorting, followed by the origin and doc id.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ViewEntrySortKey {
|
|
7
|
+
/** Whether this key represents a category entry */
|
|
8
|
+
readonly isCategory: boolean;
|
|
9
|
+
/** Sort values for the entry */
|
|
10
|
+
readonly values: readonly unknown[];
|
|
11
|
+
/** Origin identifier (which data provider) */
|
|
12
|
+
readonly origin: string;
|
|
13
|
+
/** Document ID (UNID) */
|
|
14
|
+
readonly docId: string;
|
|
15
|
+
/** Whether this is a scan key (for range queries) vs a regular sort key */
|
|
16
|
+
readonly isScanKey: boolean;
|
|
17
|
+
/** Cached hash code */
|
|
18
|
+
private _hashCode;
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Creates a scan key for range queries (used with LOW_SORTVAL/HIGH_SORTVAL)
|
|
22
|
+
*/
|
|
23
|
+
static createScanKey(isCategory: boolean, values: unknown[], origin: string, docId: string): ViewEntrySortKey;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a regular sort key for entries
|
|
26
|
+
*/
|
|
27
|
+
static createSortKey(isCategory: boolean, values: unknown[], origin: string, docId: string): ViewEntrySortKey;
|
|
28
|
+
/**
|
|
29
|
+
* Generates a unique string key for use in Maps/Sets
|
|
30
|
+
*/
|
|
31
|
+
toKey(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a hash code for this sort key
|
|
34
|
+
*/
|
|
35
|
+
hashCode(): number;
|
|
36
|
+
private hashString;
|
|
37
|
+
private hashValue;
|
|
38
|
+
/**
|
|
39
|
+
* Checks equality with another sort key
|
|
40
|
+
*/
|
|
41
|
+
equals(other: ViewEntrySortKey): boolean;
|
|
42
|
+
toString(): string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ViewEntrySortKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewEntrySortKey.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/virtualviews/ViewEntrySortKey.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IAEpC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,yBAAyB;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,uBAAuB;IACvB,OAAO,CAAC,SAAS,CAAuB;IAExC,OAAO;IAcP;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,OAAO,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,gBAAgB;IAInB;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,OAAO,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,gBAAgB;IAInB;;OAEG;IACH,KAAK,IAAI,MAAM;IAMf;;OAEG;IACH,QAAQ,IAAI,MAAM;IAalB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,SAAS;IAQjB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAqBxC,QAAQ,IAAI,MAAM;CAInB"}
|