holosphere 2.0.0-alpha8 → 2.0.0-alpha9
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/CHANGELOG.md +446 -0
- package/FEATURES.md +431 -0
- package/LICENSE +29 -166
- package/LICENSE-AGPL.md +180 -0
- package/dist/cdn/holosphere.min.js +55 -0
- package/dist/cdn/holosphere.min.js.map +1 -0
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +1 -1
- package/dist/{index-CKffQDmQ.cjs → index-DDGt_V9o.cjs} +2 -2
- package/dist/{index-CKffQDmQ.cjs.map → index-DDGt_V9o.cjs.map} +1 -1
- package/dist/{index-4XHHKe6S.js → index-DJXftyvB.js} +1905 -337
- package/dist/index-DJXftyvB.js.map +1 -0
- package/dist/{index-Dz5kOZMI.cjs → index-DMbdcMtK.cjs} +17 -4
- package/dist/index-DMbdcMtK.cjs.map +1 -0
- package/dist/{index-BjP1TXGz.js → index-DeZ1xz_s.js} +2 -2
- package/dist/{index-BjP1TXGz.js.map → index-DeZ1xz_s.js.map} +1 -1
- package/dist/{indexeddb-storage-lExjjFlV.js → indexeddb-storage-BFt6hMeF.js} +48 -4
- package/dist/indexeddb-storage-BFt6hMeF.js.map +1 -0
- package/dist/{indexeddb-storage-DD7EFBVc.cjs → indexeddb-storage-BK5tv4Sh.cjs} +2 -2
- package/dist/indexeddb-storage-BK5tv4Sh.cjs.map +1 -0
- package/dist/{memory-storage-C68adso2.js → memory-storage-C9HuoL2E.js} +44 -4
- package/dist/memory-storage-C9HuoL2E.js.map +1 -0
- package/dist/{memory-storage-DD_6yyXT.cjs → memory-storage-Dao7jfYG.cjs} +2 -2
- package/dist/memory-storage-Dao7jfYG.cjs.map +1 -0
- package/dist/{secp256k1-DYELiqgx.cjs → secp256k1-BbKzbLtD.cjs} +2 -2
- package/dist/{secp256k1-DYELiqgx.cjs.map → secp256k1-BbKzbLtD.cjs.map} +1 -1
- package/dist/{secp256k1-OM8siPyy.js → secp256k1-CreY7Pcl.js} +2 -2
- package/dist/{secp256k1-OM8siPyy.js.map → secp256k1-CreY7Pcl.js.map} +1 -1
- package/docs/api/ai_aggregation.js.html +333 -0
- package/docs/api/ai_breakdown.js.html +524 -0
- package/docs/api/ai_classifier.js.html +231 -0
- package/docs/api/ai_council.js.html +246 -0
- package/docs/api/ai_embeddings.js.html +304 -0
- package/docs/api/ai_federation-ai.js.html +338 -0
- package/docs/api/ai_h3-ai.js.html +970 -0
- package/docs/api/ai_index.js.html +124 -0
- package/docs/api/ai_json-ops.js.html +241 -0
- package/docs/api/ai_llm-service.js.html +239 -0
- package/docs/api/ai_nl-query.js.html +236 -0
- package/docs/api/ai_relationships.js.html +367 -0
- package/docs/api/ai_schema-extractor.js.html +235 -0
- package/docs/api/ai_spatial.js.html +307 -0
- package/docs/api/ai_tts.js.html +214 -0
- package/docs/api/content_social-protocols.js.html +180 -0
- package/docs/api/core_holosphere.js.html +757 -0
- package/docs/api/crypto_nostr-utils.js.html +306 -0
- package/docs/api/crypto_secp256k1.js.html +267 -0
- package/docs/api/data/search.json +1 -0
- package/docs/api/federation_discovery.js.html +337 -0
- package/docs/api/federation_handshake.js.html +478 -0
- package/docs/api/federation_hologram.js.html +1053 -0
- package/docs/api/federation_registry.js.html +389 -0
- package/docs/api/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/api/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/api/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/api/global.html +3 -0
- package/docs/api/hierarchical_upcast.js.html +128 -0
- package/docs/api/index.html +265 -0
- package/docs/api/index.js.html +1868 -0
- package/docs/api/lib_ai-methods.js.html +660 -0
- package/docs/api/lib_contract-methods.js.html +445 -0
- package/docs/api/lib_errors.js.html +56 -0
- package/docs/api/lib_federation-methods.js.html +348 -0
- package/docs/api/lib_index.js.html +33 -0
- package/docs/api/module-ai.html +5 -0
- package/docs/api/module-ai_aggregation-SmartAggregation.html +6 -0
- package/docs/api/module-ai_aggregation.SmartAggregation.html +3 -0
- package/docs/api/module-ai_aggregation.html +3 -0
- package/docs/api/module-ai_breakdown-TaskBreakdown.html +5 -0
- package/docs/api/module-ai_breakdown.TaskBreakdown.html +3 -0
- package/docs/api/module-ai_breakdown.html +3 -0
- package/docs/api/module-ai_classifier-Classifier.html +6 -0
- package/docs/api/module-ai_classifier.Classifier.html +3 -0
- package/docs/api/module-ai_classifier.html +3 -0
- package/docs/api/module-ai_council-Council.html +6 -0
- package/docs/api/module-ai_council.Council.html +3 -0
- package/docs/api/module-ai_council.html +3 -0
- package/docs/api/module-ai_embeddings-Embeddings.html +5 -0
- package/docs/api/module-ai_embeddings.Embeddings.html +3 -0
- package/docs/api/module-ai_embeddings.html +3 -0
- package/docs/api/module-ai_federation-ai-FederationAdvisor.html +6 -0
- package/docs/api/module-ai_federation-ai.FederationAdvisor.html +3 -0
- package/docs/api/module-ai_federation-ai.html +3 -0
- package/docs/api/module-ai_h3-ai-H3AI.html +6 -0
- package/docs/api/module-ai_h3-ai.H3AI.html +3 -0
- package/docs/api/module-ai_h3-ai.html +3 -0
- package/docs/api/module-ai_json-ops-JSONOps.html +5 -0
- package/docs/api/module-ai_json-ops.JSONOps.html +3 -0
- package/docs/api/module-ai_json-ops.html +3 -0
- package/docs/api/module-ai_llm-service-LLMService.html +5 -0
- package/docs/api/module-ai_llm-service.LLMService.html +3 -0
- package/docs/api/module-ai_llm-service.html +3 -0
- package/docs/api/module-ai_nl-query-NLQuery.html +5 -0
- package/docs/api/module-ai_nl-query.NLQuery.html +3 -0
- package/docs/api/module-ai_nl-query.html +3 -0
- package/docs/api/module-ai_relationships-RelationshipDiscovery.html +6 -0
- package/docs/api/module-ai_relationships.RelationshipDiscovery.html +3 -0
- package/docs/api/module-ai_relationships.html +3 -0
- package/docs/api/module-ai_schema-extractor-SchemaExtractor.html +5 -0
- package/docs/api/module-ai_schema-extractor.SchemaExtractor.html +3 -0
- package/docs/api/module-ai_schema-extractor.html +3 -0
- package/docs/api/module-ai_spatial-SpatialAnalysis.html +6 -0
- package/docs/api/module-ai_spatial.SpatialAnalysis.html +3 -0
- package/docs/api/module-ai_spatial.html +3 -0
- package/docs/api/module-ai_tts-TTS.html +5 -0
- package/docs/api/module-ai_tts.TTS.html +3 -0
- package/docs/api/module-ai_tts.html +3 -0
- package/docs/api/module-content_social-protocols.html +3 -0
- package/docs/api/module-core_holosphere-HoloSphere.html +6 -0
- package/docs/api/module-core_holosphere.HoloSphere.html +3 -0
- package/docs/api/module-core_holosphere.html +3 -0
- package/docs/api/module-crypto_nostr-utils.html +3 -0
- package/docs/api/module-crypto_secp256k1.html +3 -0
- package/docs/api/module-federation_hologram.html +3 -0
- package/docs/api/module-hierarchical_upcast.html +3 -0
- package/docs/api/module-holosphere-HoloSphereBase.html +3 -0
- package/docs/api/module-holosphere.html +3 -0
- package/docs/api/module-lib_ai-methods.html +3 -0
- package/docs/api/module-lib_contract-methods.html +3 -0
- package/docs/api/module-lib_errors-AuthorizationError.html +3 -0
- package/docs/api/module-lib_errors-ValidationError.html +3 -0
- package/docs/api/module-lib_errors.AuthorizationError.html +3 -0
- package/docs/api/module-lib_errors.ValidationError.html +3 -0
- package/docs/api/module-lib_errors.html +3 -0
- package/docs/api/module-lib_federation-methods.html +3 -0
- package/docs/api/module-lib_index.html +3 -0
- package/docs/api/module-schema_validator-ValidationError.html +3 -0
- package/docs/api/module-schema_validator.ValidationError.html +3 -0
- package/docs/api/module-schema_validator.html +3 -0
- package/docs/api/module-spatial_h3-operations.html +4 -0
- package/docs/api/module-storage_backend-factory.BackendFactory.html +3 -0
- package/docs/api/module-storage_backend-factory.html +3 -0
- package/docs/api/module-storage_backend-interface-StorageBackend.html +3 -0
- package/docs/api/module-storage_backend-interface.StorageBackend.html +3 -0
- package/docs/api/module-storage_backend-interface.html +3 -0
- package/docs/api/module-storage_backends_activitypub-backend-ActivityPubBackend.html +7 -0
- package/docs/api/module-storage_backends_activitypub-backend.ActivityPubBackend.html +3 -0
- package/docs/api/module-storage_backends_activitypub-backend.html +3 -0
- package/docs/api/module-storage_backends_activitypub_server-ActivityPubServer.html +8 -0
- package/docs/api/module-storage_backends_activitypub_server.ActivityPubServer.html +3 -0
- package/docs/api/module-storage_backends_activitypub_server.html +3 -0
- package/docs/api/module-storage_backends_gundb-backend-GunDBBackend.html +7 -0
- package/docs/api/module-storage_backends_gundb-backend.GunDBBackend.html +3 -0
- package/docs/api/module-storage_backends_gundb-backend.html +3 -0
- package/docs/api/module-storage_backends_nostr-backend-NostrBackend.html +8 -0
- package/docs/api/module-storage_backends_nostr-backend.NostrBackend.html +3 -0
- package/docs/api/module-storage_backends_nostr-backend.html +3 -0
- package/docs/api/module-storage_filesystem-storage-FileSystemStorage.html +5 -0
- package/docs/api/module-storage_filesystem-storage-browser-FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage-browser.FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage-browser.html +3 -0
- package/docs/api/module-storage_filesystem-storage.FileSystemStorage.html +3 -0
- package/docs/api/module-storage_filesystem-storage.html +3 -0
- package/docs/api/module-storage_global-tables.html +3 -0
- package/docs/api/module-storage_gun-async.html +3 -0
- package/docs/api/module-storage_gun-auth-GunAuth.html +5 -0
- package/docs/api/module-storage_gun-auth.GunAuth.html +3 -0
- package/docs/api/module-storage_gun-auth.html +3 -0
- package/docs/api/module-storage_gun-federation.html +3 -0
- package/docs/api/module-storage_gun-references-GunReferenceHandler.html +5 -0
- package/docs/api/module-storage_gun-references.GunReferenceHandler.html +3 -0
- package/docs/api/module-storage_gun-references.html +3 -0
- package/docs/api/module-storage_gun-schema-GunSchemaValidator.html +5 -0
- package/docs/api/module-storage_gun-schema.GunSchemaValidator.html +3 -0
- package/docs/api/module-storage_gun-schema.html +3 -0
- package/docs/api/module-storage_gun-wrapper.html +11 -0
- package/docs/api/module-storage_indexeddb-storage-IndexedDBStorage.html +5 -0
- package/docs/api/module-storage_indexeddb-storage.IndexedDBStorage.html +3 -0
- package/docs/api/module-storage_indexeddb-storage.html +3 -0
- package/docs/api/module-storage_key-storage-simple.html +3 -0
- package/docs/api/module-storage_key-storage.html +4 -0
- package/docs/api/module-storage_memory-storage-MemoryStorage.html +5 -0
- package/docs/api/module-storage_memory-storage.MemoryStorage.html +3 -0
- package/docs/api/module-storage_memory-storage.html +3 -0
- package/docs/api/module-storage_migration-MigrationTool.html +6 -0
- package/docs/api/module-storage_migration.MigrationTool.html +3 -0
- package/docs/api/module-storage_migration.html +3 -0
- package/docs/api/module-storage_nostr-async.html +18 -0
- package/docs/api/module-storage_nostr-client-LRUCache.html +3 -0
- package/docs/api/module-storage_nostr-client-NostrClient.html +7 -0
- package/docs/api/module-storage_nostr-client.NostrClient.html +15 -0
- package/docs/api/module-storage_nostr-client.html +6 -0
- package/docs/api/module-storage_nostr-wrapper.html +3 -0
- package/docs/api/module-storage_outbox-queue-OutboxQueue.html +4 -0
- package/docs/api/module-storage_outbox-queue.OutboxQueue.html +3 -0
- package/docs/api/module-storage_outbox-queue.html +3 -0
- package/docs/api/module-storage_persistent-storage-PersistentStorage.html +3 -0
- package/docs/api/module-storage_persistent-storage.html +4 -0
- package/docs/api/module-storage_sync-service-SyncService.html +5 -0
- package/docs/api/module-storage_sync-service.SyncService.html +3 -0
- package/docs/api/module-storage_sync-service.html +3 -0
- package/docs/api/module-storage_unified-storage.html +3 -0
- package/docs/api/module-subscriptions_manager.SubscriptionRegistry.html +3 -0
- package/docs/api/module-subscriptions_manager.html +3 -0
- package/docs/api/schema_validator.js.html +113 -0
- package/docs/api/scripts/core.js +726 -0
- package/docs/api/scripts/core.min.js +23 -0
- package/docs/api/scripts/resize.js +90 -0
- package/docs/api/scripts/search.js +265 -0
- package/docs/api/scripts/search.min.js +6 -0
- package/docs/api/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/api/scripts/third-party/fuse.js +9 -0
- package/docs/api/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/api/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/api/scripts/third-party/hljs-original.js +5171 -0
- package/docs/api/scripts/third-party/hljs.js +1 -0
- package/docs/api/scripts/third-party/popper.js +5 -0
- package/docs/api/scripts/third-party/tippy.js +1 -0
- package/docs/api/scripts/third-party/tocbot.js +672 -0
- package/docs/api/scripts/third-party/tocbot.min.js +1 -0
- package/docs/api/spatial_h3-operations.js.html +129 -0
- package/docs/api/storage_backend-factory.js.html +133 -0
- package/docs/api/storage_backend-interface.js.html +164 -0
- package/docs/api/storage_backends_activitypub-backend.js.html +298 -0
- package/docs/api/storage_backends_activitypub_server.js.html +678 -0
- package/docs/api/storage_backends_gundb-backend.js.html +878 -0
- package/docs/api/storage_backends_nostr-backend.js.html +254 -0
- package/docs/api/storage_filesystem-storage-browser.js.html +83 -0
- package/docs/api/storage_filesystem-storage.js.html +207 -0
- package/docs/api/storage_global-tables.js.html +116 -0
- package/docs/api/storage_gun-async.js.html +344 -0
- package/docs/api/storage_gun-auth.js.html +376 -0
- package/docs/api/storage_gun-federation.js.html +788 -0
- package/docs/api/storage_gun-references.js.html +212 -0
- package/docs/api/storage_gun-schema.js.html +309 -0
- package/docs/api/storage_gun-wrapper.js.html +645 -0
- package/docs/api/storage_indexeddb-storage.js.html +224 -0
- package/docs/api/storage_key-storage-simple.js.html +102 -0
- package/docs/api/storage_key-storage.js.html +171 -0
- package/docs/api/storage_memory-storage.js.html +128 -0
- package/docs/api/storage_migration.js.html +354 -0
- package/docs/api/storage_nostr-async.js.html +1076 -0
- package/docs/api/storage_nostr-client.js.html +1598 -0
- package/docs/api/storage_nostr-wrapper.js.html +218 -0
- package/docs/api/storage_outbox-queue.js.html +248 -0
- package/docs/api/storage_persistent-storage.js.html +160 -0
- package/docs/api/storage_sync-service.js.html +201 -0
- package/docs/api/storage_unified-storage.js.html +157 -0
- package/docs/api/styles/clean-jsdoc-theme-base.css +1159 -0
- package/docs/api/styles/clean-jsdoc-theme-dark.css +412 -0
- package/docs/api/styles/clean-jsdoc-theme-light.css +482 -0
- package/docs/api/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/docs/api/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/docs/api/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/api/subscriptions_manager.js.html +162 -0
- package/jsdoc.json +26 -0
- package/package.json +14 -3
- package/src/ai/aggregation.js +13 -2
- package/src/ai/breakdown.js +12 -2
- package/src/ai/classifier.js +14 -3
- package/src/ai/council.js +22 -7
- package/src/ai/embeddings.js +37 -15
- package/src/ai/federation-ai.js +13 -2
- package/src/ai/h3-ai.js +14 -2
- package/src/ai/index.js +16 -7
- package/src/ai/json-ops.js +18 -5
- package/src/ai/llm-service.js +62 -31
- package/src/ai/nl-query.js +12 -2
- package/src/ai/relationships.js +13 -2
- package/src/ai/schema-extractor.js +24 -10
- package/src/ai/spatial.js +13 -2
- package/src/ai/tts.js +25 -8
- package/src/content/social-protocols.js +34 -25
- package/src/contracts/chain-manager.js +68 -40
- package/src/contracts/deployer.js +70 -42
- package/src/contracts/event-listener.js +61 -29
- package/src/contracts/holon-contracts.js +46 -31
- package/src/contracts/index.js +5 -6
- package/src/contracts/networks.js +19 -14
- package/src/contracts/operations.js +58 -41
- package/src/contracts/queries.js +54 -20
- package/src/core/holosphere.js +35 -6
- package/src/crypto/nostr-utils.js +82 -76
- package/src/crypto/secp256k1.js +7 -2
- package/src/federation/handshake.js +7 -7
- package/src/federation/hologram.js +9 -1
- package/src/hierarchical/upcast.js +34 -20
- package/src/index.js +655 -5
- package/src/lib/ai-methods.js +352 -3
- package/src/lib/contract-methods.js +152 -3
- package/src/lib/errors.js +31 -1
- package/src/lib/federation-methods.js +110 -3
- package/src/lib/index.js +9 -5
- package/src/schema/validator.js +22 -3
- package/src/spatial/h3-operations.js +17 -1
- package/src/storage/backend-factory.js +7 -2
- package/src/storage/backend-interface.js +21 -2
- package/src/storage/backends/activitypub/server.js +25 -3
- package/src/storage/backends/activitypub-backend.js +25 -2
- package/src/storage/backends/gundb-backend.js +29 -2
- package/src/storage/backends/nostr-backend.js +116 -1
- package/src/storage/filesystem-storage-browser.js +42 -2
- package/src/storage/filesystem-storage.js +72 -5
- package/src/storage/global-tables.js +7 -2
- package/src/storage/gun-async.js +20 -11
- package/src/storage/gun-auth.js +15 -4
- package/src/storage/gun-federation.js +14 -5
- package/src/storage/gun-references.js +16 -5
- package/src/storage/gun-schema.js +25 -10
- package/src/storage/gun-wrapper.js +99 -36
- package/src/storage/indexeddb-storage.js +65 -4
- package/src/storage/key-storage-simple.js +32 -9
- package/src/storage/key-storage.js +45 -13
- package/src/storage/memory-storage.js +65 -4
- package/src/storage/migration.js +20 -7
- package/src/storage/nostr-async.js +157 -67
- package/src/storage/nostr-client.js +173 -49
- package/src/storage/nostr-wrapper.js +6 -2
- package/src/storage/outbox-queue.js +55 -18
- package/src/storage/persistent-storage.js +56 -13
- package/src/storage/sync-service.js +51 -17
- package/src/storage/unified-storage.js +7 -2
- package/src/subscriptions/manager.js +33 -16
- package/dist/index-4XHHKe6S.js.map +0 -1
- package/dist/index-Dz5kOZMI.cjs.map +0 -1
- package/dist/indexeddb-storage-DD7EFBVc.cjs.map +0 -1
- package/dist/indexeddb-storage-lExjjFlV.js.map +0 -1
- package/dist/memory-storage-C68adso2.js.map +0 -1
- package/dist/memory-storage-DD_6yyXT.cjs.map +0 -1
- /package/{cleanup-test-data.js → scripts/cleanup-test-data.js} +0 -0
- /package/{test-ai-real-api.js → scripts/test-ai-real-api.js} +0 -0
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: storage/backends/gundb-backend.js</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-ai.html">ai</a></div><div class="sidebar-section-children"><a href="module-ai_aggregation.html">ai/aggregation</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown.html">ai/breakdown</a></div><div class="sidebar-section-children"><a href="module-ai_classifier.html">ai/classifier</a></div><div class="sidebar-section-children"><a href="module-ai_council.html">ai/council</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings.html">ai/embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai.html">ai/federation-ai</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai.html">ai/h3-ai</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops.html">ai/json-ops</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service.html">ai/llm-service</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query.html">ai/nl-query</a></div><div class="sidebar-section-children"><a href="module-ai_relationships.html">ai/relationships</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor.html">ai/schema-extractor</a></div><div class="sidebar-section-children"><a href="module-ai_spatial.html">ai/spatial</a></div><div class="sidebar-section-children"><a href="module-ai_tts.html">ai/tts</a></div><div class="sidebar-section-children"><a href="module-content_social-protocols.html">content/social-protocols</a></div><div class="sidebar-section-children"><a href="module-core_holosphere.html">core/holosphere</a></div><div class="sidebar-section-children"><a href="module-crypto_nostr-utils.html">crypto/nostr-utils</a></div><div class="sidebar-section-children"><a href="module-crypto_secp256k1.html">crypto/secp256k1</a></div><div class="sidebar-section-children"><a href="module-federation_hologram.html">federation/hologram</a></div><div class="sidebar-section-children"><a href="module-hierarchical_upcast.html">hierarchical/upcast</a></div><div class="sidebar-section-children"><a href="module-holosphere.html">holosphere</a></div><div class="sidebar-section-children"><a href="module-lib_ai-methods.html">lib/ai-methods</a></div><div class="sidebar-section-children"><a href="module-lib_contract-methods.html">lib/contract-methods</a></div><div class="sidebar-section-children"><a href="module-lib_errors.html">lib/errors</a></div><div class="sidebar-section-children"><a href="module-lib_federation-methods.html">lib/federation-methods</a></div><div class="sidebar-section-children"><a href="module-lib_index.html">lib/index</a></div><div class="sidebar-section-children"><a href="module-schema_validator.html">schema/validator</a></div><div class="sidebar-section-children"><a href="module-spatial_h3-operations.html">spatial/h3-operations</a></div><div class="sidebar-section-children"><a href="module-storage_backend-factory.html">storage/backend-factory</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface.html">storage/backend-interface</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend.html">storage/backends/activitypub-backend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server.html">storage/backends/activitypub/server</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend.html">storage/backends/gundb-backend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend.html">storage/backends/nostr-backend</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage.html">storage/filesystem-storage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser.html">storage/filesystem-storage-browser</a></div><div class="sidebar-section-children"><a href="module-storage_global-tables.html">storage/global-tables</a></div><div class="sidebar-section-children"><a href="module-storage_gun-async.html">storage/gun-async</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth.html">storage/gun-auth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-federation.html">storage/gun-federation</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references.html">storage/gun-references</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema.html">storage/gun-schema</a></div><div class="sidebar-section-children"><a href="module-storage_gun-wrapper.html">storage/gun-wrapper</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage.html">storage/indexeddb-storage</a></div><div class="sidebar-section-children"><a href="module-storage_key-storage.html">storage/key-storage</a></div><div class="sidebar-section-children"><a href="module-storage_key-storage-simple.html">storage/key-storage-simple</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage.html">storage/memory-storage</a></div><div class="sidebar-section-children"><a href="module-storage_migration.html">storage/migration</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-async.html">storage/nostr-async</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client.html">storage/nostr-client</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-wrapper.html">storage/nostr-wrapper</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue.html">storage/outbox-queue</a></div><div class="sidebar-section-children"><a href="module-storage_persistent-storage.html">storage/persistent-storage</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service.html">storage/sync-service</a></div><div class="sidebar-section-children"><a href="module-storage_unified-storage.html">storage/unified-storage</a></div><div class="sidebar-section-children"><a href="module-subscriptions_manager.html">subscriptions/manager</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-ai_aggregation.SmartAggregation.html">SmartAggregation</a></div><div class="sidebar-section-children"><a href="module-ai_aggregation-SmartAggregation.html">SmartAggregation</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown.TaskBreakdown.html">TaskBreakdown</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown-TaskBreakdown.html">TaskBreakdown</a></div><div class="sidebar-section-children"><a href="module-ai_classifier.Classifier.html">Classifier</a></div><div class="sidebar-section-children"><a href="module-ai_classifier-Classifier.html">Classifier</a></div><div class="sidebar-section-children"><a href="module-ai_council.Council.html">Council</a></div><div class="sidebar-section-children"><a href="module-ai_council-Council.html">Council</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings.Embeddings.html">Embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings-Embeddings.html">Embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai.FederationAdvisor.html">FederationAdvisor</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai-FederationAdvisor.html">FederationAdvisor</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai.H3AI.html">H3AI</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai-H3AI.html">H3AI</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops.JSONOps.html">JSONOps</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops-JSONOps.html">JSONOps</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service.LLMService.html">LLMService</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service-LLMService.html">LLMService</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query.NLQuery.html">NLQuery</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query-NLQuery.html">NLQuery</a></div><div class="sidebar-section-children"><a href="module-ai_relationships.RelationshipDiscovery.html">RelationshipDiscovery</a></div><div class="sidebar-section-children"><a href="module-ai_relationships-RelationshipDiscovery.html">RelationshipDiscovery</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor.SchemaExtractor.html">SchemaExtractor</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor-SchemaExtractor.html">SchemaExtractor</a></div><div class="sidebar-section-children"><a href="module-ai_spatial.SpatialAnalysis.html">SpatialAnalysis</a></div><div class="sidebar-section-children"><a href="module-ai_spatial-SpatialAnalysis.html">SpatialAnalysis</a></div><div class="sidebar-section-children"><a href="module-ai_tts.TTS.html">TTS</a></div><div class="sidebar-section-children"><a href="module-ai_tts-TTS.html">TTS</a></div><div class="sidebar-section-children"><a href="module-core_holosphere.HoloSphere.html">HoloSphere</a></div><div class="sidebar-section-children"><a href="module-core_holosphere-HoloSphere.html">HoloSphere</a></div><div class="sidebar-section-children"><a href="module-holosphere-HoloSphereBase.html">HoloSphereBase</a></div><div class="sidebar-section-children"><a href="module-holosphere-HoloSphereBase.html">HoloSphereBase</a></div><div class="sidebar-section-children"><a href="module-lib_errors.AuthorizationError.html">AuthorizationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors.ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors-AuthorizationError.html">AuthorizationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors-ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-schema_validator.ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-schema_validator-ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-storage_backend-factory.BackendFactory.html">BackendFactory</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface.StorageBackend.html">StorageBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface-StorageBackend.html">StorageBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend.ActivityPubBackend.html">ActivityPubBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend-ActivityPubBackend.html">ActivityPubBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server.ActivityPubServer.html">ActivityPubServer</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server-ActivityPubServer.html">ActivityPubServer</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend.GunDBBackend.html">GunDBBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend-GunDBBackend.html">GunDBBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend.NostrBackend.html">NostrBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend-NostrBackend.html">NostrBackend</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser.FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser-FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage.FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth.GunAuth.html">GunAuth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth-GunAuth.html">GunAuth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references.GunReferenceHandler.html">GunReferenceHandler</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references-GunReferenceHandler.html">GunReferenceHandler</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema.GunSchemaValidator.html">GunSchemaValidator</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema-GunSchemaValidator.html">GunSchemaValidator</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage.IndexedDBStorage.html">IndexedDBStorage</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage-IndexedDBStorage.html">IndexedDBStorage</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage.MemoryStorage.html">MemoryStorage</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage-MemoryStorage.html">MemoryStorage</a></div><div class="sidebar-section-children"><a href="module-storage_migration.MigrationTool.html">MigrationTool</a></div><div class="sidebar-section-children"><a href="module-storage_migration-MigrationTool.html">MigrationTool</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client.NostrClient.html">NostrClient</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client-LRUCache.html">LRUCache</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client-NostrClient.html">NostrClient</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue.OutboxQueue.html">OutboxQueue</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue-OutboxQueue.html">OutboxQueue</a></div><div class="sidebar-section-children"><a href="module-storage_persistent-storage-PersistentStorage.html">PersistentStorage</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service.SyncService.html">SyncService</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service-SyncService.html">SyncService</a></div><div class="sidebar-section-children"><a href="module-subscriptions_manager.SubscriptionRegistry.html">SubscriptionRegistry</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#FederationRequestPayload">FederationRequestPayload</a></div><div class="sidebar-section-children"><a href="global.html#FederationResponsePayload">FederationResponsePayload</a></div><div class="sidebar-section-children"><a href="global.html#acceptFederationRequest">acceptFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#acceptFederationRequest">acceptFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#addFederatedPartner">addFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#cleanupExpiredCapabilities">cleanupExpiredCapabilities</a></div><div class="sidebar-section-children"><a href="global.html#createFederationRequest">createFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#createFederationResponse">createFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#declineFederationRequest">declineFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#getCapabilityForAuthor">getCapabilityForAuthor</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedAuthors">getFederatedAuthors</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedAuthorsForScope">getFederatedAuthorsForScope</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedPartner">getFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#getFederationRegistry">getFederationRegistry</a></div><div class="sidebar-section-children"><a href="global.html#getPendingFederationRequests">getPendingFederationRequests</a></div><div class="sidebar-section-children"><a href="global.html#initiateFederationHandshake">initiateFederationHandshake</a></div><div class="sidebar-section-children"><a href="global.html#isFederationRequest">isFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#isFederationResponse">isFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#rejectFederationRequest">rejectFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#removeFederatedPartner">removeFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#revokeOutboundCapability">revokeOutboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#saveFederationRegistry">saveFederationRegistry</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationRequest">sendFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationRequest">sendFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationResponse">sendFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#storeInboundCapability">storeInboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#storeOutboundCapability">storeOutboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationAcceptances">subscribeFederationAcceptances</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationDeclines">subscribeFederationDeclines</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationRequests">subscribeFederationRequests</a></div><div class="sidebar-section-children"><a href="global.html#subscribeToFederationDMs">subscribeToFederationDMs</a></div><div class="sidebar-section-children"><a href="global.html#updateDiscoverySettings">updateDiscoverySettings</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">storage_backends_gundb-backend.js</h1></header><article><pre class="prettyprint source lang-js"><code>/**
|
|
4
|
+
* @fileoverview GunDB storage backend with authentication, schema validation, references, and global tables.
|
|
5
|
+
* Provides full-featured P2P data storage using GunDB with write caching for immediate consistency.
|
|
6
|
+
* @module storage/backends/gundb-backend
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { StorageBackend } from '../backend-interface.js';
|
|
10
|
+
import * as wrapper from '../gun-wrapper.js';
|
|
11
|
+
import { gunPromise, gunPut, gunMap, gunCollect } from '../gun-async.js';
|
|
12
|
+
import { GunReferenceHandler } from '../gun-references.js';
|
|
13
|
+
import { GunAuth } from '../gun-auth.js';
|
|
14
|
+
import { GunSchemaValidator } from '../gun-schema.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* GunDB storage backend implementation with advanced features.
|
|
18
|
+
* Supports authentication, schema validation, references, global tables,
|
|
19
|
+
* and write caching for immediate consistency.
|
|
20
|
+
*
|
|
21
|
+
* @class GunDBBackend
|
|
22
|
+
* @extends StorageBackend
|
|
23
|
+
* @example
|
|
24
|
+
* const backend = await BackendFactory.create('gundb', {
|
|
25
|
+
* appName: 'myapp',
|
|
26
|
+
* peers: ['wss://gun-server.example.com/gun'],
|
|
27
|
+
* radisk: true
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
export class GunDBBackend extends StorageBackend {
|
|
31
|
+
/**
|
|
32
|
+
* Create a new GunDB backend instance.
|
|
33
|
+
* @param {Object} config - Backend configuration
|
|
34
|
+
* @param {string} [config.appName='holosphere'] - Application namespace
|
|
35
|
+
* @param {string[]} [config.peers=[]] - Array of peer URLs
|
|
36
|
+
* @param {boolean} [config.radisk=true] - Enable radisk persistence
|
|
37
|
+
* @param {boolean} [config.localStorage=true] - Enable localStorage
|
|
38
|
+
* @param {string} [config.dataDir='radata'] - Data directory for Node.js
|
|
39
|
+
* @param {string} [config.privateKey] - Optional existing private key
|
|
40
|
+
* @param {string} [config.publicKey] - Optional existing public key
|
|
41
|
+
* @param {boolean} [config.strict=false] - Enable strict schema validation
|
|
42
|
+
*/
|
|
43
|
+
constructor(config) {
|
|
44
|
+
super(config);
|
|
45
|
+
this.gun = null;
|
|
46
|
+
this.keyPair = null;
|
|
47
|
+
this.appName = config.appName || 'holosphere';
|
|
48
|
+
|
|
49
|
+
// New modules
|
|
50
|
+
this.references = null;
|
|
51
|
+
this.auth = null;
|
|
52
|
+
this.schemaValidator = null;
|
|
53
|
+
|
|
54
|
+
// Subscription tracking
|
|
55
|
+
this.subscriptions = new Map();
|
|
56
|
+
this.subscriptionCounter = 0;
|
|
57
|
+
|
|
58
|
+
// Write cache for immediate consistency
|
|
59
|
+
// Gun's readAll/map().once() doesn't immediately see new writes - this cache bridges that gap
|
|
60
|
+
this.writeCache = new Map(); // path -> Map(id -> {data, timestamp})
|
|
61
|
+
this.writeCacheTTL = 300000; // Cache entries expire after 5 minutes (increased from 30s)
|
|
62
|
+
|
|
63
|
+
// Pending writes queue for retry
|
|
64
|
+
this.pendingWrites = new Map(); // path -> {data, retries, lastAttempt}
|
|
65
|
+
this.maxWriteRetries = 5;
|
|
66
|
+
this.writeRetryInterval = 10000; // 10 seconds between retries
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async init() {
|
|
70
|
+
// Dynamically import Gun to avoid issues if not installed
|
|
71
|
+
let Gun;
|
|
72
|
+
try {
|
|
73
|
+
console.log('[gundb-backend] Importing Gun...');
|
|
74
|
+
const gunModule = await import('gun');
|
|
75
|
+
Gun = gunModule.default || gunModule;
|
|
76
|
+
console.log('[gundb-backend] Gun imported:', typeof Gun);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
'GunDB backend requires the "gun" package. Install it with: npm install gun'
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// In Node.js, Gun needs a file path for radisk persistence
|
|
84
|
+
// Default to 'radata' if not specified
|
|
85
|
+
const dataDir = this.config.dataDir || 'radata';
|
|
86
|
+
|
|
87
|
+
const gunConfig = {
|
|
88
|
+
peers: this.config.peers || [],
|
|
89
|
+
radisk: this.config.radisk !== false,
|
|
90
|
+
localStorage: this.config.localStorage !== false,
|
|
91
|
+
file: dataDir,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
console.log('[gundb-backend] Gun config:', JSON.stringify(gunConfig));
|
|
95
|
+
|
|
96
|
+
this.gun = Gun(gunConfig);
|
|
97
|
+
console.log('[gundb-backend] Gun instance created:', !!this.gun);
|
|
98
|
+
|
|
99
|
+
// Test basic Gun functionality
|
|
100
|
+
try {
|
|
101
|
+
const testKey = `_test_${Date.now()}`;
|
|
102
|
+
this.gun.get(testKey).put({ test: true }, (ack) => {
|
|
103
|
+
console.log('[gundb-backend] Gun test write ack:', ack);
|
|
104
|
+
});
|
|
105
|
+
console.log('[gundb-backend] Gun test write initiated');
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.error('[gundb-backend] Gun test write failed:', e.message);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Add a small delay to let Gun initialize
|
|
111
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
112
|
+
|
|
113
|
+
// Generate or use provided key pair using Gun's SEA
|
|
114
|
+
try {
|
|
115
|
+
const SEA = Gun.SEA;
|
|
116
|
+
if (SEA) {
|
|
117
|
+
if (this.config.privateKey) {
|
|
118
|
+
// Try to restore from existing key
|
|
119
|
+
this.keyPair = { priv: this.config.privateKey, pub: this.config.publicKey };
|
|
120
|
+
this.publicKey = this.config.publicKey || this.config.privateKey.substring(0, 32);
|
|
121
|
+
} else {
|
|
122
|
+
// Generate new key pair
|
|
123
|
+
this.keyPair = await SEA.pair();
|
|
124
|
+
this.publicKey = this.keyPair.pub;
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
// SEA not available, use simple identifier
|
|
128
|
+
this.publicKey = this.appName;
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
// SEA might not be loaded
|
|
132
|
+
this.publicKey = this.appName;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Initialize modules
|
|
136
|
+
this.references = new GunReferenceHandler(this.appName);
|
|
137
|
+
this.auth = new GunAuth(this.gun, this.appName);
|
|
138
|
+
this.schemaValidator = new GunSchemaValidator({
|
|
139
|
+
strict: this.config.strict || false,
|
|
140
|
+
cacheMaxAge: this.config.schemaCacheMaxAge || 3600000
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Try to initialize schema validator (may fail if AJV not installed)
|
|
144
|
+
await this.schemaValidator.init();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ============================================================================
|
|
148
|
+
// WRITE CACHE (for immediate consistency)
|
|
149
|
+
// ============================================================================
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Add item to the local write cache for immediate consistency
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
_addToWriteCache(path, data) {
|
|
156
|
+
if (!data || !data.id) return;
|
|
157
|
+
|
|
158
|
+
// Extract the parent path (without the data id)
|
|
159
|
+
const parentPath = path.substring(0, path.lastIndexOf('/'));
|
|
160
|
+
if (!parentPath) return;
|
|
161
|
+
|
|
162
|
+
if (!this.writeCache.has(parentPath)) {
|
|
163
|
+
this.writeCache.set(parentPath, new Map());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const pathCache = this.writeCache.get(parentPath);
|
|
167
|
+
pathCache.set(data.id.toString(), {
|
|
168
|
+
data: data,
|
|
169
|
+
timestamp: Date.now()
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Remove item from write cache (e.g., on delete)
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
_removeFromWriteCache(path, id) {
|
|
178
|
+
// Extract the parent path
|
|
179
|
+
const parentPath = path.substring(0, path.lastIndexOf('/'));
|
|
180
|
+
const pathCache = this.writeCache.get(parentPath);
|
|
181
|
+
if (pathCache) {
|
|
182
|
+
pathCache.delete(id.toString());
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get cached writes for a path, filtering out expired entries
|
|
188
|
+
* @private
|
|
189
|
+
*/
|
|
190
|
+
_getWriteCacheEntries(path) {
|
|
191
|
+
const pathCache = this.writeCache.get(path);
|
|
192
|
+
if (!pathCache) return [];
|
|
193
|
+
|
|
194
|
+
const now = Date.now();
|
|
195
|
+
const validEntries = [];
|
|
196
|
+
|
|
197
|
+
for (const [id, entry] of pathCache) {
|
|
198
|
+
if (now - entry.timestamp < this.writeCacheTTL) {
|
|
199
|
+
validEntries.push(entry.data);
|
|
200
|
+
} else {
|
|
201
|
+
// Clean up expired entries
|
|
202
|
+
pathCache.delete(id);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return validEntries;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Merge cached writes with results from Gun
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
_mergeWithWriteCache(path, gunResults) {
|
|
214
|
+
const cachedWrites = this._getWriteCacheEntries(path);
|
|
215
|
+
if (cachedWrites.length === 0) return gunResults;
|
|
216
|
+
|
|
217
|
+
// Create a map by ID for deduplication
|
|
218
|
+
const resultMap = new Map();
|
|
219
|
+
|
|
220
|
+
// Add Gun results first
|
|
221
|
+
for (const item of gunResults) {
|
|
222
|
+
if (item && item.id) {
|
|
223
|
+
resultMap.set(item.id.toString(), item);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Overlay cached writes (they're more recent)
|
|
228
|
+
for (const item of cachedWrites) {
|
|
229
|
+
if (item && item.id && !item._deleted) {
|
|
230
|
+
resultMap.set(item.id.toString(), item);
|
|
231
|
+
} else if (item && item.id && item._deleted) {
|
|
232
|
+
// Remove deleted items
|
|
233
|
+
resultMap.delete(item.id.toString());
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return Array.from(resultMap.values());
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Clear write cache for a specific path or all paths
|
|
242
|
+
* @param {string} [path] - Optional path to clear, clears all if not provided
|
|
243
|
+
*/
|
|
244
|
+
clearWriteCache(path = null) {
|
|
245
|
+
if (path) {
|
|
246
|
+
this.writeCache.delete(path);
|
|
247
|
+
} else {
|
|
248
|
+
this.writeCache.clear();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// ============================================================================
|
|
253
|
+
// PATH BUILDING
|
|
254
|
+
// ============================================================================
|
|
255
|
+
|
|
256
|
+
buildPath(appName, holonId, lensName, key = null) {
|
|
257
|
+
return wrapper.buildPath(appName, holonId, lensName, key);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
buildGlobalPath(tableName, key = null) {
|
|
261
|
+
return wrapper.buildGlobalPath(this.appName, tableName, key);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ============================================================================
|
|
265
|
+
// BASIC CRUD OPERATIONS
|
|
266
|
+
// ============================================================================
|
|
267
|
+
|
|
268
|
+
async write(path, data, options = {}) {
|
|
269
|
+
// Validate against schema if strict mode
|
|
270
|
+
if (this.schemaValidator && this.schemaValidator.isStrict()) {
|
|
271
|
+
const pathParts = path.split('/');
|
|
272
|
+
if (pathParts.length >= 3) {
|
|
273
|
+
const lens = pathParts[2];
|
|
274
|
+
// Skip validation for references
|
|
275
|
+
if (!this.isReference(data)) {
|
|
276
|
+
const result = await this.schemaValidator.validateData(
|
|
277
|
+
this.gun, this.appName, lens, data
|
|
278
|
+
);
|
|
279
|
+
if (!result.valid) {
|
|
280
|
+
throw new Error(`Schema validation failed: ${JSON.stringify(result.errors)}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Add to write cache FIRST for immediate consistency
|
|
287
|
+
// This ensures readAll returns the new data even if Gun write is slow/times out
|
|
288
|
+
this._addToWriteCache(path, data);
|
|
289
|
+
|
|
290
|
+
// Try to write to Gun with retry on timeout
|
|
291
|
+
const result = await this._writeWithRetry(path, data);
|
|
292
|
+
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Write to Gun with automatic retry on timeout
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
async _writeWithRetry(path, data, attempt = 0) {
|
|
301
|
+
const result = await wrapper.write(this.gun, path, data);
|
|
302
|
+
|
|
303
|
+
if (result.timeout && attempt < this.maxWriteRetries) {
|
|
304
|
+
// Queue for background retry
|
|
305
|
+
this.pendingWrites.set(path, {
|
|
306
|
+
data,
|
|
307
|
+
retries: attempt + 1,
|
|
308
|
+
lastAttempt: Date.now()
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// Schedule retry
|
|
312
|
+
this._scheduleRetry(path);
|
|
313
|
+
} else if (!result.timeout) {
|
|
314
|
+
// Success - remove from pending
|
|
315
|
+
this.pendingWrites.delete(path);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Schedule a background retry for a pending write
|
|
323
|
+
* @private
|
|
324
|
+
*/
|
|
325
|
+
_scheduleRetry(path) {
|
|
326
|
+
setTimeout(async () => {
|
|
327
|
+
const pending = this.pendingWrites.get(path);
|
|
328
|
+
if (!pending) return;
|
|
329
|
+
|
|
330
|
+
if (pending.retries >= this.maxWriteRetries) {
|
|
331
|
+
console.warn(`[gundb-backend] Max retries reached for: ${path}`);
|
|
332
|
+
this.pendingWrites.delete(path);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
console.log(`[gundb-backend] Retrying write (attempt ${pending.retries + 1}): ${path}`);
|
|
337
|
+
await this._writeWithRetry(path, pending.data, pending.retries);
|
|
338
|
+
}, this.writeRetryInterval);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
async read(path, options = {}) {
|
|
342
|
+
const data = await wrapper.read(this.gun, path);
|
|
343
|
+
|
|
344
|
+
// Resolve references if requested
|
|
345
|
+
if (data && options.resolveReferences && this.isReference(data)) {
|
|
346
|
+
return this.resolveReference(data);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return data;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async readAll(path, options = {}) {
|
|
353
|
+
const gunItems = await wrapper.readAll(this.gun, path);
|
|
354
|
+
|
|
355
|
+
// Merge with write cache for immediate consistency
|
|
356
|
+
const items = this._mergeWithWriteCache(path, gunItems);
|
|
357
|
+
|
|
358
|
+
// Resolve references if requested
|
|
359
|
+
if (options.resolveReferences) {
|
|
360
|
+
const resolved = [];
|
|
361
|
+
for (const item of items) {
|
|
362
|
+
if (this.isReference(item)) {
|
|
363
|
+
const resolvedItem = await this.resolveReference(item);
|
|
364
|
+
if (resolvedItem) {
|
|
365
|
+
resolved.push(resolvedItem);
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
resolved.push(item);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return resolved;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return items;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
async update(path, updates) {
|
|
378
|
+
return wrapper.update(this.gun, path, updates);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
async delete(path) {
|
|
382
|
+
const result = await wrapper.deleteData(this.gun, path);
|
|
383
|
+
|
|
384
|
+
// Extract id from path and mark as deleted in cache
|
|
385
|
+
const pathParts = path.split('/');
|
|
386
|
+
const id = pathParts[pathParts.length - 1];
|
|
387
|
+
if (id) {
|
|
388
|
+
// Add tombstone to cache so readAll doesn't return this item
|
|
389
|
+
const parentPath = path.substring(0, path.lastIndexOf('/'));
|
|
390
|
+
if (!this.writeCache.has(parentPath)) {
|
|
391
|
+
this.writeCache.set(parentPath, new Map());
|
|
392
|
+
}
|
|
393
|
+
this.writeCache.get(parentPath).set(id.toString(), {
|
|
394
|
+
data: { id, _deleted: true },
|
|
395
|
+
timestamp: Date.now()
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return result;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
async deleteAll(path) {
|
|
403
|
+
const items = await this.readAll(path);
|
|
404
|
+
let count = 0;
|
|
405
|
+
|
|
406
|
+
for (const item of items) {
|
|
407
|
+
if (item && item.id) {
|
|
408
|
+
const itemPath = `${path}/${item.id}`;
|
|
409
|
+
await wrapper.deleteData(this.gun, itemPath);
|
|
410
|
+
count++;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return { success: true, count };
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// ============================================================================
|
|
418
|
+
// GLOBAL TABLE OPERATIONS
|
|
419
|
+
// ============================================================================
|
|
420
|
+
|
|
421
|
+
async writeGlobal(tableName, data) {
|
|
422
|
+
// Add to write cache FIRST for immediate consistency
|
|
423
|
+
// This ensures readAllGlobal returns the new data even if Gun write is slow/times out
|
|
424
|
+
const path = this.buildGlobalPath(tableName, data.id);
|
|
425
|
+
this._addToWriteCache(path, data);
|
|
426
|
+
|
|
427
|
+
// Try to write to Gun with retry on timeout
|
|
428
|
+
const result = await this._writeGlobalWithRetry(tableName, data);
|
|
429
|
+
|
|
430
|
+
return result;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Write to global table with automatic retry on timeout
|
|
435
|
+
* @private
|
|
436
|
+
*/
|
|
437
|
+
async _writeGlobalWithRetry(tableName, data, attempt = 0) {
|
|
438
|
+
const path = this.buildGlobalPath(tableName, data.id);
|
|
439
|
+
const result = await wrapper.writeGlobal(this.gun, this.appName, tableName, data);
|
|
440
|
+
|
|
441
|
+
if (result.timeout && attempt < this.maxWriteRetries) {
|
|
442
|
+
// Queue for background retry
|
|
443
|
+
this.pendingWrites.set(path, {
|
|
444
|
+
data: { tableName, data },
|
|
445
|
+
isGlobal: true,
|
|
446
|
+
retries: attempt + 1,
|
|
447
|
+
lastAttempt: Date.now()
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// Schedule retry
|
|
451
|
+
this._scheduleGlobalRetry(path, tableName);
|
|
452
|
+
} else if (!result.timeout) {
|
|
453
|
+
// Success - remove from pending
|
|
454
|
+
this.pendingWrites.delete(path);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Schedule a background retry for a pending global write
|
|
462
|
+
* @private
|
|
463
|
+
*/
|
|
464
|
+
_scheduleGlobalRetry(path, tableName) {
|
|
465
|
+
setTimeout(async () => {
|
|
466
|
+
const pending = this.pendingWrites.get(path);
|
|
467
|
+
if (!pending || !pending.isGlobal) return;
|
|
468
|
+
|
|
469
|
+
if (pending.retries >= this.maxWriteRetries) {
|
|
470
|
+
console.warn(`[gundb-backend] Max retries reached for global: ${path}`);
|
|
471
|
+
this.pendingWrites.delete(path);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
console.log(`[gundb-backend] Retrying global write (attempt ${pending.retries + 1}): ${path}`);
|
|
476
|
+
await this._writeGlobalWithRetry(tableName, pending.data.data, pending.retries);
|
|
477
|
+
}, this.writeRetryInterval);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
async readGlobal(tableName, key) {
|
|
481
|
+
return wrapper.readGlobal(this.gun, this.appName, tableName, key);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
async readAllGlobal(tableName, timeout = 5000) {
|
|
485
|
+
const gunItems = await wrapper.readAllGlobal(this.gun, this.appName, tableName, timeout);
|
|
486
|
+
|
|
487
|
+
// Merge with write cache for immediate consistency
|
|
488
|
+
const path = this.buildGlobalPath(tableName);
|
|
489
|
+
return this._mergeWithWriteCache(path, gunItems);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
async deleteGlobal(tableName, key) {
|
|
493
|
+
const result = await wrapper.deleteGlobal(this.gun, this.appName, tableName, key);
|
|
494
|
+
|
|
495
|
+
// Mark as deleted in cache
|
|
496
|
+
const path = this.buildGlobalPath(tableName);
|
|
497
|
+
if (!this.writeCache.has(path)) {
|
|
498
|
+
this.writeCache.set(path, new Map());
|
|
499
|
+
}
|
|
500
|
+
this.writeCache.get(path).set(key.toString(), {
|
|
501
|
+
data: { id: key, _deleted: true },
|
|
502
|
+
timestamp: Date.now()
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
return result;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
async deleteAllGlobal(tableName) {
|
|
509
|
+
return wrapper.deleteAllGlobal(this.gun, this.appName, tableName);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// ============================================================================
|
|
513
|
+
// REFERENCE OPERATIONS
|
|
514
|
+
// ============================================================================
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Create a reference to data
|
|
518
|
+
*/
|
|
519
|
+
createReference(holon, lens, data) {
|
|
520
|
+
return this.references.createReference(holon, lens, data);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Check if data is a reference
|
|
525
|
+
*/
|
|
526
|
+
isReference(data) {
|
|
527
|
+
return this.references.isReference(data);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Resolve a reference to get actual data
|
|
532
|
+
*/
|
|
533
|
+
async resolveReference(reference, options = {}) {
|
|
534
|
+
return this.references.resolveReference(this.gun, reference, options);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Parse a soul path
|
|
539
|
+
*/
|
|
540
|
+
parseSoulPath(soul) {
|
|
541
|
+
return this.references.parseSoulPath(soul);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Get soul for data
|
|
546
|
+
*/
|
|
547
|
+
getSoul(holon, lens, key) {
|
|
548
|
+
return this.references.getSoul(holon, lens, key);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// ============================================================================
|
|
552
|
+
// AUTHENTICATION OPERATIONS
|
|
553
|
+
// ============================================================================
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Authenticate for a holon
|
|
557
|
+
*/
|
|
558
|
+
async authenticate(holonId, password) {
|
|
559
|
+
return this.auth.authenticate(holonId, password);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Create a new user
|
|
564
|
+
*/
|
|
565
|
+
async createUser(holonId, password) {
|
|
566
|
+
return this.auth.createUser(holonId, password);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Logout current user
|
|
571
|
+
*/
|
|
572
|
+
logout() {
|
|
573
|
+
this.auth.logout();
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Check if authenticated
|
|
578
|
+
*/
|
|
579
|
+
isAuthenticated() {
|
|
580
|
+
return this.auth.isAuthenticated();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Write to private storage
|
|
585
|
+
*/
|
|
586
|
+
async writePrivate(lens, key, data) {
|
|
587
|
+
return this.auth.writePrivate(lens, key, data);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Read from private storage
|
|
592
|
+
*/
|
|
593
|
+
async readPrivate(lens, key) {
|
|
594
|
+
return this.auth.readPrivate(lens, key);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Read all from private lens
|
|
599
|
+
*/
|
|
600
|
+
async readAllPrivate(lens, timeout = 2000) {
|
|
601
|
+
return this.auth.readAllPrivate(lens, timeout);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Delete from private storage
|
|
606
|
+
*/
|
|
607
|
+
async deletePrivate(lens, key) {
|
|
608
|
+
return this.auth.deletePrivate(lens, key);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// ============================================================================
|
|
612
|
+
// SCHEMA OPERATIONS
|
|
613
|
+
// ============================================================================
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Set a schema for a lens
|
|
617
|
+
*/
|
|
618
|
+
async setSchema(lens, schema) {
|
|
619
|
+
return this.schemaValidator.setSchema(this.gun, this.appName, lens, schema);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Get a schema for a lens
|
|
624
|
+
*/
|
|
625
|
+
async getSchema(lens, options = {}) {
|
|
626
|
+
return this.schemaValidator.getSchema(this.gun, this.appName, lens, options);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Get all schemas
|
|
631
|
+
*/
|
|
632
|
+
async getAllSchemas() {
|
|
633
|
+
return this.schemaValidator.getAllSchemas(this.gun, this.appName);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Delete a schema
|
|
638
|
+
*/
|
|
639
|
+
async deleteSchema(lens) {
|
|
640
|
+
return this.schemaValidator.deleteSchema(this.gun, this.appName, lens);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Validate data against a schema
|
|
645
|
+
*/
|
|
646
|
+
validate(schema, data) {
|
|
647
|
+
return this.schemaValidator.validate(schema, data);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Validate data against a lens schema
|
|
652
|
+
*/
|
|
653
|
+
async validateData(lens, data) {
|
|
654
|
+
return this.schemaValidator.validateData(this.gun, this.appName, lens, data);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Clear schema cache
|
|
659
|
+
*/
|
|
660
|
+
clearSchemaCache(lens = null) {
|
|
661
|
+
this.schemaValidator.clearCache(lens);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// ============================================================================
|
|
665
|
+
// SUBSCRIPTIONS
|
|
666
|
+
// ============================================================================
|
|
667
|
+
|
|
668
|
+
async subscribe(path, callback, options = {}) {
|
|
669
|
+
const subscriptionId = ++this.subscriptionCounter;
|
|
670
|
+
const pathParts = path.split('/');
|
|
671
|
+
const isPrefix = pathParts.length <= 3;
|
|
672
|
+
|
|
673
|
+
const subscription = {
|
|
674
|
+
id: subscriptionId,
|
|
675
|
+
path,
|
|
676
|
+
active: true,
|
|
677
|
+
gunRef: null
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
if (isPrefix) {
|
|
681
|
+
const ref = this.gun.get(path);
|
|
682
|
+
subscription.gunRef = ref;
|
|
683
|
+
|
|
684
|
+
ref.map().on(async (data, key) => {
|
|
685
|
+
if (!this.subscriptions.get(subscriptionId)?.active) return;
|
|
686
|
+
if (!data || key.startsWith('_') || data._deleted) return;
|
|
687
|
+
|
|
688
|
+
// Parse data
|
|
689
|
+
let parsed = wrapper.parse(data);
|
|
690
|
+
if (!parsed) return;
|
|
691
|
+
|
|
692
|
+
// Resolve references if requested
|
|
693
|
+
if (options.resolveReferences && this.isReference(parsed)) {
|
|
694
|
+
parsed = await this.resolveReference(parsed);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (parsed) {
|
|
698
|
+
callback(parsed, key);
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
} else {
|
|
702
|
+
const ref = this.gun.get(path);
|
|
703
|
+
subscription.gunRef = ref;
|
|
704
|
+
|
|
705
|
+
ref.on(async (data, key) => {
|
|
706
|
+
if (!this.subscriptions.get(subscriptionId)?.active) return;
|
|
707
|
+
if (!data) return;
|
|
708
|
+
|
|
709
|
+
let parsed = wrapper.parse(data);
|
|
710
|
+
if (!parsed || parsed._deleted) return;
|
|
711
|
+
|
|
712
|
+
if (options.resolveReferences && this.isReference(parsed)) {
|
|
713
|
+
parsed = await this.resolveReference(parsed);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if (parsed) {
|
|
717
|
+
callback(parsed, key);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
this.subscriptions.set(subscriptionId, subscription);
|
|
723
|
+
|
|
724
|
+
return {
|
|
725
|
+
id: subscriptionId,
|
|
726
|
+
unsubscribe: () => {
|
|
727
|
+
const sub = this.subscriptions.get(subscriptionId);
|
|
728
|
+
if (sub) {
|
|
729
|
+
sub.active = false;
|
|
730
|
+
if (sub.gunRef) {
|
|
731
|
+
try {
|
|
732
|
+
sub.gunRef.off();
|
|
733
|
+
} catch (e) {}
|
|
734
|
+
}
|
|
735
|
+
this.subscriptions.delete(subscriptionId);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// ============================================================================
|
|
742
|
+
// EXPORT/IMPORT
|
|
743
|
+
// ============================================================================
|
|
744
|
+
|
|
745
|
+
async exportData(pathPrefix = '') {
|
|
746
|
+
const records = [];
|
|
747
|
+
const basePath = pathPrefix || this.appName;
|
|
748
|
+
|
|
749
|
+
try {
|
|
750
|
+
const items = await gunMap(this.gun.get(basePath), 2000);
|
|
751
|
+
|
|
752
|
+
for (const [key, data] of Object.entries(items)) {
|
|
753
|
+
if (!key.startsWith('_') && data && typeof data === 'object' && !data._deleted) {
|
|
754
|
+
await this._collectRecords(basePath, key, data, records);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
} catch (error) {
|
|
758
|
+
console.warn('Export data error:', error);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
return records;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
async _collectRecords(basePath, key, data, records) {
|
|
765
|
+
const currentPath = `${basePath}/${key}`;
|
|
766
|
+
|
|
767
|
+
if (data.id) {
|
|
768
|
+
records.push({
|
|
769
|
+
path: currentPath,
|
|
770
|
+
data: this._cleanGunData(data),
|
|
771
|
+
timestamp: data._meta?.timestamp || Date.now(),
|
|
772
|
+
});
|
|
773
|
+
} else {
|
|
774
|
+
try {
|
|
775
|
+
const nested = await gunMap(this.gun.get(currentPath), 500);
|
|
776
|
+
for (const [nestedKey, nestedData] of Object.entries(nested)) {
|
|
777
|
+
if (!nestedKey.startsWith('_') && nestedData) {
|
|
778
|
+
await this._collectRecords(currentPath, nestedKey, nestedData, records);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
} catch (e) {}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
_cleanGunData(data) {
|
|
786
|
+
const cleaned = { ...data };
|
|
787
|
+
delete cleaned['_'];
|
|
788
|
+
return cleaned;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
async importData(records, options = {}) {
|
|
792
|
+
const results = { success: 0, failed: 0, errors: [] };
|
|
793
|
+
|
|
794
|
+
for (const record of records) {
|
|
795
|
+
try {
|
|
796
|
+
await wrapper.write(this.gun, record.path, record.data);
|
|
797
|
+
results.success++;
|
|
798
|
+
} catch (error) {
|
|
799
|
+
results.failed++;
|
|
800
|
+
results.errors.push({ path: record.path, error: error.message });
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return results;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// ============================================================================
|
|
808
|
+
// LIFECYCLE
|
|
809
|
+
// ============================================================================
|
|
810
|
+
|
|
811
|
+
close() {
|
|
812
|
+
// 1. Unsubscribe all active subscriptions
|
|
813
|
+
for (const [id, subscription] of this.subscriptions) {
|
|
814
|
+
if (subscription.active) {
|
|
815
|
+
subscription.active = false;
|
|
816
|
+
if (subscription.gunRef) {
|
|
817
|
+
try {
|
|
818
|
+
subscription.gunRef.off();
|
|
819
|
+
} catch (e) {}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
this.subscriptions.clear();
|
|
824
|
+
|
|
825
|
+
// 2. Clear schema cache
|
|
826
|
+
if (this.schemaValidator) {
|
|
827
|
+
this.schemaValidator.clearCache();
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// 3. Clear write cache
|
|
831
|
+
this.writeCache.clear();
|
|
832
|
+
|
|
833
|
+
// 4. Logout auth
|
|
834
|
+
if (this.auth) {
|
|
835
|
+
this.auth.logout();
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// 5. Clean up Gun connections
|
|
839
|
+
if (this.gun) {
|
|
840
|
+
try {
|
|
841
|
+
// Clean up mesh connections
|
|
842
|
+
const mesh = this.gun.back('opt.mesh');
|
|
843
|
+
if (mesh) {
|
|
844
|
+
if (mesh.way) {
|
|
845
|
+
Object.values(mesh.way).forEach(conn => {
|
|
846
|
+
if (conn?.wire?.close) conn.wire.close();
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
if (mesh.opt?.peers) mesh.opt.peers = {};
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// Close web server if present
|
|
853
|
+
const server = this.gun.back('opt.web');
|
|
854
|
+
if (server?.close) server.close();
|
|
855
|
+
|
|
856
|
+
// Turn off all listeners
|
|
857
|
+
this.gun.off();
|
|
858
|
+
} catch (error) {
|
|
859
|
+
console.warn('Error during Gun cleanup:', error);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
getStatus() {
|
|
865
|
+
return {
|
|
866
|
+
type: 'gundb',
|
|
867
|
+
publicKey: this.publicKey,
|
|
868
|
+
peers: this.config.peers || [],
|
|
869
|
+
connected: !!this.gun,
|
|
870
|
+
authenticated: this.isAuthenticated(),
|
|
871
|
+
subscriptionCount: this.subscriptions.size,
|
|
872
|
+
schemaValidationEnabled: this.schemaValidator?.isStrict() || false
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export default GunDBBackend;
|
|
878
|
+
</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-ai.html">ai</a></div><div class="sidebar-section-children"><a href="module-ai_aggregation.html">ai/aggregation</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown.html">ai/breakdown</a></div><div class="sidebar-section-children"><a href="module-ai_classifier.html">ai/classifier</a></div><div class="sidebar-section-children"><a href="module-ai_council.html">ai/council</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings.html">ai/embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai.html">ai/federation-ai</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai.html">ai/h3-ai</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops.html">ai/json-ops</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service.html">ai/llm-service</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query.html">ai/nl-query</a></div><div class="sidebar-section-children"><a href="module-ai_relationships.html">ai/relationships</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor.html">ai/schema-extractor</a></div><div class="sidebar-section-children"><a href="module-ai_spatial.html">ai/spatial</a></div><div class="sidebar-section-children"><a href="module-ai_tts.html">ai/tts</a></div><div class="sidebar-section-children"><a href="module-content_social-protocols.html">content/social-protocols</a></div><div class="sidebar-section-children"><a href="module-core_holosphere.html">core/holosphere</a></div><div class="sidebar-section-children"><a href="module-crypto_nostr-utils.html">crypto/nostr-utils</a></div><div class="sidebar-section-children"><a href="module-crypto_secp256k1.html">crypto/secp256k1</a></div><div class="sidebar-section-children"><a href="module-federation_hologram.html">federation/hologram</a></div><div class="sidebar-section-children"><a href="module-hierarchical_upcast.html">hierarchical/upcast</a></div><div class="sidebar-section-children"><a href="module-holosphere.html">holosphere</a></div><div class="sidebar-section-children"><a href="module-lib_ai-methods.html">lib/ai-methods</a></div><div class="sidebar-section-children"><a href="module-lib_contract-methods.html">lib/contract-methods</a></div><div class="sidebar-section-children"><a href="module-lib_errors.html">lib/errors</a></div><div class="sidebar-section-children"><a href="module-lib_federation-methods.html">lib/federation-methods</a></div><div class="sidebar-section-children"><a href="module-lib_index.html">lib/index</a></div><div class="sidebar-section-children"><a href="module-schema_validator.html">schema/validator</a></div><div class="sidebar-section-children"><a href="module-spatial_h3-operations.html">spatial/h3-operations</a></div><div class="sidebar-section-children"><a href="module-storage_backend-factory.html">storage/backend-factory</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface.html">storage/backend-interface</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend.html">storage/backends/activitypub-backend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server.html">storage/backends/activitypub/server</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend.html">storage/backends/gundb-backend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend.html">storage/backends/nostr-backend</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage.html">storage/filesystem-storage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser.html">storage/filesystem-storage-browser</a></div><div class="sidebar-section-children"><a href="module-storage_global-tables.html">storage/global-tables</a></div><div class="sidebar-section-children"><a href="module-storage_gun-async.html">storage/gun-async</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth.html">storage/gun-auth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-federation.html">storage/gun-federation</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references.html">storage/gun-references</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema.html">storage/gun-schema</a></div><div class="sidebar-section-children"><a href="module-storage_gun-wrapper.html">storage/gun-wrapper</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage.html">storage/indexeddb-storage</a></div><div class="sidebar-section-children"><a href="module-storage_key-storage.html">storage/key-storage</a></div><div class="sidebar-section-children"><a href="module-storage_key-storage-simple.html">storage/key-storage-simple</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage.html">storage/memory-storage</a></div><div class="sidebar-section-children"><a href="module-storage_migration.html">storage/migration</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-async.html">storage/nostr-async</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client.html">storage/nostr-client</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-wrapper.html">storage/nostr-wrapper</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue.html">storage/outbox-queue</a></div><div class="sidebar-section-children"><a href="module-storage_persistent-storage.html">storage/persistent-storage</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service.html">storage/sync-service</a></div><div class="sidebar-section-children"><a href="module-storage_unified-storage.html">storage/unified-storage</a></div><div class="sidebar-section-children"><a href="module-subscriptions_manager.html">subscriptions/manager</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-ai_aggregation.SmartAggregation.html">SmartAggregation</a></div><div class="sidebar-section-children"><a href="module-ai_aggregation-SmartAggregation.html">SmartAggregation</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown.TaskBreakdown.html">TaskBreakdown</a></div><div class="sidebar-section-children"><a href="module-ai_breakdown-TaskBreakdown.html">TaskBreakdown</a></div><div class="sidebar-section-children"><a href="module-ai_classifier.Classifier.html">Classifier</a></div><div class="sidebar-section-children"><a href="module-ai_classifier-Classifier.html">Classifier</a></div><div class="sidebar-section-children"><a href="module-ai_council.Council.html">Council</a></div><div class="sidebar-section-children"><a href="module-ai_council-Council.html">Council</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings.Embeddings.html">Embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_embeddings-Embeddings.html">Embeddings</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai.FederationAdvisor.html">FederationAdvisor</a></div><div class="sidebar-section-children"><a href="module-ai_federation-ai-FederationAdvisor.html">FederationAdvisor</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai.H3AI.html">H3AI</a></div><div class="sidebar-section-children"><a href="module-ai_h3-ai-H3AI.html">H3AI</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops.JSONOps.html">JSONOps</a></div><div class="sidebar-section-children"><a href="module-ai_json-ops-JSONOps.html">JSONOps</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service.LLMService.html">LLMService</a></div><div class="sidebar-section-children"><a href="module-ai_llm-service-LLMService.html">LLMService</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query.NLQuery.html">NLQuery</a></div><div class="sidebar-section-children"><a href="module-ai_nl-query-NLQuery.html">NLQuery</a></div><div class="sidebar-section-children"><a href="module-ai_relationships.RelationshipDiscovery.html">RelationshipDiscovery</a></div><div class="sidebar-section-children"><a href="module-ai_relationships-RelationshipDiscovery.html">RelationshipDiscovery</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor.SchemaExtractor.html">SchemaExtractor</a></div><div class="sidebar-section-children"><a href="module-ai_schema-extractor-SchemaExtractor.html">SchemaExtractor</a></div><div class="sidebar-section-children"><a href="module-ai_spatial.SpatialAnalysis.html">SpatialAnalysis</a></div><div class="sidebar-section-children"><a href="module-ai_spatial-SpatialAnalysis.html">SpatialAnalysis</a></div><div class="sidebar-section-children"><a href="module-ai_tts.TTS.html">TTS</a></div><div class="sidebar-section-children"><a href="module-ai_tts-TTS.html">TTS</a></div><div class="sidebar-section-children"><a href="module-core_holosphere.HoloSphere.html">HoloSphere</a></div><div class="sidebar-section-children"><a href="module-core_holosphere-HoloSphere.html">HoloSphere</a></div><div class="sidebar-section-children"><a href="module-holosphere-HoloSphereBase.html">HoloSphereBase</a></div><div class="sidebar-section-children"><a href="module-holosphere-HoloSphereBase.html">HoloSphereBase</a></div><div class="sidebar-section-children"><a href="module-lib_errors.AuthorizationError.html">AuthorizationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors.ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors-AuthorizationError.html">AuthorizationError</a></div><div class="sidebar-section-children"><a href="module-lib_errors-ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-schema_validator.ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-schema_validator-ValidationError.html">ValidationError</a></div><div class="sidebar-section-children"><a href="module-storage_backend-factory.BackendFactory.html">BackendFactory</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface.StorageBackend.html">StorageBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backend-interface-StorageBackend.html">StorageBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend.ActivityPubBackend.html">ActivityPubBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub-backend-ActivityPubBackend.html">ActivityPubBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server.ActivityPubServer.html">ActivityPubServer</a></div><div class="sidebar-section-children"><a href="module-storage_backends_activitypub_server-ActivityPubServer.html">ActivityPubServer</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend.GunDBBackend.html">GunDBBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_gundb-backend-GunDBBackend.html">GunDBBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend.NostrBackend.html">NostrBackend</a></div><div class="sidebar-section-children"><a href="module-storage_backends_nostr-backend-NostrBackend.html">NostrBackend</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser.FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-browser-FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage.FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_filesystem-storage-FileSystemStorage.html">FileSystemStorage</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth.GunAuth.html">GunAuth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-auth-GunAuth.html">GunAuth</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references.GunReferenceHandler.html">GunReferenceHandler</a></div><div class="sidebar-section-children"><a href="module-storage_gun-references-GunReferenceHandler.html">GunReferenceHandler</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema.GunSchemaValidator.html">GunSchemaValidator</a></div><div class="sidebar-section-children"><a href="module-storage_gun-schema-GunSchemaValidator.html">GunSchemaValidator</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage.IndexedDBStorage.html">IndexedDBStorage</a></div><div class="sidebar-section-children"><a href="module-storage_indexeddb-storage-IndexedDBStorage.html">IndexedDBStorage</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage.MemoryStorage.html">MemoryStorage</a></div><div class="sidebar-section-children"><a href="module-storage_memory-storage-MemoryStorage.html">MemoryStorage</a></div><div class="sidebar-section-children"><a href="module-storage_migration.MigrationTool.html">MigrationTool</a></div><div class="sidebar-section-children"><a href="module-storage_migration-MigrationTool.html">MigrationTool</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client.NostrClient.html">NostrClient</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client-LRUCache.html">LRUCache</a></div><div class="sidebar-section-children"><a href="module-storage_nostr-client-NostrClient.html">NostrClient</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue.OutboxQueue.html">OutboxQueue</a></div><div class="sidebar-section-children"><a href="module-storage_outbox-queue-OutboxQueue.html">OutboxQueue</a></div><div class="sidebar-section-children"><a href="module-storage_persistent-storage-PersistentStorage.html">PersistentStorage</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service.SyncService.html">SyncService</a></div><div class="sidebar-section-children"><a href="module-storage_sync-service-SyncService.html">SyncService</a></div><div class="sidebar-section-children"><a href="module-subscriptions_manager.SubscriptionRegistry.html">SubscriptionRegistry</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-global"><div>Global</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="global.html#FederationRequestPayload">FederationRequestPayload</a></div><div class="sidebar-section-children"><a href="global.html#FederationResponsePayload">FederationResponsePayload</a></div><div class="sidebar-section-children"><a href="global.html#acceptFederationRequest">acceptFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#acceptFederationRequest">acceptFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#addFederatedPartner">addFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#cleanupExpiredCapabilities">cleanupExpiredCapabilities</a></div><div class="sidebar-section-children"><a href="global.html#createFederationRequest">createFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#createFederationResponse">createFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#declineFederationRequest">declineFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#getCapabilityForAuthor">getCapabilityForAuthor</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedAuthors">getFederatedAuthors</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedAuthorsForScope">getFederatedAuthorsForScope</a></div><div class="sidebar-section-children"><a href="global.html#getFederatedPartner">getFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#getFederationRegistry">getFederationRegistry</a></div><div class="sidebar-section-children"><a href="global.html#getPendingFederationRequests">getPendingFederationRequests</a></div><div class="sidebar-section-children"><a href="global.html#initiateFederationHandshake">initiateFederationHandshake</a></div><div class="sidebar-section-children"><a href="global.html#isFederationRequest">isFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#isFederationResponse">isFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#rejectFederationRequest">rejectFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#removeFederatedPartner">removeFederatedPartner</a></div><div class="sidebar-section-children"><a href="global.html#revokeOutboundCapability">revokeOutboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#saveFederationRegistry">saveFederationRegistry</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationRequest">sendFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationRequest">sendFederationRequest</a></div><div class="sidebar-section-children"><a href="global.html#sendFederationResponse">sendFederationResponse</a></div><div class="sidebar-section-children"><a href="global.html#storeInboundCapability">storeInboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#storeOutboundCapability">storeOutboundCapability</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationAcceptances">subscribeFederationAcceptances</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationDeclines">subscribeFederationDeclines</a></div><div class="sidebar-section-children"><a href="global.html#subscribeFederationRequests">subscribeFederationRequests</a></div><div class="sidebar-section-children"><a href="global.html#subscribeToFederationDMs">subscribeToFederationDMs</a></div><div class="sidebar-section-children"><a href="global.html#updateDiscoverySettings">updateDiscoverySettings</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|