@cmdoss/memwal-sdk 0.6.0
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/ARCHITECTURE.md +463 -0
- package/BENCHMARKS.md +238 -0
- package/README.md +142 -0
- package/dist/access/PermissionService.d.ts +179 -0
- package/dist/access/PermissionService.d.ts.map +1 -0
- package/dist/access/PermissionService.js +445 -0
- package/dist/access/PermissionService.js.map +1 -0
- package/dist/access/index.d.ts +8 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/index.js +7 -0
- package/dist/access/index.js.map +1 -0
- package/dist/aggregation/AggregationService.d.ts +132 -0
- package/dist/aggregation/AggregationService.d.ts.map +1 -0
- package/dist/aggregation/AggregationService.js +225 -0
- package/dist/aggregation/AggregationService.js.map +1 -0
- package/dist/aggregation/index.d.ts +8 -0
- package/dist/aggregation/index.d.ts.map +1 -0
- package/dist/aggregation/index.js +7 -0
- package/dist/aggregation/index.js.map +1 -0
- package/dist/ai-sdk/PDWVectorStore.d.ts +124 -0
- package/dist/ai-sdk/PDWVectorStore.d.ts.map +1 -0
- package/dist/ai-sdk/PDWVectorStore.js +557 -0
- package/dist/ai-sdk/PDWVectorStore.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +45 -0
- package/dist/ai-sdk/index.d.ts.map +1 -0
- package/dist/ai-sdk/index.js +45 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/ai-sdk/tools.d.ts +153 -0
- package/dist/ai-sdk/tools.d.ts.map +1 -0
- package/dist/ai-sdk/tools.js +312 -0
- package/dist/ai-sdk/tools.js.map +1 -0
- package/dist/ai-sdk/types.d.ts +336 -0
- package/dist/ai-sdk/types.d.ts.map +1 -0
- package/dist/ai-sdk/types.js +36 -0
- package/dist/ai-sdk/types.js.map +1 -0
- package/dist/api/client.d.ts +43 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +136 -0
- package/dist/api/client.js.map +1 -0
- package/dist/batch/BatchManager.d.ts +147 -0
- package/dist/batch/BatchManager.d.ts.map +1 -0
- package/dist/batch/BatchManager.js +427 -0
- package/dist/batch/BatchManager.js.map +1 -0
- package/dist/batch/BatchingService.d.ts +122 -0
- package/dist/batch/BatchingService.d.ts.map +1 -0
- package/dist/batch/BatchingService.js +301 -0
- package/dist/batch/BatchingService.js.map +1 -0
- package/dist/batch/MemoryProcessingCache.d.ts +147 -0
- package/dist/batch/MemoryProcessingCache.d.ts.map +1 -0
- package/dist/batch/MemoryProcessingCache.js +349 -0
- package/dist/batch/MemoryProcessingCache.js.map +1 -0
- package/dist/batch/index.d.ts +13 -0
- package/dist/batch/index.d.ts.map +1 -0
- package/dist/batch/index.js +10 -0
- package/dist/batch/index.js.map +1 -0
- package/dist/browser.d.ts +73 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +66 -0
- package/dist/browser.js.map +1 -0
- package/dist/chat/index.d.ts +13 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +14 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/client/ClientMemoryManager.d.ts +202 -0
- package/dist/client/ClientMemoryManager.d.ts.map +1 -0
- package/dist/client/ClientMemoryManager.js +764 -0
- package/dist/client/ClientMemoryManager.js.map +1 -0
- package/dist/client/PersonalDataWallet.d.ts +406 -0
- package/dist/client/PersonalDataWallet.d.ts.map +1 -0
- package/dist/client/PersonalDataWallet.js +229 -0
- package/dist/client/PersonalDataWallet.js.map +1 -0
- package/dist/client/SimplePDWClient.d.ts +534 -0
- package/dist/client/SimplePDWClient.d.ts.map +1 -0
- package/dist/client/SimplePDWClient.js +876 -0
- package/dist/client/SimplePDWClient.js.map +1 -0
- package/dist/client/factory.d.ts +99 -0
- package/dist/client/factory.d.ts.map +1 -0
- package/dist/client/factory.js +126 -0
- package/dist/client/factory.js.map +1 -0
- package/dist/client/namespaces/AnalyticsNamespace.d.ts +178 -0
- package/dist/client/namespaces/AnalyticsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/AnalyticsNamespace.js +261 -0
- package/dist/client/namespaces/AnalyticsNamespace.js.map +1 -0
- package/dist/client/namespaces/BatchNamespace.d.ts +120 -0
- package/dist/client/namespaces/BatchNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/BatchNamespace.js +261 -0
- package/dist/client/namespaces/BatchNamespace.js.map +1 -0
- package/dist/client/namespaces/CacheNamespace.d.ts +80 -0
- package/dist/client/namespaces/CacheNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/CacheNamespace.js +100 -0
- package/dist/client/namespaces/CacheNamespace.js.map +1 -0
- package/dist/client/namespaces/CapabilityNamespace.d.ts +145 -0
- package/dist/client/namespaces/CapabilityNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/CapabilityNamespace.js +181 -0
- package/dist/client/namespaces/CapabilityNamespace.js.map +1 -0
- package/dist/client/namespaces/ChatNamespace.d.ts +110 -0
- package/dist/client/namespaces/ChatNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ChatNamespace.js +123 -0
- package/dist/client/namespaces/ChatNamespace.js.map +1 -0
- package/dist/client/namespaces/ClassifyNamespace.d.ts +96 -0
- package/dist/client/namespaces/ClassifyNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ClassifyNamespace.js +149 -0
- package/dist/client/namespaces/ClassifyNamespace.js.map +1 -0
- package/dist/client/namespaces/ContextNamespace.d.ts +150 -0
- package/dist/client/namespaces/ContextNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ContextNamespace.js +250 -0
- package/dist/client/namespaces/ContextNamespace.js.map +1 -0
- package/dist/client/namespaces/EmbeddingsNamespace.d.ts +64 -0
- package/dist/client/namespaces/EmbeddingsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/EmbeddingsNamespace.js +86 -0
- package/dist/client/namespaces/EmbeddingsNamespace.js.map +1 -0
- package/dist/client/namespaces/EncryptionNamespace.d.ts +128 -0
- package/dist/client/namespaces/EncryptionNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/EncryptionNamespace.js +161 -0
- package/dist/client/namespaces/EncryptionNamespace.js.map +1 -0
- package/dist/client/namespaces/GraphNamespace.d.ts +168 -0
- package/dist/client/namespaces/GraphNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/GraphNamespace.js +314 -0
- package/dist/client/namespaces/GraphNamespace.js.map +1 -0
- package/dist/client/namespaces/IndexNamespace.d.ts +141 -0
- package/dist/client/namespaces/IndexNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/IndexNamespace.js +238 -0
- package/dist/client/namespaces/IndexNamespace.js.map +1 -0
- package/dist/client/namespaces/MemoryNamespace.d.ts +277 -0
- package/dist/client/namespaces/MemoryNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/MemoryNamespace.js +907 -0
- package/dist/client/namespaces/MemoryNamespace.js.map +1 -0
- package/dist/client/namespaces/PermissionsNamespace.d.ts +114 -0
- package/dist/client/namespaces/PermissionsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/PermissionsNamespace.js +179 -0
- package/dist/client/namespaces/PermissionsNamespace.js.map +1 -0
- package/dist/client/namespaces/PipelineNamespace.d.ts +125 -0
- package/dist/client/namespaces/PipelineNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/PipelineNamespace.js +171 -0
- package/dist/client/namespaces/PipelineNamespace.js.map +1 -0
- package/dist/client/namespaces/SearchNamespace.d.ts +382 -0
- package/dist/client/namespaces/SearchNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/SearchNamespace.js +821 -0
- package/dist/client/namespaces/SearchNamespace.js.map +1 -0
- package/dist/client/namespaces/StorageNamespace.d.ts +180 -0
- package/dist/client/namespaces/StorageNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/StorageNamespace.js +354 -0
- package/dist/client/namespaces/StorageNamespace.js.map +1 -0
- package/dist/client/namespaces/TxNamespace.d.ts +143 -0
- package/dist/client/namespaces/TxNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/TxNamespace.js +208 -0
- package/dist/client/namespaces/TxNamespace.js.map +1 -0
- package/dist/client/namespaces/WalletNamespace.d.ts +124 -0
- package/dist/client/namespaces/WalletNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/WalletNamespace.js +197 -0
- package/dist/client/namespaces/WalletNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/AINamespace.d.ts +265 -0
- package/dist/client/namespaces/consolidated/AINamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/AINamespace.js +390 -0
- package/dist/client/namespaces/consolidated/AINamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts +265 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.js +412 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts +354 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.js +522 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.d.ts +235 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.js +351 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/index.d.ts +17 -0
- package/dist/client/namespaces/consolidated/index.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/index.js +13 -0
- package/dist/client/namespaces/consolidated/index.js.map +1 -0
- package/dist/client/signers/KeypairSigner.d.ts +55 -0
- package/dist/client/signers/KeypairSigner.d.ts.map +1 -0
- package/dist/client/signers/KeypairSigner.js +84 -0
- package/dist/client/signers/KeypairSigner.js.map +1 -0
- package/dist/client/signers/UnifiedSigner.d.ts +88 -0
- package/dist/client/signers/UnifiedSigner.d.ts.map +1 -0
- package/dist/client/signers/UnifiedSigner.js +13 -0
- package/dist/client/signers/UnifiedSigner.js.map +1 -0
- package/dist/client/signers/WalletAdapterSigner.d.ts +94 -0
- package/dist/client/signers/WalletAdapterSigner.d.ts.map +1 -0
- package/dist/client/signers/WalletAdapterSigner.js +91 -0
- package/dist/client/signers/WalletAdapterSigner.js.map +1 -0
- package/dist/client/signers/index.d.ts +14 -0
- package/dist/client/signers/index.d.ts.map +1 -0
- package/dist/client/signers/index.js +12 -0
- package/dist/client/signers/index.js.map +1 -0
- package/dist/config/ConfigurationHelper.d.ts +167 -0
- package/dist/config/ConfigurationHelper.d.ts.map +1 -0
- package/dist/config/ConfigurationHelper.js +283 -0
- package/dist/config/ConfigurationHelper.js.map +1 -0
- package/dist/config/defaults.d.ts +9 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +49 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/validation.d.ts +12 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +61 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/interfaces/IService.d.ts +162 -0
- package/dist/core/interfaces/IService.d.ts.map +1 -0
- package/dist/core/interfaces/IService.js +159 -0
- package/dist/core/interfaces/IService.js.map +1 -0
- package/dist/core/interfaces/index.d.ts +7 -0
- package/dist/core/interfaces/index.d.ts.map +1 -0
- package/dist/core/interfaces/index.js +7 -0
- package/dist/core/interfaces/index.js.map +1 -0
- package/dist/core/types/capability.d.ts +268 -0
- package/dist/core/types/capability.d.ts.map +1 -0
- package/dist/core/types/capability.js +16 -0
- package/dist/core/types/capability.js.map +1 -0
- package/dist/core/types/index.d.ts +750 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +6 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/wallet.d.ts +254 -0
- package/dist/core/types/wallet.d.ts.map +1 -0
- package/dist/core/types/wallet.js +27 -0
- package/dist/core/types/wallet.js.map +1 -0
- package/dist/core/types.d.ts +8 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +8 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wallet.d.ts +209 -0
- package/dist/core/wallet.d.ts.map +1 -0
- package/dist/core/wallet.js +27 -0
- package/dist/core/wallet.js.map +1 -0
- package/dist/embedding/index.d.ts +9 -0
- package/dist/embedding/index.d.ts.map +1 -0
- package/dist/embedding/index.js +8 -0
- package/dist/embedding/index.js.map +1 -0
- package/dist/embedding/types.d.ts +302 -0
- package/dist/embedding/types.d.ts.map +1 -0
- package/dist/embedding/types.js +9 -0
- package/dist/embedding/types.js.map +1 -0
- package/dist/encryption/index.d.ts +14 -0
- package/dist/encryption/index.d.ts.map +1 -0
- package/dist/encryption/index.js +14 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/errors/index.d.ts +149 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +301 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/recovery.d.ts +128 -0
- package/dist/errors/recovery.d.ts.map +1 -0
- package/dist/errors/recovery.js +320 -0
- package/dist/errors/recovery.js.map +1 -0
- package/dist/errors/validation.d.ts +106 -0
- package/dist/errors/validation.d.ts.map +1 -0
- package/dist/errors/validation.js +354 -0
- package/dist/errors/validation.js.map +1 -0
- package/dist/generated/pdw/capability.d.ts +223 -0
- package/dist/generated/pdw/capability.d.ts.map +1 -0
- package/dist/generated/pdw/capability.js +238 -0
- package/dist/generated/pdw/capability.js.map +1 -0
- package/dist/generated/pdw/deps/sui/object.d.ts +9 -0
- package/dist/generated/pdw/deps/sui/object.d.ts.map +1 -0
- package/dist/generated/pdw/deps/sui/object.js +11 -0
- package/dist/generated/pdw/deps/sui/object.js.map +1 -0
- package/dist/generated/pdw/deps/sui/vec_map.d.ts +37 -0
- package/dist/generated/pdw/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/generated/pdw/deps/sui/vec_map.js +28 -0
- package/dist/generated/pdw/deps/sui/vec_map.js.map +1 -0
- package/dist/generated/pdw/memory.d.ts +676 -0
- package/dist/generated/pdw/memory.d.ts.map +1 -0
- package/dist/generated/pdw/memory.js +681 -0
- package/dist/generated/pdw/memory.js.map +1 -0
- package/dist/generated/pdw/wallet.d.ts +78 -0
- package/dist/generated/pdw/wallet.d.ts.map +1 -0
- package/dist/generated/pdw/wallet.js +89 -0
- package/dist/generated/pdw/wallet.js.map +1 -0
- package/dist/generated/utils/index.d.ts +12 -0
- package/dist/generated/utils/index.d.ts.map +1 -0
- package/dist/generated/utils/index.js +132 -0
- package/dist/generated/utils/index.js.map +1 -0
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts +101 -0
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts.map +1 -0
- package/dist/graph/BrowserKnowledgeGraphManager.js +411 -0
- package/dist/graph/BrowserKnowledgeGraphManager.js.map +1 -0
- package/dist/graph/GraphService.d.ts +194 -0
- package/dist/graph/GraphService.d.ts.map +1 -0
- package/dist/graph/GraphService.js +662 -0
- package/dist/graph/GraphService.js.map +1 -0
- package/dist/graph/KnowledgeGraphManager.d.ts +161 -0
- package/dist/graph/KnowledgeGraphManager.d.ts.map +1 -0
- package/dist/graph/KnowledgeGraphManager.js +495 -0
- package/dist/graph/KnowledgeGraphManager.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +9 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/hooks.wip/index.d.ts +55 -0
- package/dist/hooks.wip/index.d.ts.map +1 -0
- package/dist/hooks.wip/index.js +58 -0
- package/dist/hooks.wip/index.js.map +1 -0
- package/dist/hooks.wip/useCreateMemory.d.ts +111 -0
- package/dist/hooks.wip/useCreateMemory.d.ts.map +1 -0
- package/dist/hooks.wip/useCreateMemory.js +149 -0
- package/dist/hooks.wip/useCreateMemory.js.map +1 -0
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts +122 -0
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts.map +1 -0
- package/dist/hooks.wip/useCreateMemoryBatch.js +221 -0
- package/dist/hooks.wip/useCreateMemoryBatch.js.map +1 -0
- package/dist/hooks.wip/useKnowledgeGraph.d.ts +66 -0
- package/dist/hooks.wip/useKnowledgeGraph.d.ts.map +1 -0
- package/dist/hooks.wip/useKnowledgeGraph.js +229 -0
- package/dist/hooks.wip/useKnowledgeGraph.js.map +1 -0
- package/dist/hooks.wip/useMemoryChat.d.ts +106 -0
- package/dist/hooks.wip/useMemoryChat.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryChat.js +284 -0
- package/dist/hooks.wip/useMemoryChat.js.map +1 -0
- package/dist/hooks.wip/useMemoryIndex.d.ts +90 -0
- package/dist/hooks.wip/useMemoryIndex.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryIndex.js +218 -0
- package/dist/hooks.wip/useMemoryIndex.js.map +1 -0
- package/dist/hooks.wip/useMemoryManager.d.ts +35 -0
- package/dist/hooks.wip/useMemoryManager.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryManager.js +86 -0
- package/dist/hooks.wip/useMemoryManager.js.map +1 -0
- package/dist/hooks.wip/useMemorySearch.d.ts +100 -0
- package/dist/hooks.wip/useMemorySearch.d.ts.map +1 -0
- package/dist/hooks.wip/useMemorySearch.js +278 -0
- package/dist/hooks.wip/useMemorySearch.js.map +1 -0
- package/dist/hooks.wip/useMemoryServices.d.ts +80 -0
- package/dist/hooks.wip/useMemoryServices.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryServices.js +264 -0
- package/dist/hooks.wip/useMemoryServices.js.map +1 -0
- package/dist/hooks.wip/usePDWRAG.d.ts +112 -0
- package/dist/hooks.wip/usePDWRAG.d.ts.map +1 -0
- package/dist/hooks.wip/usePDWRAG.js +121 -0
- package/dist/hooks.wip/usePDWRAG.js.map +1 -0
- package/dist/hooks.wip/usePDWVectorStore.d.ts +68 -0
- package/dist/hooks.wip/usePDWVectorStore.d.ts.map +1 -0
- package/dist/hooks.wip/usePDWVectorStore.js +102 -0
- package/dist/hooks.wip/usePDWVectorStore.js.map +1 -0
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts +138 -0
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts.map +1 -0
- package/dist/hooks.wip/useRetrieveEmbedding.js +121 -0
- package/dist/hooks.wip/useRetrieveEmbedding.js.map +1 -0
- package/dist/hooks.wip/useSearchMemories.d.ts +103 -0
- package/dist/hooks.wip/useSearchMemories.d.ts.map +1 -0
- package/dist/hooks.wip/useSearchMemories.js +146 -0
- package/dist/hooks.wip/useSearchMemories.js.map +1 -0
- package/dist/hooks.wip/useStoreEmbedding.d.ts +174 -0
- package/dist/hooks.wip/useStoreEmbedding.d.ts.map +1 -0
- package/dist/hooks.wip/useStoreEmbedding.js +167 -0
- package/dist/hooks.wip/useStoreEmbedding.js.map +1 -0
- package/dist/hooks.wip/useWalletMemories.d.ts +119 -0
- package/dist/hooks.wip/useWalletMemories.d.ts.map +1 -0
- package/dist/hooks.wip/useWalletMemories.js +166 -0
- package/dist/hooks.wip/useWalletMemories.js.map +1 -0
- package/dist/hooks.wip/utils/cache.d.ts +25 -0
- package/dist/hooks.wip/utils/cache.d.ts.map +1 -0
- package/dist/hooks.wip/utils/cache.js +38 -0
- package/dist/hooks.wip/utils/cache.js.map +1 -0
- package/dist/hooks.wip/utils/types.d.ts +138 -0
- package/dist/hooks.wip/utils/types.d.ts.map +1 -0
- package/dist/hooks.wip/utils/types.js +5 -0
- package/dist/hooks.wip/utils/types.js.map +1 -0
- package/dist/index.d.ts +190 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +298 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/ai/EmbeddingService.d.ts +101 -0
- package/dist/infrastructure/ai/EmbeddingService.d.ts.map +1 -0
- package/dist/infrastructure/ai/EmbeddingService.js +242 -0
- package/dist/infrastructure/ai/EmbeddingService.js.map +1 -0
- package/dist/infrastructure/ai/GeminiAIService.d.ts +84 -0
- package/dist/infrastructure/ai/GeminiAIService.d.ts.map +1 -0
- package/dist/infrastructure/ai/GeminiAIService.js +300 -0
- package/dist/infrastructure/ai/GeminiAIService.js.map +1 -0
- package/dist/infrastructure/ai/index.d.ts +8 -0
- package/dist/infrastructure/ai/index.d.ts.map +1 -0
- package/dist/infrastructure/ai/index.js +8 -0
- package/dist/infrastructure/ai/index.js.map +1 -0
- package/dist/infrastructure/index.d.ts +16 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +19 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/seal/EncryptionService.d.ts +162 -0
- package/dist/infrastructure/seal/EncryptionService.d.ts.map +1 -0
- package/dist/infrastructure/seal/EncryptionService.js +466 -0
- package/dist/infrastructure/seal/EncryptionService.js.map +1 -0
- package/dist/infrastructure/seal/SealService.d.ts +132 -0
- package/dist/infrastructure/seal/SealService.d.ts.map +1 -0
- package/dist/infrastructure/seal/SealService.js +473 -0
- package/dist/infrastructure/seal/SealService.js.map +1 -0
- package/dist/infrastructure/seal/index.d.ts +8 -0
- package/dist/infrastructure/seal/index.d.ts.map +1 -0
- package/dist/infrastructure/seal/index.js +8 -0
- package/dist/infrastructure/seal/index.js.map +1 -0
- package/dist/infrastructure/sui/BlockchainManager.d.ts +161 -0
- package/dist/infrastructure/sui/BlockchainManager.d.ts.map +1 -0
- package/dist/infrastructure/sui/BlockchainManager.js +421 -0
- package/dist/infrastructure/sui/BlockchainManager.js.map +1 -0
- package/dist/infrastructure/sui/SuiService.d.ts +179 -0
- package/dist/infrastructure/sui/SuiService.d.ts.map +1 -0
- package/dist/infrastructure/sui/SuiService.js +658 -0
- package/dist/infrastructure/sui/SuiService.js.map +1 -0
- package/dist/infrastructure/sui/index.d.ts +8 -0
- package/dist/infrastructure/sui/index.d.ts.map +1 -0
- package/dist/infrastructure/sui/index.js +8 -0
- package/dist/infrastructure/sui/index.js.map +1 -0
- package/dist/infrastructure/walrus/StorageManager.d.ts +207 -0
- package/dist/infrastructure/walrus/StorageManager.d.ts.map +1 -0
- package/dist/infrastructure/walrus/StorageManager.js +413 -0
- package/dist/infrastructure/walrus/StorageManager.js.map +1 -0
- package/dist/infrastructure/walrus/WalrusStorageService.d.ts +177 -0
- package/dist/infrastructure/walrus/WalrusStorageService.d.ts.map +1 -0
- package/dist/infrastructure/walrus/WalrusStorageService.js +403 -0
- package/dist/infrastructure/walrus/WalrusStorageService.js.map +1 -0
- package/dist/infrastructure/walrus/index.d.ts +8 -0
- package/dist/infrastructure/walrus/index.d.ts.map +1 -0
- package/dist/infrastructure/walrus/index.js +8 -0
- package/dist/infrastructure/walrus/index.js.map +1 -0
- package/dist/langchain/PDWEmbeddings.d.ts +77 -0
- package/dist/langchain/PDWEmbeddings.d.ts.map +1 -0
- package/dist/langchain/PDWEmbeddings.js +96 -0
- package/dist/langchain/PDWEmbeddings.js.map +1 -0
- package/dist/langchain/PDWVectorStore.d.ts +173 -0
- package/dist/langchain/PDWVectorStore.d.ts.map +1 -0
- package/dist/langchain/PDWVectorStore.js +304 -0
- package/dist/langchain/PDWVectorStore.js.map +1 -0
- package/dist/langchain/createPDWRAG.d.ts +115 -0
- package/dist/langchain/createPDWRAG.d.ts.map +1 -0
- package/dist/langchain/createPDWRAG.js +181 -0
- package/dist/langchain/createPDWRAG.js.map +1 -0
- package/dist/langchain/index.d.ts +35 -0
- package/dist/langchain/index.d.ts.map +1 -0
- package/dist/langchain/index.js +35 -0
- package/dist/langchain/index.js.map +1 -0
- package/dist/memory/index.d.ts +13 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +14 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/permissions/ConsentRepository.d.ts +71 -0
- package/dist/permissions/ConsentRepository.d.ts.map +1 -0
- package/dist/permissions/ConsentRepository.js +297 -0
- package/dist/permissions/ConsentRepository.js.map +1 -0
- package/dist/permissions/index.d.ts +9 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +8 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/pipeline/MemoryPipeline.d.ts +191 -0
- package/dist/pipeline/MemoryPipeline.d.ts.map +1 -0
- package/dist/pipeline/MemoryPipeline.js +588 -0
- package/dist/pipeline/MemoryPipeline.js.map +1 -0
- package/dist/pipeline/PipelineManager.d.ts +178 -0
- package/dist/pipeline/PipelineManager.d.ts.map +1 -0
- package/dist/pipeline/PipelineManager.js +485 -0
- package/dist/pipeline/PipelineManager.js.map +1 -0
- package/dist/pipeline/index.d.ts +13 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +11 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/retrieval/AdvancedSearchService.d.ts +231 -0
- package/dist/retrieval/AdvancedSearchService.d.ts.map +1 -0
- package/dist/retrieval/AdvancedSearchService.js +384 -0
- package/dist/retrieval/AdvancedSearchService.js.map +1 -0
- package/dist/retrieval/MemoryAnalyticsService.d.ts +227 -0
- package/dist/retrieval/MemoryAnalyticsService.d.ts.map +1 -0
- package/dist/retrieval/MemoryAnalyticsService.js +417 -0
- package/dist/retrieval/MemoryAnalyticsService.js.map +1 -0
- package/dist/retrieval/MemoryDecryptionPipeline.d.ts +191 -0
- package/dist/retrieval/MemoryDecryptionPipeline.d.ts.map +1 -0
- package/dist/retrieval/MemoryDecryptionPipeline.js +623 -0
- package/dist/retrieval/MemoryDecryptionPipeline.js.map +1 -0
- package/dist/retrieval/MemoryRetrievalService.d.ts +248 -0
- package/dist/retrieval/MemoryRetrievalService.d.ts.map +1 -0
- package/dist/retrieval/MemoryRetrievalService.js +519 -0
- package/dist/retrieval/MemoryRetrievalService.js.map +1 -0
- package/dist/retrieval/index.d.ts +14 -0
- package/dist/retrieval/index.d.ts.map +1 -0
- package/dist/retrieval/index.js +10 -0
- package/dist/retrieval/index.js.map +1 -0
- package/dist/services/BatchService.d.ts +109 -0
- package/dist/services/BatchService.d.ts.map +1 -0
- package/dist/services/BatchService.js +259 -0
- package/dist/services/BatchService.js.map +1 -0
- package/dist/services/CapabilityService.d.ts +141 -0
- package/dist/services/CapabilityService.d.ts.map +1 -0
- package/dist/services/CapabilityService.js +361 -0
- package/dist/services/CapabilityService.js.map +1 -0
- package/dist/services/ChatService.d.ts +89 -0
- package/dist/services/ChatService.d.ts.map +1 -0
- package/dist/services/ChatService.js +319 -0
- package/dist/services/ChatService.js.map +1 -0
- package/dist/services/ClassifierService.d.ts +104 -0
- package/dist/services/ClassifierService.d.ts.map +1 -0
- package/dist/services/ClassifierService.js +374 -0
- package/dist/services/ClassifierService.js.map +1 -0
- package/dist/services/CrossContextPermissionService.d.ts +149 -0
- package/dist/services/CrossContextPermissionService.d.ts.map +1 -0
- package/dist/services/CrossContextPermissionService.js +337 -0
- package/dist/services/CrossContextPermissionService.js.map +1 -0
- package/dist/services/EmbeddingService.d.ts +206 -0
- package/dist/services/EmbeddingService.d.ts.map +1 -0
- package/dist/services/EmbeddingService.js +504 -0
- package/dist/services/EmbeddingService.js.map +1 -0
- package/dist/services/EncryptionService.d.ts +201 -0
- package/dist/services/EncryptionService.d.ts.map +1 -0
- package/dist/services/EncryptionService.js +558 -0
- package/dist/services/EncryptionService.js.map +1 -0
- package/dist/services/GeminiAIService.d.ts +112 -0
- package/dist/services/GeminiAIService.d.ts.map +1 -0
- package/dist/services/GeminiAIService.js +389 -0
- package/dist/services/GeminiAIService.js.map +1 -0
- package/dist/services/IndexManager.d.ts +238 -0
- package/dist/services/IndexManager.d.ts.map +1 -0
- package/dist/services/IndexManager.js +691 -0
- package/dist/services/IndexManager.js.map +1 -0
- package/dist/services/MemoryIndexService.d.ts +222 -0
- package/dist/services/MemoryIndexService.d.ts.map +1 -0
- package/dist/services/MemoryIndexService.js +695 -0
- package/dist/services/MemoryIndexService.js.map +1 -0
- package/dist/services/MemoryService.d.ts +156 -0
- package/dist/services/MemoryService.d.ts.map +1 -0
- package/dist/services/MemoryService.js +273 -0
- package/dist/services/MemoryService.js.map +1 -0
- package/dist/services/QueryService.d.ts +182 -0
- package/dist/services/QueryService.d.ts.map +1 -0
- package/dist/services/QueryService.js +631 -0
- package/dist/services/QueryService.js.map +1 -0
- package/dist/services/StorageService.d.ts +523 -0
- package/dist/services/StorageService.d.ts.map +1 -0
- package/dist/services/StorageService.js +627 -0
- package/dist/services/StorageService.js.map +1 -0
- package/dist/services/TransactionService.d.ts +179 -0
- package/dist/services/TransactionService.d.ts.map +1 -0
- package/dist/services/TransactionService.js +639 -0
- package/dist/services/TransactionService.js.map +1 -0
- package/dist/services/VectorService.d.ts +122 -0
- package/dist/services/VectorService.d.ts.map +1 -0
- package/dist/services/VectorService.js +371 -0
- package/dist/services/VectorService.js.map +1 -0
- package/dist/services/ViewService.d.ts +126 -0
- package/dist/services/ViewService.d.ts.map +1 -0
- package/dist/services/ViewService.js +356 -0
- package/dist/services/ViewService.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/storage/BlobAttributesManager.d.ts +60 -0
- package/dist/services/storage/BlobAttributesManager.d.ts.map +1 -0
- package/dist/services/storage/BlobAttributesManager.js +265 -0
- package/dist/services/storage/BlobAttributesManager.js.map +1 -0
- package/dist/services/storage/KnowledgeGraphManager.d.ts +162 -0
- package/dist/services/storage/KnowledgeGraphManager.d.ts.map +1 -0
- package/dist/services/storage/KnowledgeGraphManager.js +303 -0
- package/dist/services/storage/KnowledgeGraphManager.js.map +1 -0
- package/dist/services/storage/MemorySearchManager.d.ts +154 -0
- package/dist/services/storage/MemorySearchManager.d.ts.map +1 -0
- package/dist/services/storage/MemorySearchManager.js +260 -0
- package/dist/services/storage/MemorySearchManager.js.map +1 -0
- package/dist/services/storage/QuiltBatchManager.d.ts +185 -0
- package/dist/services/storage/QuiltBatchManager.d.ts.map +1 -0
- package/dist/services/storage/QuiltBatchManager.js +385 -0
- package/dist/services/storage/QuiltBatchManager.js.map +1 -0
- package/dist/services/storage/WalrusMetadataManager.d.ts +89 -0
- package/dist/services/storage/WalrusMetadataManager.d.ts.map +1 -0
- package/dist/services/storage/WalrusMetadataManager.js +177 -0
- package/dist/services/storage/WalrusMetadataManager.js.map +1 -0
- package/dist/services/storage/WalrusStorageManager.d.ts +113 -0
- package/dist/services/storage/WalrusStorageManager.d.ts.map +1 -0
- package/dist/services/storage/WalrusStorageManager.js +211 -0
- package/dist/services/storage/WalrusStorageManager.js.map +1 -0
- package/dist/services/storage/index.d.ts +24 -0
- package/dist/services/storage/index.d.ts.map +1 -0
- package/dist/services/storage/index.js +18 -0
- package/dist/services/storage/index.js.map +1 -0
- package/dist/transactions/index.d.ts +13 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +14 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/wallet.d.ts +12 -0
- package/dist/types/wallet.d.ts.map +1 -0
- package/dist/types/wallet.js +13 -0
- package/dist/types/wallet.js.map +1 -0
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +30 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rebuildIndex.d.ts +79 -0
- package/dist/utils/rebuildIndex.d.ts.map +1 -0
- package/dist/utils/rebuildIndex.js +211 -0
- package/dist/utils/rebuildIndex.js.map +1 -0
- package/dist/utils/rebuildIndexNode.d.ts +70 -0
- package/dist/utils/rebuildIndexNode.d.ts.map +1 -0
- package/dist/utils/rebuildIndexNode.js +236 -0
- package/dist/utils/rebuildIndexNode.js.map +1 -0
- package/dist/vector/BrowserHnswIndexService.d.ts +93 -0
- package/dist/vector/BrowserHnswIndexService.d.ts.map +1 -0
- package/dist/vector/BrowserHnswIndexService.js +581 -0
- package/dist/vector/BrowserHnswIndexService.js.map +1 -0
- package/dist/vector/HnswWasmService.d.ts +97 -0
- package/dist/vector/HnswWasmService.d.ts.map +1 -0
- package/dist/vector/HnswWasmService.js +518 -0
- package/dist/vector/HnswWasmService.js.map +1 -0
- package/dist/vector/IHnswService.d.ts +179 -0
- package/dist/vector/IHnswService.d.ts.map +1 -0
- package/dist/vector/IHnswService.js +25 -0
- package/dist/vector/IHnswService.js.map +1 -0
- package/dist/vector/NodeHnswService.d.ts +80 -0
- package/dist/vector/NodeHnswService.d.ts.map +1 -0
- package/dist/vector/NodeHnswService.js +589 -0
- package/dist/vector/NodeHnswService.js.map +1 -0
- package/dist/vector/VectorManager.d.ts +142 -0
- package/dist/vector/VectorManager.d.ts.map +1 -0
- package/dist/vector/VectorManager.js +339 -0
- package/dist/vector/VectorManager.js.map +1 -0
- package/dist/vector/createHnswService.d.ts +51 -0
- package/dist/vector/createHnswService.d.ts.map +1 -0
- package/dist/vector/createHnswService.js +120 -0
- package/dist/vector/createHnswService.js.map +1 -0
- package/dist/vector/index.d.ts +24 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/index.js +24 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/view/ViewService.d.ts +136 -0
- package/dist/view/ViewService.d.ts.map +1 -0
- package/dist/view/ViewService.js +325 -0
- package/dist/view/ViewService.js.map +1 -0
- package/dist/view/index.d.ts +7 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +7 -0
- package/dist/view/index.js.map +1 -0
- package/dist/wallet/ContextWalletService.d.ts +172 -0
- package/dist/wallet/ContextWalletService.d.ts.map +1 -0
- package/dist/wallet/ContextWalletService.js +510 -0
- package/dist/wallet/ContextWalletService.js.map +1 -0
- package/dist/wallet/MainWalletService.d.ts +114 -0
- package/dist/wallet/MainWalletService.d.ts.map +1 -0
- package/dist/wallet/MainWalletService.js +259 -0
- package/dist/wallet/MainWalletService.js.map +1 -0
- package/dist/wallet/index.d.ts +16 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +14 -0
- package/dist/wallet/index.js.map +1 -0
- package/package.json +150 -0
- package/src/access/PermissionService.ts +636 -0
- package/src/access/index.ts +8 -0
- package/src/aggregation/AggregationService.ts +390 -0
- package/src/aggregation/index.ts +8 -0
- package/src/ai-sdk/PDWVectorStore.ts +712 -0
- package/src/ai-sdk/index.ts +65 -0
- package/src/ai-sdk/tools.ts +460 -0
- package/src/ai-sdk/types.ts +404 -0
- package/src/batch/BatchManager.ts +598 -0
- package/src/batch/BatchingService.ts +430 -0
- package/src/batch/MemoryProcessingCache.ts +493 -0
- package/src/batch/index.ts +31 -0
- package/src/browser.ts +196 -0
- package/src/client/ClientMemoryManager.ts +982 -0
- package/src/client/PersonalDataWallet.ts +346 -0
- package/src/client/SimplePDWClient.ts +1180 -0
- package/src/client/factory.ts +155 -0
- package/src/client/namespaces/AnalyticsNamespace.ts +377 -0
- package/src/client/namespaces/BatchNamespace.ts +356 -0
- package/src/client/namespaces/CacheNamespace.ts +123 -0
- package/src/client/namespaces/CapabilityNamespace.ts +217 -0
- package/src/client/namespaces/ClassifyNamespace.ts +169 -0
- package/src/client/namespaces/ContextNamespace.ts +297 -0
- package/src/client/namespaces/EmbeddingsNamespace.ts +99 -0
- package/src/client/namespaces/EncryptionNamespace.ts +221 -0
- package/src/client/namespaces/GraphNamespace.ts +468 -0
- package/src/client/namespaces/IndexNamespace.ts +283 -0
- package/src/client/namespaces/MemoryNamespace.ts +1135 -0
- package/src/client/namespaces/PermissionsNamespace.ts +254 -0
- package/src/client/namespaces/PipelineNamespace.ts +220 -0
- package/src/client/namespaces/SearchNamespace.ts +1036 -0
- package/src/client/namespaces/StorageNamespace.ts +458 -0
- package/src/client/namespaces/TxNamespace.ts +260 -0
- package/src/client/namespaces/WalletNamespace.ts +243 -0
- package/src/client/namespaces/consolidated/AINamespace.ts +449 -0
- package/src/client/namespaces/consolidated/BlockchainNamespace.ts +492 -0
- package/src/client/namespaces/consolidated/SecurityNamespace.ts +648 -0
- package/src/client/namespaces/consolidated/StorageNamespace.ts +440 -0
- package/src/client/namespaces/consolidated/index.ts +39 -0
- package/src/client/signers/KeypairSigner.ts +101 -0
- package/src/client/signers/UnifiedSigner.ts +99 -0
- package/src/client/signers/WalletAdapterSigner.ts +149 -0
- package/src/client/signers/index.ts +19 -0
- package/src/config/ConfigurationHelper.ts +413 -0
- package/src/config/defaults.ts +52 -0
- package/src/config/index.ts +9 -0
- package/src/config/validation.ts +71 -0
- package/src/core/index.ts +14 -0
- package/src/core/interfaces/IService.ts +307 -0
- package/src/core/interfaces/index.ts +8 -0
- package/src/core/types/capability.ts +297 -0
- package/src/core/types/index.ts +871 -0
- package/src/core/types/wallet.ts +271 -0
- package/src/core/types.ts +9 -0
- package/src/core/wallet.ts +223 -0
- package/src/embedding/index.ts +20 -0
- package/src/embedding/types.ts +358 -0
- package/src/errors/index.ts +603 -0
- package/src/errors/recovery.ts +462 -0
- package/src/errors/validation.ts +568 -0
- package/src/generated/pdw/capability.ts +319 -0
- package/src/generated/pdw/deps/sui/object.ts +13 -0
- package/src/generated/pdw/deps/sui/vec_map.ts +33 -0
- package/src/generated/pdw/memory.ts +1088 -0
- package/src/generated/pdw/wallet.ts +124 -0
- package/src/generated/utils/index.ts +159 -0
- package/src/graph/GraphService.ts +888 -0
- package/src/graph/KnowledgeGraphManager.ts +729 -0
- package/src/graph/index.ts +26 -0
- package/src/index.ts +458 -0
- package/src/infrastructure/index.ts +22 -0
- package/src/infrastructure/seal/EncryptionService.ts +604 -0
- package/src/infrastructure/seal/SealService.ts +616 -0
- package/src/infrastructure/seal/index.ts +9 -0
- package/src/infrastructure/sui/BlockchainManager.ts +628 -0
- package/src/infrastructure/sui/SuiService.ts +888 -0
- package/src/infrastructure/sui/index.ts +9 -0
- package/src/infrastructure/walrus/StorageManager.ts +605 -0
- package/src/infrastructure/walrus/WalrusStorageService.ts +613 -0
- package/src/infrastructure/walrus/index.ts +9 -0
- package/src/langchain/PDWEmbeddings.ts +145 -0
- package/src/langchain/PDWVectorStore.ts +456 -0
- package/src/langchain/README.md +116 -0
- package/src/langchain/createPDWRAG.ts +303 -0
- package/src/langchain/index.ts +47 -0
- package/src/permissions/ConsentRepository.ts +364 -0
- package/src/permissions/index.ts +9 -0
- package/src/pipeline/MemoryPipeline.ts +863 -0
- package/src/pipeline/PipelineManager.ts +684 -0
- package/src/pipeline/index.ts +27 -0
- package/src/retrieval/AdvancedSearchService.ts +630 -0
- package/src/retrieval/MemoryAnalyticsService.ts +712 -0
- package/src/retrieval/MemoryDecryptionPipeline.ts +825 -0
- package/src/retrieval/MemoryRetrievalService.ts +831 -0
- package/src/retrieval/index.ts +43 -0
- package/src/services/BatchService.ts +353 -0
- package/src/services/CapabilityService.ts +448 -0
- package/src/services/ClassifierService.ts +466 -0
- package/src/services/CrossContextPermissionService.ts +484 -0
- package/src/services/EmbeddingService.ts +706 -0
- package/src/services/EncryptionService.ts +712 -0
- package/src/services/GeminiAIService.ts +497 -0
- package/src/services/IndexManager.ts +1004 -0
- package/src/services/MemoryIndexService.ts +922 -0
- package/src/services/MemoryService.ts +370 -0
- package/src/services/QueryService.ts +891 -0
- package/src/services/StorageService.ts +1111 -0
- package/src/services/TransactionService.ts +791 -0
- package/src/services/VectorService.ts +462 -0
- package/src/services/ViewService.ts +485 -0
- package/src/services/index.ts +25 -0
- package/src/services/storage/BlobAttributesManager.ts +342 -0
- package/src/services/storage/KnowledgeGraphManager.ts +425 -0
- package/src/services/storage/MemorySearchManager.ts +387 -0
- package/src/services/storage/QuiltBatchManager.ts +532 -0
- package/src/services/storage/WalrusMetadataManager.ts +271 -0
- package/src/services/storage/WalrusStorageManager.ts +290 -0
- package/src/services/storage/index.ts +52 -0
- package/src/types/index.ts +13 -0
- package/src/utils/index.ts +68 -0
- package/src/utils/rebuildIndex.ts +290 -0
- package/src/utils/rebuildIndexNode.ts +341 -0
- package/src/vector/BrowserHnswIndexService.ts +758 -0
- package/src/vector/HnswWasmService.ts +679 -0
- package/src/vector/IHnswService.ts +224 -0
- package/src/vector/NodeHnswService.ts +713 -0
- package/src/vector/VectorManager.ts +479 -0
- package/src/vector/createHnswService.ts +135 -0
- package/src/vector/index.ts +57 -0
- package/src/wallet/ContextWalletService.ts +657 -0
- package/src/wallet/MainWalletService.ts +318 -0
- package/src/wallet/index.ts +17 -0
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
import { Transaction, SerialTransactionExecutor } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiClient } from '@mysten/sui/client';
|
|
3
|
+
import {
|
|
4
|
+
PDWConfig,
|
|
5
|
+
TransactionOptions,
|
|
6
|
+
TransactionResult,
|
|
7
|
+
CreateMemoryRecordTxOptions,
|
|
8
|
+
CreateMemoryRecordLightweightTxOptions,
|
|
9
|
+
UpdateMemoryMetadataTxOptions,
|
|
10
|
+
UpdateMemoryRecordTxOptions,
|
|
11
|
+
DeleteMemoryRecordTxOptions,
|
|
12
|
+
CreateMemoryIndexTxOptions,
|
|
13
|
+
UpdateMemoryIndexTxOptions,
|
|
14
|
+
GrantAccessTxOptions,
|
|
15
|
+
RevokeAccessTxOptions,
|
|
16
|
+
RegisterContentTxOptions,
|
|
17
|
+
} from '../types';
|
|
18
|
+
|
|
19
|
+
// Import generated Move contract functions
|
|
20
|
+
import * as MemoryModule from '../generated/pdw/memory';
|
|
21
|
+
import * as CapabilityModule from '../generated/pdw/capability';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* TransactionService provides high-level transaction building and execution
|
|
25
|
+
* for Personal Data Wallet Move contracts with proper error handling and gas management.
|
|
26
|
+
*
|
|
27
|
+
* Uses SerialTransactionExecutor to prevent gas coin version conflicts and equivocation
|
|
28
|
+
* when multiple transactions are executed in sequence. The executor caches object versions
|
|
29
|
+
* and manages gas coins automatically.
|
|
30
|
+
*
|
|
31
|
+
* @see https://sdk.mystenlabs.com/typescript/executors
|
|
32
|
+
*/
|
|
33
|
+
export class TransactionService {
|
|
34
|
+
private executor: SerialTransactionExecutor | null = null;
|
|
35
|
+
private currentSigner: any = null;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
private client: SuiClient,
|
|
39
|
+
private config: PDWConfig
|
|
40
|
+
) {}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get or create SerialTransactionExecutor for the given signer.
|
|
44
|
+
* The executor caches object versions and prevents equivocation.
|
|
45
|
+
*/
|
|
46
|
+
private getExecutor(signer: any): SerialTransactionExecutor {
|
|
47
|
+
// Create new executor if signer changed or doesn't exist
|
|
48
|
+
if (!this.executor || this.currentSigner !== signer) {
|
|
49
|
+
this.executor = new SerialTransactionExecutor({
|
|
50
|
+
client: this.client,
|
|
51
|
+
signer,
|
|
52
|
+
});
|
|
53
|
+
this.currentSigner = signer;
|
|
54
|
+
}
|
|
55
|
+
return this.executor;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Reset the executor (useful when gas coin is exhausted or for cleanup)
|
|
60
|
+
*/
|
|
61
|
+
resetExecutor(): void {
|
|
62
|
+
this.executor = null;
|
|
63
|
+
this.currentSigner = null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ==================== MEMORY TRANSACTIONS ====================
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build transaction to create a new memory record
|
|
70
|
+
*/
|
|
71
|
+
buildCreateMemoryRecord(options: CreateMemoryRecordTxOptions): Transaction {
|
|
72
|
+
const tx = new Transaction();
|
|
73
|
+
|
|
74
|
+
// Set gas budget if provided
|
|
75
|
+
if (options.gasBudget) {
|
|
76
|
+
tx.setGasBudget(options.gasBudget);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Set gas price if provided
|
|
80
|
+
if (options.gasPrice) {
|
|
81
|
+
tx.setGasPrice(options.gasPrice);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Call the memory contract function with Clock for real-time timestamp
|
|
85
|
+
tx.moveCall({
|
|
86
|
+
target: `${this.config.packageId}::memory::create_memory_record`,
|
|
87
|
+
arguments: [
|
|
88
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.category))),
|
|
89
|
+
tx.pure.u64(options.vectorId),
|
|
90
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobId))),
|
|
91
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.contentType))),
|
|
92
|
+
tx.pure.u64(options.contentSize),
|
|
93
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.contentHash))),
|
|
94
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.topic))),
|
|
95
|
+
tx.pure.u8(options.importance),
|
|
96
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.embeddingBlobId))),
|
|
97
|
+
tx.object('0x6'), // Sui Clock object for real-time timestamp
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return tx;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Build transaction to create a lightweight memory record
|
|
106
|
+
*
|
|
107
|
+
* This creates a minimal on-chain Memory struct with only essential queryable fields.
|
|
108
|
+
* Rich metadata should be stored as Walrus blob metadata for gas efficiency.
|
|
109
|
+
*
|
|
110
|
+
* Use this when:
|
|
111
|
+
* - Gas costs are a concern (saves ~50% gas vs full metadata)
|
|
112
|
+
* - Rich metadata is stored on Walrus blob
|
|
113
|
+
* - Only need basic filtering (category, vector_id, importance)
|
|
114
|
+
*
|
|
115
|
+
* @param options - Lightweight memory creation options
|
|
116
|
+
* @returns Transaction to create lightweight memory record
|
|
117
|
+
*/
|
|
118
|
+
buildCreateMemoryRecordLightweight(options: CreateMemoryRecordLightweightTxOptions): Transaction {
|
|
119
|
+
const tx = new Transaction();
|
|
120
|
+
|
|
121
|
+
// Set gas budget if provided
|
|
122
|
+
if (options.gasBudget) {
|
|
123
|
+
tx.setGasBudget(options.gasBudget);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Set gas price if provided
|
|
127
|
+
if (options.gasPrice) {
|
|
128
|
+
tx.setGasPrice(options.gasPrice);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Call the lightweight memory creation function
|
|
132
|
+
// Note: Walrus blob_id is a base64 string (URL-safe, no padding)
|
|
133
|
+
// Example: "E7_nNXvFU_3qZVu3OH1yycRG7LZlyn1-UxEDCDDqGGU"
|
|
134
|
+
// We encode the string to vector<u8> for the Move function parameter
|
|
135
|
+
// Clock object (0x6) is required for real-time timestamp
|
|
136
|
+
tx.moveCall({
|
|
137
|
+
target: `${this.config.packageId}::memory::create_memory_record_lightweight`,
|
|
138
|
+
arguments: [
|
|
139
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.category))),
|
|
140
|
+
tx.pure.u64(options.vectorId),
|
|
141
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobId))),
|
|
142
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobObjectId || ''))),
|
|
143
|
+
tx.pure.u8(options.importance),
|
|
144
|
+
tx.object('0x6'), // Sui Clock object for real-time timestamp
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return tx;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Build transaction to update memory metadata
|
|
153
|
+
*/
|
|
154
|
+
buildUpdateMemoryMetadata(options: UpdateMemoryMetadataTxOptions): Transaction {
|
|
155
|
+
const tx = new Transaction();
|
|
156
|
+
|
|
157
|
+
if (options.gasBudget) {
|
|
158
|
+
tx.setGasBudget(options.gasBudget);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (options.gasPrice) {
|
|
162
|
+
tx.setGasPrice(options.gasPrice);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Note: Using tx.moveCall with Clock for real-time timestamp
|
|
166
|
+
tx.moveCall({
|
|
167
|
+
target: `${this.config.packageId}::memory::update_memory_metadata`,
|
|
168
|
+
arguments: [
|
|
169
|
+
tx.object(options.memoryId),
|
|
170
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.metadataBlobId))),
|
|
171
|
+
tx.pure.u8(options.embeddingDimension || 5),
|
|
172
|
+
tx.object('0x6'), // Sui Clock object for real-time timestamp
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return tx;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Build transaction for comprehensive memory record update
|
|
181
|
+
*
|
|
182
|
+
* Updates multiple fields of a Memory object in a single transaction.
|
|
183
|
+
* Only non-empty/non-zero values will be updated on-chain.
|
|
184
|
+
*
|
|
185
|
+
* @param options - Update options with memoryId and fields to update
|
|
186
|
+
* @returns Transaction to update memory record
|
|
187
|
+
*/
|
|
188
|
+
buildUpdateMemoryRecord(options: UpdateMemoryRecordTxOptions): Transaction {
|
|
189
|
+
const tx = new Transaction();
|
|
190
|
+
|
|
191
|
+
if (options.gasBudget) {
|
|
192
|
+
tx.setGasBudget(options.gasBudget);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (options.gasPrice) {
|
|
196
|
+
tx.setGasPrice(options.gasPrice);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Use direct moveCall with Clock object for real-time timestamp
|
|
200
|
+
tx.moveCall({
|
|
201
|
+
target: `${this.config.packageId}::memory::update_memory_record`,
|
|
202
|
+
arguments: [
|
|
203
|
+
tx.object(options.memoryId),
|
|
204
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newBlobId || ''))),
|
|
205
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newCategory || ''))),
|
|
206
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newTopic || ''))),
|
|
207
|
+
tx.pure.u8(options.newImportance || 0),
|
|
208
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newEmbeddingBlobId || ''))),
|
|
209
|
+
tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newContentHash || ''))),
|
|
210
|
+
tx.pure.u64(options.newContentSize || 0),
|
|
211
|
+
tx.object('0x6'), // Sui Clock object for real-time timestamp
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return tx;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Build transaction to delete a memory record
|
|
220
|
+
*/
|
|
221
|
+
buildDeleteMemoryRecord(options: DeleteMemoryRecordTxOptions): Transaction {
|
|
222
|
+
const tx = new Transaction();
|
|
223
|
+
|
|
224
|
+
if (options.gasBudget) {
|
|
225
|
+
tx.setGasBudget(options.gasBudget);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (options.gasPrice) {
|
|
229
|
+
tx.setGasPrice(options.gasPrice);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Note: Using tx.moveCall for actual implementation
|
|
233
|
+
tx.moveCall({
|
|
234
|
+
target: `${this.config.packageId}::memory::delete_memory_record`,
|
|
235
|
+
arguments: [tx.pure.string(options.memoryId)]
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
return tx;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Build transaction to create a memory index
|
|
243
|
+
*
|
|
244
|
+
* Smart contract signature:
|
|
245
|
+
* ```move
|
|
246
|
+
* public entry fun create_memory_index(
|
|
247
|
+
* index_blob_id: vector<u8>,
|
|
248
|
+
* graph_blob_id: vector<u8>,
|
|
249
|
+
* ctx: &mut tx_context::TxContext
|
|
250
|
+
* )
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
buildCreateMemoryIndex(options: CreateMemoryIndexTxOptions): Transaction {
|
|
254
|
+
const tx = new Transaction();
|
|
255
|
+
|
|
256
|
+
if (options.gasBudget) {
|
|
257
|
+
tx.setGasBudget(options.gasBudget);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (options.gasPrice) {
|
|
261
|
+
tx.setGasPrice(options.gasPrice);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Convert strings to vector<u8> for Move
|
|
265
|
+
const indexBlobIdBytes = Array.from(new TextEncoder().encode(options.indexBlobId));
|
|
266
|
+
const graphBlobIdBytes = Array.from(new TextEncoder().encode(options.graphBlobId));
|
|
267
|
+
|
|
268
|
+
tx.moveCall({
|
|
269
|
+
target: `${this.config.packageId}::memory::create_memory_index`,
|
|
270
|
+
arguments: [
|
|
271
|
+
tx.pure.vector('u8', indexBlobIdBytes),
|
|
272
|
+
tx.pure.vector('u8', graphBlobIdBytes)
|
|
273
|
+
]
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
return tx;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Build transaction to update a memory index
|
|
281
|
+
*
|
|
282
|
+
* Smart contract signature:
|
|
283
|
+
* ```move
|
|
284
|
+
* public entry fun update_memory_index(
|
|
285
|
+
* memory_index: &mut MemoryIndex,
|
|
286
|
+
* expected_version: u64,
|
|
287
|
+
* new_index_blob_id: vector<u8>,
|
|
288
|
+
* new_graph_blob_id: vector<u8>,
|
|
289
|
+
* ctx: &tx_context::TxContext
|
|
290
|
+
* )
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param options - Update options including indexId (object ID), expectedVersion, and new blob IDs
|
|
294
|
+
*/
|
|
295
|
+
buildUpdateMemoryIndex(options: UpdateMemoryIndexTxOptions): Transaction {
|
|
296
|
+
const tx = new Transaction();
|
|
297
|
+
|
|
298
|
+
if (options.gasBudget) {
|
|
299
|
+
tx.setGasBudget(options.gasBudget);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (options.gasPrice) {
|
|
303
|
+
tx.setGasPrice(options.gasPrice);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Convert strings to vector<u8> for Move
|
|
307
|
+
const newIndexBlobIdBytes = Array.from(new TextEncoder().encode(options.newIndexBlobId));
|
|
308
|
+
const newGraphBlobIdBytes = Array.from(new TextEncoder().encode(options.newGraphBlobId));
|
|
309
|
+
|
|
310
|
+
tx.moveCall({
|
|
311
|
+
target: `${this.config.packageId}::memory::update_memory_index`,
|
|
312
|
+
arguments: [
|
|
313
|
+
tx.object(options.indexId), // &mut MemoryIndex (object reference)
|
|
314
|
+
tx.pure.u64(options.expectedVersion), // expected_version: u64
|
|
315
|
+
tx.pure.vector('u8', newIndexBlobIdBytes), // new_index_blob_id: vector<u8>
|
|
316
|
+
tx.pure.vector('u8', newGraphBlobIdBytes) // new_graph_blob_id: vector<u8>
|
|
317
|
+
]
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
return tx;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// ==================== ACCESS CONTROL TRANSACTIONS ====================
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Build transaction to grant access to content
|
|
327
|
+
*/
|
|
328
|
+
buildGrantAccess(options: GrantAccessTxOptions): Transaction {
|
|
329
|
+
const tx = new Transaction();
|
|
330
|
+
|
|
331
|
+
if (options.gasBudget) {
|
|
332
|
+
tx.setGasBudget(options.gasBudget);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (options.gasPrice) {
|
|
336
|
+
tx.setGasPrice(options.gasPrice);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Note: Using tx.moveCall for actual implementation
|
|
340
|
+
tx.moveCall({
|
|
341
|
+
target: `${this.config.packageId}::access::grant_access`,
|
|
342
|
+
arguments: [
|
|
343
|
+
tx.pure.string(options.contentId),
|
|
344
|
+
tx.pure.address(options.recipient),
|
|
345
|
+
tx.pure.u8(Array.isArray(options.permissions) ? options.permissions[0] : options.permissions),
|
|
346
|
+
tx.pure.u64(options.expirationTime || 0)
|
|
347
|
+
]
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
return tx;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Build transaction to revoke access from content
|
|
355
|
+
*/
|
|
356
|
+
buildRevokeAccess(options: RevokeAccessTxOptions): Transaction {
|
|
357
|
+
const tx = new Transaction();
|
|
358
|
+
|
|
359
|
+
if (options.gasBudget) {
|
|
360
|
+
tx.setGasBudget(options.gasBudget);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (options.gasPrice) {
|
|
364
|
+
tx.setGasPrice(options.gasPrice);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Note: Using tx.moveCall for actual implementation
|
|
368
|
+
tx.moveCall({
|
|
369
|
+
target: `${this.config.packageId}::access::revoke_access`,
|
|
370
|
+
arguments: [
|
|
371
|
+
tx.pure.string(options.contentId),
|
|
372
|
+
tx.pure.address(options.recipient)
|
|
373
|
+
]
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
return tx;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Build transaction to register content for access control
|
|
381
|
+
*/
|
|
382
|
+
buildRegisterContent(options: RegisterContentTxOptions): Transaction {
|
|
383
|
+
const tx = new Transaction();
|
|
384
|
+
|
|
385
|
+
if (options.gasBudget) {
|
|
386
|
+
tx.setGasBudget(options.gasBudget);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (options.gasPrice) {
|
|
390
|
+
tx.setGasPrice(options.gasPrice);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Note: Using tx.moveCall for actual implementation
|
|
394
|
+
tx.moveCall({
|
|
395
|
+
target: `${this.config.packageId}::access::register_content`,
|
|
396
|
+
arguments: [
|
|
397
|
+
tx.pure.string(options.contentHash),
|
|
398
|
+
tx.pure.string(options.encryptionKey),
|
|
399
|
+
tx.pure.string(Array.isArray(options.accessPolicy) ? JSON.stringify(options.accessPolicy) : options.accessPolicy)
|
|
400
|
+
]
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
return tx;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// ==================== EXECUTION METHODS ====================
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Execute a transaction using SerialTransactionExecutor with automatic retry.
|
|
410
|
+
*
|
|
411
|
+
* The executor automatically:
|
|
412
|
+
* - Caches object versions to prevent version conflicts within same session
|
|
413
|
+
* - Manages gas coins to prevent equivocation (24h lock)
|
|
414
|
+
* - Queues transactions sequentially for safe execution
|
|
415
|
+
*
|
|
416
|
+
* When version conflict occurs (external modification), the executor cache
|
|
417
|
+
* is reset and transaction is retried with fresh object references.
|
|
418
|
+
*
|
|
419
|
+
* @see https://sdk.mystenlabs.com/typescript/executors
|
|
420
|
+
* @see https://docs.sui.io/concepts/sui-architecture/epochs#equivocation
|
|
421
|
+
*/
|
|
422
|
+
async executeTransaction(
|
|
423
|
+
tx: Transaction,
|
|
424
|
+
signer: any,
|
|
425
|
+
options: TransactionOptions = {}
|
|
426
|
+
): Promise<TransactionResult> {
|
|
427
|
+
const maxRetries = 3;
|
|
428
|
+
|
|
429
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
430
|
+
try {
|
|
431
|
+
// Set sender if provided
|
|
432
|
+
if (options.sender) {
|
|
433
|
+
tx.setSender(options.sender);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Use SerialTransactionExecutor to prevent equivocation and version conflicts
|
|
437
|
+
const executor = this.getExecutor(signer);
|
|
438
|
+
// Pass options to get full response data including objectChanges
|
|
439
|
+
const executorResult = await executor.executeTransaction(tx, {
|
|
440
|
+
showEffects: true,
|
|
441
|
+
showObjectChanges: true,
|
|
442
|
+
showEvents: true,
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// SerialTransactionExecutor returns { digest, effects (string), data (SuiTransactionBlockResponse) }
|
|
446
|
+
// The actual response data is in executorResult.data
|
|
447
|
+
const result = executorResult.data;
|
|
448
|
+
|
|
449
|
+
// Parse the result
|
|
450
|
+
const transactionResult: TransactionResult = {
|
|
451
|
+
digest: executorResult.digest,
|
|
452
|
+
effects: result.effects,
|
|
453
|
+
status: result.effects?.status?.status === 'success' ? 'success' : 'failure',
|
|
454
|
+
gasUsed: result.effects?.gasUsed?.computationCost
|
|
455
|
+
? Number(result.effects.gasUsed.computationCost)
|
|
456
|
+
: undefined,
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// Extract created objects
|
|
460
|
+
if (result.objectChanges) {
|
|
461
|
+
transactionResult.createdObjects = result.objectChanges
|
|
462
|
+
.filter((change: any) => change.type === 'created')
|
|
463
|
+
.map((change: any) => ({
|
|
464
|
+
objectId: change.objectId,
|
|
465
|
+
objectType: change.objectType || 'unknown',
|
|
466
|
+
}));
|
|
467
|
+
|
|
468
|
+
transactionResult.mutatedObjects = result.objectChanges
|
|
469
|
+
.filter((change: any) => change.type === 'mutated')
|
|
470
|
+
.map((change: any) => ({
|
|
471
|
+
objectId: change.objectId,
|
|
472
|
+
objectType: change.objectType || 'unknown',
|
|
473
|
+
}));
|
|
474
|
+
|
|
475
|
+
transactionResult.deletedObjects = result.objectChanges
|
|
476
|
+
.filter((change: any) => change.type === 'deleted')
|
|
477
|
+
.map((change: any) => change.objectId);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Add error if transaction failed
|
|
481
|
+
if (transactionResult.status === 'failure') {
|
|
482
|
+
transactionResult.error = result.effects?.status?.error || 'Unknown transaction error';
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return transactionResult;
|
|
486
|
+
} catch (error: any) {
|
|
487
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
488
|
+
|
|
489
|
+
// Check if it's a version conflict error (external modification)
|
|
490
|
+
const isVersionConflict =
|
|
491
|
+
errorMsg.includes('is not available for consumption') ||
|
|
492
|
+
errorMsg.includes('current version') ||
|
|
493
|
+
errorMsg.includes('ObjectVersionTooOld') ||
|
|
494
|
+
errorMsg.includes('EquivocationError');
|
|
495
|
+
|
|
496
|
+
if (isVersionConflict && attempt < maxRetries) {
|
|
497
|
+
// Reset executor cache to get fresh object versions
|
|
498
|
+
console.log(`⚠️ Version conflict detected (attempt ${attempt}/${maxRetries}), resetting cache...`);
|
|
499
|
+
await this.executor?.resetCache();
|
|
500
|
+
|
|
501
|
+
// Exponential backoff: 500ms, 1000ms, 2000ms
|
|
502
|
+
const delay = 500 * Math.pow(2, attempt - 1);
|
|
503
|
+
console.log(` Retrying in ${delay}ms with fresh object references...`);
|
|
504
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
console.error('Transaction execution failed:', error);
|
|
509
|
+
// Reset executor on final failure to get fresh state for next call
|
|
510
|
+
this.resetExecutor();
|
|
511
|
+
return {
|
|
512
|
+
digest: '',
|
|
513
|
+
status: 'failure',
|
|
514
|
+
error: errorMsg,
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Should never reach here, but TypeScript needs a return
|
|
520
|
+
return {
|
|
521
|
+
digest: '',
|
|
522
|
+
status: 'failure',
|
|
523
|
+
error: 'Max retries exceeded',
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Execute a transaction directly without the executor (legacy method).
|
|
529
|
+
* Use this only when you need direct control over execution or for one-off transactions.
|
|
530
|
+
*
|
|
531
|
+
* WARNING: This method does not protect against equivocation.
|
|
532
|
+
* For sequential transactions, use executeTransaction() instead.
|
|
533
|
+
*/
|
|
534
|
+
async executeTransactionDirect(
|
|
535
|
+
tx: Transaction,
|
|
536
|
+
signer: any,
|
|
537
|
+
options: TransactionOptions = {}
|
|
538
|
+
): Promise<TransactionResult> {
|
|
539
|
+
try {
|
|
540
|
+
// Set sender if provided
|
|
541
|
+
if (options.sender) {
|
|
542
|
+
tx.setSender(options.sender);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Execute the transaction directly
|
|
546
|
+
const result = await this.client.signAndExecuteTransaction({
|
|
547
|
+
transaction: tx,
|
|
548
|
+
signer,
|
|
549
|
+
options: {
|
|
550
|
+
showEffects: true,
|
|
551
|
+
showObjectChanges: true,
|
|
552
|
+
showEvents: true,
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// Wait for transaction to be finalized on-chain
|
|
557
|
+
if (result.digest) {
|
|
558
|
+
try {
|
|
559
|
+
await this.client.waitForTransaction({
|
|
560
|
+
digest: result.digest,
|
|
561
|
+
options: { showEffects: true },
|
|
562
|
+
});
|
|
563
|
+
} catch (waitError) {
|
|
564
|
+
console.warn('waitForTransaction warning:', waitError);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Parse the result
|
|
569
|
+
const transactionResult: TransactionResult = {
|
|
570
|
+
digest: result.digest,
|
|
571
|
+
effects: result.effects,
|
|
572
|
+
status: result.effects?.status?.status === 'success' ? 'success' : 'failure',
|
|
573
|
+
gasUsed: result.effects?.gasUsed?.computationCost
|
|
574
|
+
? Number(result.effects.gasUsed.computationCost)
|
|
575
|
+
: undefined,
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
// Extract created objects
|
|
579
|
+
if (result.objectChanges) {
|
|
580
|
+
transactionResult.createdObjects = result.objectChanges
|
|
581
|
+
.filter(change => change.type === 'created')
|
|
582
|
+
.map(change => ({
|
|
583
|
+
objectId: change.objectId,
|
|
584
|
+
objectType: change.objectType || 'unknown',
|
|
585
|
+
}));
|
|
586
|
+
|
|
587
|
+
transactionResult.mutatedObjects = result.objectChanges
|
|
588
|
+
.filter(change => change.type === 'mutated')
|
|
589
|
+
.map(change => ({
|
|
590
|
+
objectId: change.objectId,
|
|
591
|
+
objectType: change.objectType || 'unknown',
|
|
592
|
+
}));
|
|
593
|
+
|
|
594
|
+
transactionResult.deletedObjects = result.objectChanges
|
|
595
|
+
.filter(change => change.type === 'deleted')
|
|
596
|
+
.map(change => change.objectId);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Add error if transaction failed
|
|
600
|
+
if (transactionResult.status === 'failure') {
|
|
601
|
+
transactionResult.error = result.effects?.status?.error || 'Unknown transaction error';
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return transactionResult;
|
|
605
|
+
} catch (error) {
|
|
606
|
+
console.error('Transaction execution failed:', error);
|
|
607
|
+
return {
|
|
608
|
+
digest: '',
|
|
609
|
+
status: 'failure',
|
|
610
|
+
error: error instanceof Error ? error.message : String(error),
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// ==================== CONVENIENCE METHODS ====================
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Create and execute a memory record transaction
|
|
619
|
+
*/
|
|
620
|
+
async createMemoryRecord(
|
|
621
|
+
options: CreateMemoryRecordTxOptions,
|
|
622
|
+
signer: any
|
|
623
|
+
): Promise<TransactionResult> {
|
|
624
|
+
const tx = this.buildCreateMemoryRecord(options);
|
|
625
|
+
return this.executeTransaction(tx, signer, options);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Create and execute an update memory metadata transaction
|
|
630
|
+
*/
|
|
631
|
+
async updateMemoryMetadata(
|
|
632
|
+
options: UpdateMemoryMetadataTxOptions,
|
|
633
|
+
signer: any
|
|
634
|
+
): Promise<TransactionResult> {
|
|
635
|
+
const tx = this.buildUpdateMemoryMetadata(options);
|
|
636
|
+
return this.executeTransaction(tx, signer, options);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Create and execute a delete memory record transaction
|
|
641
|
+
*/
|
|
642
|
+
async deleteMemoryRecord(
|
|
643
|
+
options: DeleteMemoryRecordTxOptions,
|
|
644
|
+
signer: any
|
|
645
|
+
): Promise<TransactionResult> {
|
|
646
|
+
const tx = this.buildDeleteMemoryRecord(options);
|
|
647
|
+
return this.executeTransaction(tx, signer, options);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Create and execute a grant access transaction
|
|
652
|
+
*/
|
|
653
|
+
async grantAccess(
|
|
654
|
+
options: GrantAccessTxOptions,
|
|
655
|
+
signer: any
|
|
656
|
+
): Promise<TransactionResult> {
|
|
657
|
+
const tx = this.buildGrantAccess(options);
|
|
658
|
+
return this.executeTransaction(tx, signer, options);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Create and execute a revoke access transaction
|
|
663
|
+
*/
|
|
664
|
+
async revokeAccess(
|
|
665
|
+
options: RevokeAccessTxOptions,
|
|
666
|
+
signer: any
|
|
667
|
+
): Promise<TransactionResult> {
|
|
668
|
+
const tx = this.buildRevokeAccess(options);
|
|
669
|
+
return this.executeTransaction(tx, signer, options);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// ==================== BATCH OPERATIONS ====================
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Build a batch transaction combining multiple operations
|
|
676
|
+
*
|
|
677
|
+
* Access control uses capability-based pattern:
|
|
678
|
+
* - createCap: Create a new MemoryCap for an app context
|
|
679
|
+
* - transferCap: Transfer capability to recipient (grants access)
|
|
680
|
+
* - burnCap: Burn capability (revokes access permanently)
|
|
681
|
+
*/
|
|
682
|
+
buildBatchTransaction(operations: Array<{
|
|
683
|
+
type: 'createMemory' | 'updateMemory' | 'deleteMemory' | 'createCap' | 'transferCap' | 'burnCap';
|
|
684
|
+
options: any;
|
|
685
|
+
}>): Transaction {
|
|
686
|
+
const tx = new Transaction();
|
|
687
|
+
|
|
688
|
+
for (const operation of operations) {
|
|
689
|
+
switch (operation.type) {
|
|
690
|
+
case 'createMemory':
|
|
691
|
+
MemoryModule.createMemoryRecord({
|
|
692
|
+
package: this.config.packageId,
|
|
693
|
+
arguments: operation.options,
|
|
694
|
+
})(tx);
|
|
695
|
+
break;
|
|
696
|
+
|
|
697
|
+
case 'updateMemory':
|
|
698
|
+
MemoryModule.updateMemoryMetadata({
|
|
699
|
+
package: this.config.packageId,
|
|
700
|
+
arguments: operation.options,
|
|
701
|
+
})(tx);
|
|
702
|
+
break;
|
|
703
|
+
|
|
704
|
+
case 'deleteMemory':
|
|
705
|
+
MemoryModule.deleteMemoryRecord({
|
|
706
|
+
package: this.config.packageId,
|
|
707
|
+
arguments: operation.options,
|
|
708
|
+
})(tx);
|
|
709
|
+
break;
|
|
710
|
+
|
|
711
|
+
case 'createCap':
|
|
712
|
+
// Create a new MemoryCap for an app context
|
|
713
|
+
CapabilityModule.createMemoryCap({
|
|
714
|
+
package: this.config.packageId,
|
|
715
|
+
arguments: operation.options,
|
|
716
|
+
})(tx);
|
|
717
|
+
break;
|
|
718
|
+
|
|
719
|
+
case 'transferCap':
|
|
720
|
+
// Transfer capability to recipient (grants access)
|
|
721
|
+
CapabilityModule.transferCap({
|
|
722
|
+
package: this.config.packageId,
|
|
723
|
+
arguments: operation.options,
|
|
724
|
+
})(tx);
|
|
725
|
+
break;
|
|
726
|
+
|
|
727
|
+
case 'burnCap':
|
|
728
|
+
// Burn capability (revokes access permanently)
|
|
729
|
+
CapabilityModule.burnCap({
|
|
730
|
+
package: this.config.packageId,
|
|
731
|
+
arguments: operation.options,
|
|
732
|
+
})(tx);
|
|
733
|
+
break;
|
|
734
|
+
|
|
735
|
+
default:
|
|
736
|
+
console.warn(`Unknown operation type: ${operation.type}`);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return tx;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Execute a batch transaction
|
|
745
|
+
*/
|
|
746
|
+
async executeBatch(
|
|
747
|
+
operations: Array<{
|
|
748
|
+
type: 'createMemory' | 'updateMemory' | 'deleteMemory' | 'createCap' | 'transferCap' | 'burnCap';
|
|
749
|
+
options: any;
|
|
750
|
+
}>,
|
|
751
|
+
signer: any,
|
|
752
|
+
txOptions: TransactionOptions = {}
|
|
753
|
+
): Promise<TransactionResult> {
|
|
754
|
+
const tx = this.buildBatchTransaction(operations);
|
|
755
|
+
|
|
756
|
+
if (txOptions.gasBudget) {
|
|
757
|
+
tx.setGasBudget(txOptions.gasBudget);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
return this.executeTransaction(tx, signer, txOptions);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// ==================== UTILITY METHODS ====================
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Estimate gas cost for a transaction
|
|
767
|
+
*/
|
|
768
|
+
async estimateGas(tx: Transaction, signer: any): Promise<number> {
|
|
769
|
+
try {
|
|
770
|
+
const dryRunResult = await this.client.dryRunTransactionBlock({
|
|
771
|
+
transactionBlock: await tx.build({ client: this.client }),
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
return dryRunResult.effects.gasUsed?.computationCost
|
|
775
|
+
? Number(dryRunResult.effects.gasUsed.computationCost)
|
|
776
|
+
: 0;
|
|
777
|
+
} catch (error) {
|
|
778
|
+
console.error('Gas estimation failed:', error);
|
|
779
|
+
return 0;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Get recommended gas budget based on transaction complexity
|
|
785
|
+
*/
|
|
786
|
+
getRecommendedGasBudget(operationCount: number = 1): number {
|
|
787
|
+
const baseGas = 1000000; // 1M MIST base
|
|
788
|
+
const perOperationGas = 500000; // 500K MIST per operation
|
|
789
|
+
return baseGas + (operationCount * perOperationGas);
|
|
790
|
+
}
|
|
791
|
+
}
|