mindoodb 0.0.23 → 0.0.32
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-server.md +9 -1
- package/README.md +5 -3
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js +24 -5
- package/dist/appendonlystores/network/ClientNetworkContentAddressedStore.js.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.d.ts +14 -2
- package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
- package/dist/appendonlystores/network/HttpTransport.js +124 -27
- package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +159 -4
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +334 -25
- package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts +9 -0
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.d.ts.map +1 -1
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js +77 -5
- package/dist/browser/appendonlystores/IndexedDBContentAddressedStore.js.map +1 -1
- package/dist/browser/index.mjs +103 -0
- package/dist/core/BaseMindooDB.d.ts +697 -4
- package/dist/core/BaseMindooDB.d.ts.map +1 -1
- package/dist/core/BaseMindooDB.js +3273 -180
- package/dist/core/BaseMindooDB.js.map +1 -1
- package/dist/core/BaseMindooTenant.d.ts +192 -1
- package/dist/core/BaseMindooTenant.d.ts.map +1 -1
- package/dist/core/BaseMindooTenant.js +633 -88
- package/dist/core/BaseMindooTenant.js.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.d.ts +770 -10
- package/dist/core/BaseMindooTenantDirectory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantDirectory.js +2715 -292
- package/dist/core/BaseMindooTenantDirectory.js.map +1 -1
- package/dist/core/BaseMindooTenantFactory.d.ts +2 -0
- package/dist/core/BaseMindooTenantFactory.d.ts.map +1 -1
- package/dist/core/BaseMindooTenantFactory.js +20 -0
- package/dist/core/BaseMindooTenantFactory.js.map +1 -1
- package/dist/core/accesscontrol/AccessDeniedError.d.ts +22 -0
- package/dist/core/accesscontrol/AccessDeniedError.d.ts.map +1 -0
- package/dist/core/accesscontrol/AccessDeniedError.js +28 -0
- package/dist/core/accesscontrol/AccessDeniedError.js.map +1 -0
- package/dist/core/accesscontrol/DirectoryStateNode.d.ts +220 -0
- package/dist/core/accesscontrol/DirectoryStateNode.d.ts.map +1 -0
- package/dist/core/accesscontrol/DirectoryStateNode.js +297 -0
- package/dist/core/accesscontrol/DirectoryStateNode.js.map +1 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.d.ts +118 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.d.ts.map +1 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.js +173 -0
- package/dist/core/accesscontrol/DirectoryTimeTravelIndex.js.map +1 -0
- package/dist/core/accesscontrol/directoryProjection.d.ts +26 -0
- package/dist/core/accesscontrol/directoryProjection.d.ts.map +1 -0
- package/dist/core/accesscontrol/directoryProjection.js +174 -0
- package/dist/core/accesscontrol/directoryProjection.js.map +1 -0
- package/dist/core/accesscontrol/evaluate.d.ts +77 -0
- package/dist/core/accesscontrol/evaluate.d.ts.map +1 -0
- package/dist/core/accesscontrol/evaluate.js +206 -0
- package/dist/core/accesscontrol/evaluate.js.map +1 -0
- package/dist/core/accesscontrol/grantKeys.d.ts +113 -0
- package/dist/core/accesscontrol/grantKeys.d.ts.map +1 -0
- package/dist/core/accesscontrol/grantKeys.js +302 -0
- package/dist/core/accesscontrol/grantKeys.js.map +1 -0
- package/dist/core/accesscontrol/keyBagReconciler.d.ts +22 -0
- package/dist/core/accesscontrol/keyBagReconciler.d.ts.map +1 -0
- package/dist/core/accesscontrol/keyBagReconciler.js +3 -0
- package/dist/core/accesscontrol/keyBagReconciler.js.map +1 -0
- package/dist/core/accesscontrol/materializationGuard.d.ts +89 -0
- package/dist/core/accesscontrol/materializationGuard.d.ts.map +1 -0
- package/dist/core/accesscontrol/materializationGuard.js +69 -0
- package/dist/core/accesscontrol/materializationGuard.js.map +1 -0
- package/dist/core/accesscontrol/quarantine.d.ts +65 -0
- package/dist/core/accesscontrol/quarantine.d.ts.map +1 -0
- package/dist/core/accesscontrol/quarantine.js +79 -0
- package/dist/core/accesscontrol/quarantine.js.map +1 -0
- package/dist/core/accesscontrol/receiptValidation.d.ts +113 -0
- package/dist/core/accesscontrol/receiptValidation.d.ts.map +1 -0
- package/dist/core/accesscontrol/receiptValidation.js +142 -0
- package/dist/core/accesscontrol/receiptValidation.js.map +1 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.d.ts +31 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.d.ts.map +1 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.js +66 -0
- package/dist/core/accesscontrol/timestamp/Ed25519WitnessProvider.js.map +1 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.d.ts +79 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.d.ts.map +1 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.js +22 -0
- package/dist/core/accesscontrol/timestamp/TimestampProvider.js.map +1 -0
- package/dist/core/accesscontrol/types.d.ts +825 -0
- package/dist/core/accesscontrol/types.d.ts.map +1 -0
- package/dist/core/accesscontrol/types.js +534 -0
- package/dist/core/accesscontrol/types.js.map +1 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts +9 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.d.ts.map +1 -1
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js +54 -0
- package/dist/core/appendonlystores/InMemoryContentAddressedStore.js.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts +38 -2
- package/dist/core/appendonlystores/network/AuthenticationService.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/AuthenticationService.js +199 -26
- package/dist/core/appendonlystores/network/AuthenticationService.js.map +1 -1
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts +17 -3
- package/dist/core/appendonlystores/network/NetworkTransport.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.d.ts +58 -4
- package/dist/core/appendonlystores/network/types.d.ts.map +1 -1
- package/dist/core/appendonlystores/network/types.js +4 -0
- package/dist/core/appendonlystores/network/types.js.map +1 -1
- package/dist/core/appendonlystores/scanUtils.d.ts +27 -0
- package/dist/core/appendonlystores/scanUtils.d.ts.map +1 -0
- package/dist/core/appendonlystores/scanUtils.js +87 -0
- package/dist/core/appendonlystores/scanUtils.js.map +1 -0
- package/dist/core/appendonlystores/types.d.ts +23 -2
- package/dist/core/appendonlystores/types.d.ts.map +1 -1
- package/dist/core/cache/CacheManager.d.ts +13 -3
- package/dist/core/cache/CacheManager.d.ts.map +1 -1
- package/dist/core/cache/CacheManager.js +7 -4
- package/dist/core/cache/CacheManager.js.map +1 -1
- package/dist/core/crypto/EntrySignature.d.ts +137 -0
- package/dist/core/crypto/EntrySignature.d.ts.map +1 -0
- package/dist/core/crypto/EntrySignature.js +210 -0
- package/dist/core/crypto/EntrySignature.js.map +1 -0
- package/dist/core/crypto/MindooDocSigner.d.ts.map +1 -1
- package/dist/core/crypto/MindooDocSigner.js +6 -2
- package/dist/core/crypto/MindooDocSigner.js.map +1 -1
- package/dist/core/crypto/WitnessReceipt.d.ts +137 -0
- package/dist/core/crypto/WitnessReceipt.d.ts.map +1 -0
- package/dist/core/crypto/WitnessReceipt.js +182 -0
- package/dist/core/crypto/WitnessReceipt.js.map +1 -0
- package/dist/core/crypto/encryptedFields.d.ts +27 -0
- package/dist/core/crypto/encryptedFields.d.ts.map +1 -0
- package/dist/core/crypto/encryptedFields.js +58 -0
- package/dist/core/crypto/encryptedFields.js.map +1 -0
- package/dist/core/crypto/pbkdf2Iterations.d.ts +12 -0
- package/dist/core/crypto/pbkdf2Iterations.d.ts.map +1 -1
- package/dist/core/crypto/pbkdf2Iterations.js +23 -0
- package/dist/core/crypto/pbkdf2Iterations.js.map +1 -1
- package/dist/core/crypto/privateKeyEncryption.d.ts.map +1 -1
- package/dist/core/crypto/privateKeyEncryption.js +3 -1
- package/dist/core/crypto/privateKeyEncryption.js.map +1 -1
- package/dist/core/databaseIdValidation.d.ts +1 -1
- package/dist/core/databaseIdValidation.d.ts.map +1 -1
- package/dist/core/databaseIdValidation.js +4 -4
- package/dist/core/databaseIdValidation.js.map +1 -1
- package/dist/core/errors.d.ts +26 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +42 -1
- package/dist/core/errors.js.map +1 -1
- package/dist/core/expressions/builder.d.ts +102 -0
- package/dist/core/expressions/builder.d.ts.map +1 -0
- package/dist/core/expressions/builder.js +249 -0
- package/dist/core/expressions/builder.js.map +1 -0
- package/dist/core/expressions/evaluateExpression.d.ts +78 -0
- package/dist/core/expressions/evaluateExpression.d.ts.map +1 -0
- package/dist/core/expressions/evaluateExpression.js +386 -0
- package/dist/core/expressions/evaluateExpression.js.map +1 -0
- package/dist/core/expressions/formulaSource.d.ts +24 -0
- package/dist/core/expressions/formulaSource.d.ts.map +1 -0
- package/dist/core/expressions/formulaSource.js +765 -0
- package/dist/core/expressions/formulaSource.js.map +1 -0
- package/dist/core/expressions/index.d.ts +8 -0
- package/dist/core/expressions/index.d.ts.map +1 -0
- package/dist/core/expressions/index.js +46 -0
- package/dist/core/expressions/index.js.map +1 -0
- package/dist/core/expressions/metadata.d.ts +23 -0
- package/dist/core/expressions/metadata.d.ts.map +1 -0
- package/dist/core/expressions/metadata.js +191 -0
- package/dist/core/expressions/metadata.js.map +1 -0
- package/dist/core/expressions/types.d.ts +164 -0
- package/dist/core/expressions/types.d.ts.map +1 -0
- package/dist/core/expressions/types.js +3 -0
- package/dist/core/expressions/types.js.map +1 -0
- package/dist/core/extraction/types.d.ts +47 -0
- package/dist/core/extraction/types.d.ts.map +1 -0
- package/dist/core/extraction/types.js +42 -0
- package/dist/core/extraction/types.js.map +1 -0
- package/dist/core/index.d.ts +13 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +113 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/indexing/createViewDataProvider.d.ts +84 -0
- package/dist/core/indexing/createViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/createViewDataProvider.js +139 -0
- package/dist/core/indexing/createViewDataProvider.js.map +1 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.d.ts +180 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.js +548 -0
- package/dist/core/indexing/fulltext/DocumentFullTextIndex.js.map +1 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.d.ts +69 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.js +183 -0
- package/dist/core/indexing/fulltext/SearchEngineAdapter.js.map +1 -0
- package/dist/core/indexing/fulltext/extractFulltextText.d.ts +34 -0
- package/dist/core/indexing/fulltext/extractFulltextText.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/extractFulltextText.js +129 -0
- package/dist/core/indexing/fulltext/extractFulltextText.js.map +1 -0
- package/dist/core/indexing/fulltext/index.d.ts +5 -0
- package/dist/core/indexing/fulltext/index.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/index.js +20 -0
- package/dist/core/indexing/fulltext/index.js.map +1 -0
- package/dist/core/indexing/fulltext/types.d.ts +168 -0
- package/dist/core/indexing/fulltext/types.d.ts.map +1 -0
- package/dist/core/indexing/fulltext/types.js +89 -0
- package/dist/core/indexing/fulltext/types.js.map +1 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.d.ts +137 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.d.ts.map +1 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.js +438 -0
- package/dist/core/indexing/summary/DocumentSummaryStore.js.map +1 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.d.ts +72 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.d.ts.map +1 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.js +221 -0
- package/dist/core/indexing/summary/SummaryVirtualViewDataProvider.js.map +1 -0
- package/dist/core/indexing/summary/extractSummaryFields.d.ts +75 -0
- package/dist/core/indexing/summary/extractSummaryFields.d.ts.map +1 -0
- package/dist/core/indexing/summary/extractSummaryFields.js +266 -0
- package/dist/core/indexing/summary/extractSummaryFields.js.map +1 -0
- package/dist/core/indexing/summary/index.d.ts +5 -0
- package/dist/core/indexing/summary/index.d.ts.map +1 -0
- package/dist/core/indexing/summary/index.js +23 -0
- package/dist/core/indexing/summary/index.js.map +1 -0
- package/dist/core/indexing/summary/types.d.ts +119 -0
- package/dist/core/indexing/summary/types.d.ts.map +1 -0
- package/dist/core/indexing/summary/types.js +81 -0
- package/dist/core/indexing/summary/types.js.map +1 -0
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts +47 -1
- package/dist/core/indexing/virtualviews/IVirtualViewDataProvider.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts +24 -8
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js +96 -41
- package/dist/core/indexing/virtualviews/MindooDBVirtualViewDataProvider.js.map +1 -1
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts +2 -0
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js +8 -3
- package/dist/core/indexing/virtualviews/ViewEntrySortKey.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualView.d.ts +111 -5
- package/dist/core/indexing/virtualviews/VirtualView.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualView.js +266 -75
- package/dist/core/indexing/virtualviews/VirtualView.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts +12 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js +1 -0
- package/dist/core/indexing/virtualviews/VirtualViewColumn.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts +12 -0
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js +66 -5
- package/dist/core/indexing/virtualviews/VirtualViewEntryData.js.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts +50 -6
- package/dist/core/indexing/virtualviews/VirtualViewFactory.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js +54 -12
- package/dist/core/indexing/virtualviews/VirtualViewFactory.js.map +1 -1
- package/dist/core/indexing/virtualviews/index.d.ts +3 -3
- package/dist/core/indexing/virtualviews/index.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/index.js.map +1 -1
- package/dist/core/indexing/virtualviews/types.d.ts +6 -0
- package/dist/core/indexing/virtualviews/types.d.ts.map +1 -1
- package/dist/core/indexing/virtualviews/types.js +11 -3
- package/dist/core/indexing/virtualviews/types.js.map +1 -1
- package/dist/core/keys/KeyBag.d.ts +25 -0
- package/dist/core/keys/KeyBag.d.ts.map +1 -1
- package/dist/core/keys/KeyBag.js +37 -1
- package/dist/core/keys/KeyBag.js.map +1 -1
- package/dist/core/query/executeQuery.d.ts +18 -0
- package/dist/core/query/executeQuery.d.ts.map +1 -0
- package/dist/core/query/executeQuery.js +313 -0
- package/dist/core/query/executeQuery.js.map +1 -0
- package/dist/core/query/index.d.ts +5 -0
- package/dist/core/query/index.d.ts.map +1 -0
- package/dist/core/query/index.js +14 -0
- package/dist/core/query/index.js.map +1 -0
- package/dist/core/query/queryLive.d.ts +27 -0
- package/dist/core/query/queryLive.d.ts.map +1 -0
- package/dist/core/query/queryLive.js +104 -0
- package/dist/core/query/queryLive.js.map +1 -0
- package/dist/core/query/queryView.d.ts +156 -0
- package/dist/core/query/queryView.d.ts.map +1 -0
- package/dist/core/query/queryView.js +266 -0
- package/dist/core/query/queryView.js.map +1 -0
- package/dist/core/query/types.d.ts +121 -0
- package/dist/core/query/types.d.ts.map +1 -0
- package/dist/core/query/types.js +18 -0
- package/dist/core/query/types.js.map +1 -0
- package/dist/core/storeEntryTime.d.ts +57 -0
- package/dist/core/storeEntryTime.d.ts.map +1 -0
- package/dist/core/storeEntryTime.js +72 -0
- package/dist/core/storeEntryTime.js.map +1 -0
- package/dist/core/types.d.ts +1509 -39
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +13 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/uri/MindooURI.d.ts +53 -1
- package/dist/core/uri/MindooURI.d.ts.map +1 -1
- package/dist/core/uri/MindooURI.js +135 -0
- package/dist/core/uri/MindooURI.js.map +1 -1
- package/dist/core/utils/urlSafety.d.ts +46 -0
- package/dist/core/utils/urlSafety.d.ts.map +1 -0
- package/dist/core/utils/urlSafety.js +144 -0
- package/dist/core/utils/urlSafety.js.map +1 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +14 -0
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +1 -1
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js +95 -4
- package/dist/node/appendonlystores/BasicOnDiskContentAddressedStore.js.map +1 -1
- package/dist/node/server/CapabilityMatcher.d.ts +10 -0
- package/dist/node/server/CapabilityMatcher.d.ts.map +1 -1
- package/dist/node/server/CapabilityMatcher.js +14 -2
- package/dist/node/server/CapabilityMatcher.js.map +1 -1
- package/dist/node/server/MindooDBServer.d.ts.map +1 -1
- package/dist/node/server/MindooDBServer.js +117 -8
- package/dist/node/server/MindooDBServer.js.map +1 -1
- package/dist/node/server/PurgedDocRegistry.d.ts +32 -0
- package/dist/node/server/PurgedDocRegistry.d.ts.map +1 -0
- package/dist/node/server/PurgedDocRegistry.js +94 -0
- package/dist/node/server/PurgedDocRegistry.js.map +1 -0
- package/dist/node/server/ServerSync.d.ts.map +1 -1
- package/dist/node/server/ServerSync.js +5 -2
- package/dist/node/server/ServerSync.js.map +1 -1
- package/dist/node/server/SystemAdminAuth.d.ts +10 -0
- package/dist/node/server/SystemAdminAuth.d.ts.map +1 -1
- package/dist/node/server/SystemAdminAuth.js +25 -0
- package/dist/node/server/SystemAdminAuth.js.map +1 -1
- package/dist/node/server/TenantManager.d.ts +95 -1
- package/dist/node/server/TenantManager.d.ts.map +1 -1
- package/dist/node/server/TenantManager.js +382 -15
- package/dist/node/server/TenantManager.js.map +1 -1
- package/dist/node/server/config.d.ts.map +1 -1
- package/dist/node/server/config.js +5 -1
- package/dist/node/server/config.js.map +1 -1
- package/dist/node/server/types.d.ts +29 -3
- package/dist/node/server/types.d.ts.map +1 -1
- package/dist/node/server/types.js +12 -0
- package/dist/node/server/types.js.map +1 -1
- package/dist/node/server/validation.d.ts +6 -0
- package/dist/node/server/validation.d.ts.map +1 -1
- package/dist/node/server/validation.js +7 -1
- package/dist/node/server/validation.js.map +1 -1
- package/package.json +4 -3
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts +0 -8
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.d.ts.map +0 -1
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js +0 -16
- package/dist/appendonlystores/BasicOnDiskContentAddressedStoreFactory.js.map +0 -1
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts +0 -68
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.d.ts.map +0 -1
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js +0 -659
- package/dist/core/appendonlystores/BasicOnDiskContentAddressedStore.js.map +0 -1
- package/dist/node/attachments/writeAttachmentToFile.d.ts +0 -15
- package/dist/node/attachments/writeAttachmentToFile.d.ts.map +0 -1
- package/dist/node/attachments/writeAttachmentToFile.js +0 -73
- package/dist/node/attachments/writeAttachmentToFile.js.map +0 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ATTACHMENTS_FIELD = void 0;
|
|
4
|
+
exports.resolveFieldPath = resolveFieldPath;
|
|
5
|
+
exports.estimateValueSize = estimateValueSize;
|
|
6
|
+
exports.extractSummaryFields = extractSummaryFields;
|
|
7
|
+
exports.getSummaryFieldValue = getSummaryFieldValue;
|
|
8
|
+
exports.buildSummaryEvaluationDoc = buildSummaryEvaluationDoc;
|
|
9
|
+
exports.isFieldPathCovered = isFieldPathCovered;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a dot-separated path against a plain JS object. Only object
|
|
12
|
+
* traversal is supported (no array indices) — mirroring the field-path
|
|
13
|
+
* semantics of the expression language's `getFieldValue`.
|
|
14
|
+
*/
|
|
15
|
+
function resolveFieldPath(data, path) {
|
|
16
|
+
if (!path.includes(".")) {
|
|
17
|
+
return data[path];
|
|
18
|
+
}
|
|
19
|
+
let current = data;
|
|
20
|
+
for (const segment of path.split(".")) {
|
|
21
|
+
if (current === null || typeof current !== "object" || Array.isArray(current)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
current = current[segment];
|
|
25
|
+
}
|
|
26
|
+
return current;
|
|
27
|
+
}
|
|
28
|
+
function isScalar(value) {
|
|
29
|
+
return (value === null ||
|
|
30
|
+
typeof value === "string" ||
|
|
31
|
+
typeof value === "number" ||
|
|
32
|
+
typeof value === "boolean");
|
|
33
|
+
}
|
|
34
|
+
/** Scalars and flat arrays of scalars qualify for auto-include. */
|
|
35
|
+
function isAutoIncludableValue(value) {
|
|
36
|
+
if (isScalar(value)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(value)) {
|
|
40
|
+
return value.every((item) => isScalar(item));
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Approximate serialized size of a value (JSON string length). Good enough
|
|
46
|
+
* as a guard against pathologically large summary values; not an exact
|
|
47
|
+
* byte count for multi-byte characters.
|
|
48
|
+
*/
|
|
49
|
+
function estimateValueSize(value) {
|
|
50
|
+
if (value === undefined) {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === "string") {
|
|
54
|
+
return value.length + 2;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const json = JSON.stringify(value);
|
|
58
|
+
return json === undefined ? 0 : json.length;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return Number.POSITIVE_INFINITY;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function isExcluded(path, exclude) {
|
|
65
|
+
for (const excluded of exclude) {
|
|
66
|
+
if (path === excluded || path.startsWith(excluded + ".")) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Fields following the encrypted-field convention (`*_encrypted` plus the
|
|
74
|
+
* `*_encrypted_key` companion). Their values are ciphertext — useless in
|
|
75
|
+
* the summary (evaluating them requires `decrypt`, which needs the
|
|
76
|
+
* materialized document anyway), so auto-include skips them. An explicit
|
|
77
|
+
* `include` still wins for callers who really want the raw ciphertext.
|
|
78
|
+
*/
|
|
79
|
+
function isEncryptedConventionField(key) {
|
|
80
|
+
return key.endsWith("_encrypted") || key.endsWith("_encrypted_key");
|
|
81
|
+
}
|
|
82
|
+
/** Attachment metadata field managed by MindooDB on every document. */
|
|
83
|
+
exports.ATTACHMENTS_FIELD = "_attachments";
|
|
84
|
+
function projectAttachments(value) {
|
|
85
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const projected = [];
|
|
89
|
+
for (const item of value) {
|
|
90
|
+
if (item === null || typeof item !== "object") {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const raw = item;
|
|
94
|
+
const info = {};
|
|
95
|
+
if (typeof raw.attachmentId === "string")
|
|
96
|
+
info.attachmentId = raw.attachmentId;
|
|
97
|
+
if (typeof raw.fileName === "string")
|
|
98
|
+
info.fileName = raw.fileName;
|
|
99
|
+
if (typeof raw.size === "number" && Number.isFinite(raw.size))
|
|
100
|
+
info.size = raw.size;
|
|
101
|
+
if (typeof raw.mimeType === "string")
|
|
102
|
+
info.mimeType = raw.mimeType;
|
|
103
|
+
if (typeof raw.createdAt === "number" && Number.isFinite(raw.createdAt)) {
|
|
104
|
+
info.createdAt = raw.createdAt;
|
|
105
|
+
}
|
|
106
|
+
if (typeof raw.extractedText === "string" && raw.extractedText.length > 0) {
|
|
107
|
+
info.hasExtractedText = true;
|
|
108
|
+
}
|
|
109
|
+
projected.push(info);
|
|
110
|
+
}
|
|
111
|
+
return projected.length > 0 ? projected : undefined;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extract the summary field map for one document payload according to the
|
|
115
|
+
* resolved configuration:
|
|
116
|
+
*
|
|
117
|
+
* 1. auto-include (when enabled): every non-underscore top-level field with
|
|
118
|
+
* a scalar (or scalar-array) value whose serialized size stays within
|
|
119
|
+
* `maxValueBytes`
|
|
120
|
+
* 2. explicit `include` paths: any value type, no size cap, keyed by the
|
|
121
|
+
* full dot-path
|
|
122
|
+
* 3. `exclude` wins over both (and covers nested paths)
|
|
123
|
+
*/
|
|
124
|
+
function extractSummaryFields(data, config) {
|
|
125
|
+
const fields = {};
|
|
126
|
+
if (config.autoInclude) {
|
|
127
|
+
for (const [key, value] of Object.entries(data)) {
|
|
128
|
+
if (key.startsWith("_")) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (isEncryptedConventionField(key)) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (isExcluded(key, config.exclude)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (!isAutoIncludableValue(value)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (estimateValueSize(value) > config.maxValueBytes) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
fields[key] = value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const path of config.include) {
|
|
147
|
+
if (isExcluded(path, config.exclude)) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const value = resolveFieldPath(data, path);
|
|
151
|
+
if (value !== undefined) {
|
|
152
|
+
fields[path] = value;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Managed attachment metadata: stored as a slim projection so attachment
|
|
156
|
+
// expressions work on the summary path without dragging internal
|
|
157
|
+
// plumbing or the creator's signing key into every bucket.
|
|
158
|
+
if (config.includeAttachments && !isExcluded(exports.ATTACHMENTS_FIELD, config.exclude)) {
|
|
159
|
+
const attachments = projectAttachments(data[exports.ATTACHMENTS_FIELD]);
|
|
160
|
+
if (attachments !== undefined) {
|
|
161
|
+
fields[exports.ATTACHMENTS_FIELD] = attachments;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return fields;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Path-aware lookup on an extracted summary field map: explicit include
|
|
168
|
+
* entries are stored under their full dot-path, auto-included fields under
|
|
169
|
+
* the top-level name (so nested lookups traverse the stored value).
|
|
170
|
+
*/
|
|
171
|
+
function getSummaryFieldValue(fields, path) {
|
|
172
|
+
if (Object.prototype.hasOwnProperty.call(fields, path)) {
|
|
173
|
+
return fields[path];
|
|
174
|
+
}
|
|
175
|
+
return resolveFieldPath(fields, path);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Builds the document object expressions are evaluated against from a
|
|
179
|
+
* stored summary field map. Explicit include entries are stored flat under
|
|
180
|
+
* their full dot-path (`"meta.owner"`); expression evaluation resolves
|
|
181
|
+
* `field` paths by object traversal, so dot-keys are expanded into nested
|
|
182
|
+
* objects here. Maps without dot-keys are returned as-is (no copy).
|
|
183
|
+
*
|
|
184
|
+
* When `lastModified` is passed, it is mirrored as `_lastModified` (the
|
|
185
|
+
* managed timestamp field of the materialized document), so expressions
|
|
186
|
+
* referencing it behave identically on the summary and document paths.
|
|
187
|
+
*/
|
|
188
|
+
function buildSummaryEvaluationDoc(fields, lastModified) {
|
|
189
|
+
let hasDotKey = false;
|
|
190
|
+
for (const key of Object.keys(fields)) {
|
|
191
|
+
if (key.includes(".")) {
|
|
192
|
+
hasDotKey = true;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (!hasDotKey) {
|
|
197
|
+
if (lastModified === undefined) {
|
|
198
|
+
return fields;
|
|
199
|
+
}
|
|
200
|
+
return { ...fields, _lastModified: lastModified };
|
|
201
|
+
}
|
|
202
|
+
const doc = {};
|
|
203
|
+
if (lastModified !== undefined) {
|
|
204
|
+
doc._lastModified = lastModified;
|
|
205
|
+
}
|
|
206
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
207
|
+
if (!key.includes(".")) {
|
|
208
|
+
doc[key] = value;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const parts = key.split(".");
|
|
212
|
+
let current = doc;
|
|
213
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
214
|
+
const next = current[parts[i]];
|
|
215
|
+
if (next !== null && typeof next === "object" && !Array.isArray(next)) {
|
|
216
|
+
current = next;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const created = {};
|
|
220
|
+
current[parts[i]] = created;
|
|
221
|
+
current = created;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
current[parts[parts.length - 1]] = value;
|
|
225
|
+
}
|
|
226
|
+
return doc;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Whether a field path is covered by the summary configuration, i.e.
|
|
230
|
+
* queries against it can be answered from the summary buffer.
|
|
231
|
+
*
|
|
232
|
+
* Top-level fields (and nested paths below them) are covered by
|
|
233
|
+
* auto-include; nested paths are additionally covered when explicitly
|
|
234
|
+
* included. Excluded paths are never covered. Note that coverage is a
|
|
235
|
+
* configuration-level statement — an individual document may still lack a
|
|
236
|
+
* value (missing field, non-scalar value, or above the size cap).
|
|
237
|
+
*/
|
|
238
|
+
function isFieldPathCovered(path, config) {
|
|
239
|
+
if (isExcluded(path, config.exclude)) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
for (const included of config.include) {
|
|
243
|
+
if (path === included || path.startsWith(included + ".")) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const topLevel = path.includes(".") ? path.slice(0, path.indexOf(".")) : path;
|
|
248
|
+
// Managed fields with special handling: the slim attachment projection
|
|
249
|
+
// (when enabled) and the always-mirrored modification timestamp.
|
|
250
|
+
if (topLevel === exports.ATTACHMENTS_FIELD) {
|
|
251
|
+
return config.includeAttachments;
|
|
252
|
+
}
|
|
253
|
+
if (path === "_lastModified") {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
if (config.autoInclude && !topLevel.startsWith("_")) {
|
|
257
|
+
// Encrypted-convention fields are skipped by auto-include (ciphertext
|
|
258
|
+
// is not queryable); only an explicit include covers them (above).
|
|
259
|
+
if (isEncryptedConventionField(topLevel)) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=extractSummaryFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractSummaryFields.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/extractSummaryFields.ts"],"names":[],"mappings":";;;AAOA,4CAYC;AA2BD,8CAaC;AAiFD,oDAgDC;AAOD,oDAQC;AAaD,8DA0CC;AAYD,gDA2BC;AAvSD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAA6B,EAAE,IAAY;IAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,OAAO,GAAY,IAAI,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9E,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS,CAC3B,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAA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AC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,uEAAuE;IACvE,iEAAiE;IACjE,IAAI,QAAQ,KAAK,yBAAiB,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,kBAAkB,CAAC;IACnC,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,sEAAsE;QACtE,mEAAmE;QACnE,IAAI,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DocumentSummaryStore } from "./DocumentSummaryStore";
|
|
2
|
+
export { SummaryVirtualViewDataProvider, type SummaryVirtualViewDataProviderOptions, } from "./SummaryVirtualViewDataProvider";
|
|
3
|
+
export { resolveSummaryConfig, computeSummaryConfigFingerprint, sanitizeSummaryConfig, DEFAULT_SUMMARY_MAX_VALUE_BYTES, DB_SETUP_DOC_ID, SUMMARY_SETUP_FIELD, type SummaryConfig, type ResolvedSummaryConfig, type DocumentSummaryEntry, type SummaryCoverage, } from "./types";
|
|
4
|
+
export { extractSummaryFields, getSummaryFieldValue, isFieldPathCovered, resolveFieldPath, estimateValueSize, buildSummaryEvaluationDoc, ATTACHMENTS_FIELD, type SummaryAttachmentInfo, } from "./extractSummaryFields";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/summary/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,KAAK,qCAAqC,GAC3C,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,qBAAqB,EACrB,+BAA+B,EAC/B,eAAe,EACf,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,qBAAqB,GAC3B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ATTACHMENTS_FIELD = exports.buildSummaryEvaluationDoc = exports.estimateValueSize = exports.resolveFieldPath = exports.isFieldPathCovered = exports.getSummaryFieldValue = exports.extractSummaryFields = exports.SUMMARY_SETUP_FIELD = exports.DB_SETUP_DOC_ID = exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES = exports.sanitizeSummaryConfig = exports.computeSummaryConfigFingerprint = exports.resolveSummaryConfig = exports.SummaryVirtualViewDataProvider = exports.DocumentSummaryStore = void 0;
|
|
4
|
+
var DocumentSummaryStore_1 = require("./DocumentSummaryStore");
|
|
5
|
+
Object.defineProperty(exports, "DocumentSummaryStore", { enumerable: true, get: function () { return DocumentSummaryStore_1.DocumentSummaryStore; } });
|
|
6
|
+
var SummaryVirtualViewDataProvider_1 = require("./SummaryVirtualViewDataProvider");
|
|
7
|
+
Object.defineProperty(exports, "SummaryVirtualViewDataProvider", { enumerable: true, get: function () { return SummaryVirtualViewDataProvider_1.SummaryVirtualViewDataProvider; } });
|
|
8
|
+
var types_1 = require("./types");
|
|
9
|
+
Object.defineProperty(exports, "resolveSummaryConfig", { enumerable: true, get: function () { return types_1.resolveSummaryConfig; } });
|
|
10
|
+
Object.defineProperty(exports, "computeSummaryConfigFingerprint", { enumerable: true, get: function () { return types_1.computeSummaryConfigFingerprint; } });
|
|
11
|
+
Object.defineProperty(exports, "sanitizeSummaryConfig", { enumerable: true, get: function () { return types_1.sanitizeSummaryConfig; } });
|
|
12
|
+
Object.defineProperty(exports, "DEFAULT_SUMMARY_MAX_VALUE_BYTES", { enumerable: true, get: function () { return types_1.DEFAULT_SUMMARY_MAX_VALUE_BYTES; } });
|
|
13
|
+
Object.defineProperty(exports, "DB_SETUP_DOC_ID", { enumerable: true, get: function () { return types_1.DB_SETUP_DOC_ID; } });
|
|
14
|
+
Object.defineProperty(exports, "SUMMARY_SETUP_FIELD", { enumerable: true, get: function () { return types_1.SUMMARY_SETUP_FIELD; } });
|
|
15
|
+
var extractSummaryFields_1 = require("./extractSummaryFields");
|
|
16
|
+
Object.defineProperty(exports, "extractSummaryFields", { enumerable: true, get: function () { return extractSummaryFields_1.extractSummaryFields; } });
|
|
17
|
+
Object.defineProperty(exports, "getSummaryFieldValue", { enumerable: true, get: function () { return extractSummaryFields_1.getSummaryFieldValue; } });
|
|
18
|
+
Object.defineProperty(exports, "isFieldPathCovered", { enumerable: true, get: function () { return extractSummaryFields_1.isFieldPathCovered; } });
|
|
19
|
+
Object.defineProperty(exports, "resolveFieldPath", { enumerable: true, get: function () { return extractSummaryFields_1.resolveFieldPath; } });
|
|
20
|
+
Object.defineProperty(exports, "estimateValueSize", { enumerable: true, get: function () { return extractSummaryFields_1.estimateValueSize; } });
|
|
21
|
+
Object.defineProperty(exports, "buildSummaryEvaluationDoc", { enumerable: true, get: function () { return extractSummaryFields_1.buildSummaryEvaluationDoc; } });
|
|
22
|
+
Object.defineProperty(exports, "ATTACHMENTS_FIELD", { enumerable: true, get: function () { return extractSummaryFields_1.ATTACHMENTS_FIELD; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/index.ts"],"names":[],"mappings":";;;AAAA,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,mFAG0C;AAFxC,gJAAA,8BAA8B,OAAA;AAGhC,iCAWiB;AAVf,6GAAA,oBAAoB,OAAA;AACpB,wHAAA,+BAA+B,OAAA;AAC/B,8GAAA,qBAAqB,OAAA;AACrB,wHAAA,+BAA+B,OAAA;AAC/B,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AAMrB,+DASgC;AAR9B,4HAAA,oBAAoB,OAAA;AACpB,4HAAA,oBAAoB,OAAA;AACpB,0HAAA,kBAAkB,OAAA;AAClB,wHAAA,gBAAgB,OAAA;AAChB,yHAAA,iBAAiB,OAAA;AACjB,iIAAA,yBAAyB,OAAA;AACzB,yHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ProcessChangesCursor } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Fixed ID of the per-database setup document. It syncs like any other
|
|
4
|
+
* document, giving users/apps (e.g. the Haven UI) one shared place to
|
|
5
|
+
* configure database-level settings across all replicas. Custom-ID
|
|
6
|
+
* documents share seeded Automerge ancestry, so independently created
|
|
7
|
+
* `dbsetup` documents merge cleanly.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DB_SETUP_DOC_ID = "dbsetup";
|
|
10
|
+
/**
|
|
11
|
+
* Field of the {@link DB_SETUP_DOC_ID} document holding the
|
|
12
|
+
* {@link SummaryConfig} used by summary stores that were not given an
|
|
13
|
+
* explicit configuration in code.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SUMMARY_SETUP_FIELD = "summarySetup";
|
|
16
|
+
/**
|
|
17
|
+
* Configuration describing which document fields are copied into the
|
|
18
|
+
* summary buffer (see docs/adhoc-queries.md).
|
|
19
|
+
*
|
|
20
|
+
* The summary is a derived, local index — unlike Notes summary items the
|
|
21
|
+
* configuration is NOT part of the documents. Changing it never rewrites
|
|
22
|
+
* documents; it only triggers a resumable backfill run over the changefeed.
|
|
23
|
+
*/
|
|
24
|
+
export interface SummaryConfig {
|
|
25
|
+
/**
|
|
26
|
+
* When `true` (default), every non-underscore top-level field whose value
|
|
27
|
+
* is a scalar (string/number/boolean/null) or an array of scalars is
|
|
28
|
+
* included automatically, as long as its serialized size does not exceed
|
|
29
|
+
* {@link maxValueBytes}.
|
|
30
|
+
*/
|
|
31
|
+
autoInclude?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Size cap (approximate, JSON-serialized length) for auto-included
|
|
34
|
+
* values. Values above the cap are skipped — queries on such fields see
|
|
35
|
+
* them as absent. Explicitly `include`d paths are NOT subject to the cap.
|
|
36
|
+
* Default: 1024.
|
|
37
|
+
*/
|
|
38
|
+
maxValueBytes?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Dot-separated paths to include explicitly. Unlike auto-include these
|
|
41
|
+
* may be nested (`"meta.author"`), may resolve to non-scalar values, and
|
|
42
|
+
* bypass the size cap. The value is stored under the full path as key.
|
|
43
|
+
*/
|
|
44
|
+
include?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Dot-separated paths to exclude. Wins over auto-include and `include`;
|
|
47
|
+
* an exclude also covers all nested paths below it.
|
|
48
|
+
*/
|
|
49
|
+
exclude?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* When `true` (default), a slim projection of the document's
|
|
52
|
+
* `_attachments` array (`fileName`, `size`, `mimeType`, `createdAt` per
|
|
53
|
+
* attachment) is stored in the summary, so attachment expressions
|
|
54
|
+
* (`attachmentNames()`, `attachmentLengths()`, `attachmentCount()`) work
|
|
55
|
+
* on the summary path. Internal plumbing (`lastChunkId`,
|
|
56
|
+
* `decryptionKeyId`) and the creator's full signing key (`createdBy`)
|
|
57
|
+
* are deliberately not copied.
|
|
58
|
+
*/
|
|
59
|
+
includeAttachments?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** {@link SummaryConfig} with all defaults applied. */
|
|
62
|
+
export interface ResolvedSummaryConfig {
|
|
63
|
+
autoInclude: boolean;
|
|
64
|
+
maxValueBytes: number;
|
|
65
|
+
include: string[];
|
|
66
|
+
exclude: string[];
|
|
67
|
+
includeAttachments: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare const DEFAULT_SUMMARY_MAX_VALUE_BYTES = 1024;
|
|
70
|
+
export declare function resolveSummaryConfig(config?: SummaryConfig): ResolvedSummaryConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Extract a {@link SummaryConfig} from an untyped value (the
|
|
73
|
+
* `summarySetup` field of the synced setup document). Unknown properties
|
|
74
|
+
* are dropped and wrongly-typed ones ignored, so a malformed document can
|
|
75
|
+
* never break summary maintenance. Returns `undefined` when the value is
|
|
76
|
+
* not an object (missing field, deleted document) — callers fall back to
|
|
77
|
+
* the default configuration.
|
|
78
|
+
*/
|
|
79
|
+
export declare function sanitizeSummaryConfig(value: unknown): SummaryConfig | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Deterministic fingerprint of a summary configuration. Persisted alongside
|
|
82
|
+
* the summary cache; a mismatch on restore (or a config change at runtime)
|
|
83
|
+
* marks the summary as `"rebuilding"` and triggers a backfill.
|
|
84
|
+
*/
|
|
85
|
+
export declare function computeSummaryConfigFingerprint(config: ResolvedSummaryConfig): string;
|
|
86
|
+
/** One document's entry in the summary buffer. */
|
|
87
|
+
export interface DocumentSummaryEntry {
|
|
88
|
+
docId: string;
|
|
89
|
+
/**
|
|
90
|
+
* Flat map of extracted values. Auto-included top-level fields are keyed
|
|
91
|
+
* by field name; explicitly included paths are keyed by their full
|
|
92
|
+
* dot-path. Use `getSummaryFieldValue()` for path-aware lookups.
|
|
93
|
+
*/
|
|
94
|
+
fields: Record<string, unknown>;
|
|
95
|
+
lastModified: number;
|
|
96
|
+
/** Changefeed sequence of the change this entry was extracted from. */
|
|
97
|
+
changeSeq: number;
|
|
98
|
+
decryptionKeyId: string | null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Coverage state reported by query results: `"full"` when the summary
|
|
102
|
+
* reflects the current configuration for all documents, `"rebuilding"`
|
|
103
|
+
* while a config-change backfill is still in progress (entries extracted
|
|
104
|
+
* with the previous configuration may still be served).
|
|
105
|
+
*/
|
|
106
|
+
export type SummaryCoverage = "full" | "rebuilding";
|
|
107
|
+
/** Serialized shape of one persisted summary bucket. */
|
|
108
|
+
export interface SummaryBucketPayload {
|
|
109
|
+
entries: DocumentSummaryEntry[];
|
|
110
|
+
}
|
|
111
|
+
/** Serialized shape of the persisted summary metadata record. */
|
|
112
|
+
export interface SummaryMetaPayload {
|
|
113
|
+
cursor: ProcessChangesCursor | null;
|
|
114
|
+
configFingerprint: string;
|
|
115
|
+
bucketCount: number;
|
|
116
|
+
needsBackfill: boolean;
|
|
117
|
+
backfillCursor: ProcessChangesCursor | null;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/indexing/summary/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE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IACvB,cAAc,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC7C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES = exports.SUMMARY_SETUP_FIELD = exports.DB_SETUP_DOC_ID = void 0;
|
|
4
|
+
exports.resolveSummaryConfig = resolveSummaryConfig;
|
|
5
|
+
exports.sanitizeSummaryConfig = sanitizeSummaryConfig;
|
|
6
|
+
exports.computeSummaryConfigFingerprint = computeSummaryConfigFingerprint;
|
|
7
|
+
/**
|
|
8
|
+
* Fixed ID of the per-database setup document. It syncs like any other
|
|
9
|
+
* document, giving users/apps (e.g. the Haven UI) one shared place to
|
|
10
|
+
* configure database-level settings across all replicas. Custom-ID
|
|
11
|
+
* documents share seeded Automerge ancestry, so independently created
|
|
12
|
+
* `dbsetup` documents merge cleanly.
|
|
13
|
+
*/
|
|
14
|
+
exports.DB_SETUP_DOC_ID = "dbsetup";
|
|
15
|
+
/**
|
|
16
|
+
* Field of the {@link DB_SETUP_DOC_ID} document holding the
|
|
17
|
+
* {@link SummaryConfig} used by summary stores that were not given an
|
|
18
|
+
* explicit configuration in code.
|
|
19
|
+
*/
|
|
20
|
+
exports.SUMMARY_SETUP_FIELD = "summarySetup";
|
|
21
|
+
exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES = 1024;
|
|
22
|
+
function resolveSummaryConfig(config) {
|
|
23
|
+
return {
|
|
24
|
+
autoInclude: config?.autoInclude ?? true,
|
|
25
|
+
maxValueBytes: Math.max(0, config?.maxValueBytes ?? exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES),
|
|
26
|
+
include: [...(config?.include ?? [])],
|
|
27
|
+
exclude: [...(config?.exclude ?? [])],
|
|
28
|
+
includeAttachments: config?.includeAttachments ?? true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Extract a {@link SummaryConfig} from an untyped value (the
|
|
33
|
+
* `summarySetup` field of the synced setup document). Unknown properties
|
|
34
|
+
* are dropped and wrongly-typed ones ignored, so a malformed document can
|
|
35
|
+
* never break summary maintenance. Returns `undefined` when the value is
|
|
36
|
+
* not an object (missing field, deleted document) — callers fall back to
|
|
37
|
+
* the default configuration.
|
|
38
|
+
*/
|
|
39
|
+
function sanitizeSummaryConfig(value) {
|
|
40
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const raw = value;
|
|
44
|
+
const config = {};
|
|
45
|
+
if (typeof raw.autoInclude === "boolean") {
|
|
46
|
+
config.autoInclude = raw.autoInclude;
|
|
47
|
+
}
|
|
48
|
+
if (typeof raw.maxValueBytes === "number" && Number.isFinite(raw.maxValueBytes)) {
|
|
49
|
+
config.maxValueBytes = raw.maxValueBytes;
|
|
50
|
+
}
|
|
51
|
+
const stringList = (input) => Array.isArray(input)
|
|
52
|
+
? input.filter((item) => typeof item === "string")
|
|
53
|
+
: undefined;
|
|
54
|
+
const include = stringList(raw.include);
|
|
55
|
+
if (include) {
|
|
56
|
+
config.include = include;
|
|
57
|
+
}
|
|
58
|
+
const exclude = stringList(raw.exclude);
|
|
59
|
+
if (exclude) {
|
|
60
|
+
config.exclude = exclude;
|
|
61
|
+
}
|
|
62
|
+
if (typeof raw.includeAttachments === "boolean") {
|
|
63
|
+
config.includeAttachments = raw.includeAttachments;
|
|
64
|
+
}
|
|
65
|
+
return config;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Deterministic fingerprint of a summary configuration. Persisted alongside
|
|
69
|
+
* the summary cache; a mismatch on restore (or a config change at runtime)
|
|
70
|
+
* marks the summary as `"rebuilding"` and triggers a backfill.
|
|
71
|
+
*/
|
|
72
|
+
function computeSummaryConfigFingerprint(config) {
|
|
73
|
+
return JSON.stringify({
|
|
74
|
+
autoInclude: config.autoInclude,
|
|
75
|
+
maxValueBytes: config.maxValueBytes,
|
|
76
|
+
include: [...config.include].sort(),
|
|
77
|
+
exclude: [...config.exclude].sort(),
|
|
78
|
+
includeAttachments: config.includeAttachments,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/types.ts"],"names":[],"mappings":";;;AA+EA,oDAQC;AAUD,sDA4BC;AAOD,0EAQC;AA1ID;;;;;;GAMG;AACU,QAAA,eAAe,GAAG,SAAS,CAAC;AAEzC;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,cAAc,CAAC;AA6DrC,QAAA,+BAA+B,GAAG,IAAI,CAAC;AAEpD,SAAgB,oBAAoB,CAAC,MAAsB;IACzD,OAAO;QACL,WAAW,EAAE,MAAM,EAAE,WAAW,IAAI,IAAI;QACxC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,IAAI,uCAA+B,CAAC;QACpF,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QACrC,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,IAAI,IAAI;KACvD,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,KAAc;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,OAAO,GAAG,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC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AAC,IAAI,EAAE;QACnC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;KAC9C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
import type { VirtualView } from "./VirtualView";
|
|
2
|
+
/**
|
|
3
|
+
* Progress snapshot passed to {@link VirtualViewUpdateOptions.onProgress}.
|
|
4
|
+
*/
|
|
5
|
+
export interface VirtualViewUpdateProgress {
|
|
6
|
+
/** Documents processed so far in this update run. */
|
|
7
|
+
processed: number;
|
|
8
|
+
/**
|
|
9
|
+
* Total number of changefeed entries pending at the start of the run
|
|
10
|
+
* (best effort; new changes arriving mid-run are not counted).
|
|
11
|
+
*/
|
|
12
|
+
total: number;
|
|
13
|
+
/** Origin of the data provider reporting progress. */
|
|
14
|
+
origin: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Options controlling an incremental view update run.
|
|
18
|
+
*
|
|
19
|
+
* Batching makes long update runs observable and interruptible: after every
|
|
20
|
+
* `applyBatchSize` processed documents the accumulated changes are applied to
|
|
21
|
+
* the view (so the view and the provider cursor stay consistent), progress is
|
|
22
|
+
* reported, and the run can be cancelled. An interrupted run resumes from the
|
|
23
|
+
* saved cursor on the next `update()` call — no work is repeated.
|
|
24
|
+
*/
|
|
25
|
+
export interface VirtualViewUpdateOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Apply accumulated changes to the view (and report progress) after this
|
|
28
|
+
* many processed documents. Default: 100. Use `Infinity` to apply all
|
|
29
|
+
* changes atomically at the end of the run (progress is then only
|
|
30
|
+
* reported once, and the run cannot be interrupted mid-way).
|
|
31
|
+
*/
|
|
32
|
+
applyBatchSize?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Called at every batch boundary (and once at the end of the run).
|
|
35
|
+
* Return `false` to stop the update after the current batch; the cursor
|
|
36
|
+
* points at the last applied document, so the next update resumes there.
|
|
37
|
+
*/
|
|
38
|
+
onProgress?: (progress: VirtualViewUpdateProgress) => boolean | void;
|
|
39
|
+
/**
|
|
40
|
+
* Optional abort signal, checked at every batch boundary. Aborting behaves
|
|
41
|
+
* like `onProgress` returning `false`: the current batch is applied, then
|
|
42
|
+
* the run stops cleanly.
|
|
43
|
+
*/
|
|
44
|
+
signal?: AbortSignal;
|
|
45
|
+
}
|
|
2
46
|
/**
|
|
3
47
|
* Interface for classes that provide data to a VirtualView.
|
|
4
48
|
* Data providers fetch documents from a source (like MindooDB) and
|
|
@@ -24,8 +68,10 @@ export interface IVirtualViewDataProvider {
|
|
|
24
68
|
* Fetches the latest data and sends updates to the VirtualView.
|
|
25
69
|
* This should be idempotent and handle incremental updates efficiently.
|
|
26
70
|
*
|
|
71
|
+
* @param options Optional batching/progress/cancellation options.
|
|
72
|
+
* Providers that do not support batching may ignore them.
|
|
27
73
|
* @returns A promise that resolves when the update is complete
|
|
28
74
|
*/
|
|
29
|
-
update(): Promise<void>;
|
|
75
|
+
update(options?: VirtualViewUpdateOptions): Promise<void>;
|
|
30
76
|
}
|
|
31
77
|
//# sourceMappingURL=IVirtualViewDataProvider.d.ts.map
|
|
@@ -1 +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
|
|
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;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,OAAO,GAAG,IAAI,CAAC;IACrE;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAE9B;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MindooDB, ProcessChangesCursor } from "../../types";
|
|
2
|
-
import type { IVirtualViewDataProvider } from "./IVirtualViewDataProvider";
|
|
2
|
+
import type { IVirtualViewDataProvider, VirtualViewUpdateOptions } from "./IVirtualViewDataProvider";
|
|
3
3
|
import type { VirtualView } from "./VirtualView";
|
|
4
4
|
import type { DocumentFilterFunction } from "./types";
|
|
5
5
|
/**
|
|
@@ -12,19 +12,29 @@ export interface MindooDBVirtualViewDataProviderOptions {
|
|
|
12
12
|
db: MindooDB;
|
|
13
13
|
/** Optional filter function to select which documents to include */
|
|
14
14
|
filterFunction?: DocumentFilterFunction;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* When `true`, every (non-underscore) document field is copied into the
|
|
17
|
+
* view entry's column values, mirroring the legacy behavior. Defaults to
|
|
18
|
+
* `false`: only the fields the view's columns reference are kept, which
|
|
19
|
+
* significantly reduces memory usage and view-cache size for documents
|
|
20
|
+
* with large payloads. Enable this for consumers that need free-form
|
|
21
|
+
* field access on view entries (e.g. formula languages evaluating
|
|
22
|
+
* arbitrary fields at read time).
|
|
23
|
+
*/
|
|
24
|
+
includeAllDocumentFields?: boolean;
|
|
17
25
|
}
|
|
18
26
|
/**
|
|
19
27
|
* Data provider that reads documents from a MindooDB and provides them
|
|
20
|
-
* to a VirtualView.
|
|
21
|
-
*
|
|
28
|
+
* to a VirtualView. Incremental updates are driven by
|
|
29
|
+
* `iterateChangesSince`, which prefetches upcoming documents in parallel
|
|
30
|
+
* and emits lightweight tombstones for deleted and inaccessible documents,
|
|
31
|
+
* so removals never pay document materialization.
|
|
22
32
|
*/
|
|
23
33
|
export declare class MindooDBVirtualViewDataProvider implements IVirtualViewDataProvider {
|
|
24
34
|
private readonly origin;
|
|
25
35
|
private readonly db;
|
|
26
36
|
private readonly filterFunction;
|
|
27
|
-
private readonly
|
|
37
|
+
private readonly includeAllDocumentFields;
|
|
28
38
|
private view;
|
|
29
39
|
private cursor;
|
|
30
40
|
/** Track documents currently in the view from this provider */
|
|
@@ -32,9 +42,15 @@ export declare class MindooDBVirtualViewDataProvider implements IVirtualViewData
|
|
|
32
42
|
constructor(options: MindooDBVirtualViewDataProviderOptions);
|
|
33
43
|
getOrigin(): string;
|
|
34
44
|
init(view: VirtualView): void;
|
|
35
|
-
update(): Promise<void>;
|
|
45
|
+
update(options?: VirtualViewUpdateOptions): Promise<void>;
|
|
36
46
|
/**
|
|
37
|
-
* Compute column values for a document using column value functions
|
|
47
|
+
* Compute column values for a document using column value functions.
|
|
48
|
+
*
|
|
49
|
+
* By default only the fields the view's columns reference are copied into
|
|
50
|
+
* the result, keeping view entries (and the serialized view cache) small.
|
|
51
|
+
* With `includeAllDocumentFields: true` every non-underscore document
|
|
52
|
+
* field is copied first, mirroring the legacy behavior for consumers that
|
|
53
|
+
* need free-form field access on view entries.
|
|
38
54
|
*/
|
|
39
55
|
private computeColumnValues;
|
|
40
56
|
/**
|