@vrtmrz/livesync-commonlib 0.1.0-rc.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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/API/DirectFileManipulator.d.ts +2 -0
- package/dist/API/DirectFileManipulator.js +4 -0
- package/dist/API/DirectFileManipulatorV2.d.ts +150 -0
- package/dist/API/DirectFileManipulatorV2.js +424 -0
- package/dist/API/processSetting.d.ts +41 -0
- package/dist/API/processSetting.js +140 -0
- package/dist/ContentSplitter/ContentSplitter.d.ts +28 -0
- package/dist/ContentSplitter/ContentSplitter.js +5 -0
- package/dist/ContentSplitter/ContentSplitterBase.d.ts +51 -0
- package/dist/ContentSplitter/ContentSplitterBase.js +83 -0
- package/dist/ContentSplitter/ContentSplitterRabinKarp.d.ts +9 -0
- package/dist/ContentSplitter/ContentSplitterRabinKarp.js +32 -0
- package/dist/ContentSplitter/ContentSplitterV1.d.ts +9 -0
- package/dist/ContentSplitter/ContentSplitterV1.js +34 -0
- package/dist/ContentSplitter/ContentSplitterV2.d.ts +9 -0
- package/dist/ContentSplitter/ContentSplitterV2.js +34 -0
- package/dist/ContentSplitter/ContentSplitters.d.ts +12 -0
- package/dist/ContentSplitter/ContentSplitters.js +29 -0
- package/dist/bureau/bureau.d.ts +7 -0
- package/dist/bureau/bureau.js +5 -0
- package/dist/common/ConnectionString.d.ts +30 -0
- package/dist/common/ConnectionString.js +179 -0
- package/dist/common/LSError.d.ts +48 -0
- package/dist/common/LSError.js +112 -0
- package/dist/common/configForDoc.d.ts +79 -0
- package/dist/common/configForDoc.js +312 -0
- package/dist/common/coreEnvFunctions.d.ts +21 -0
- package/dist/common/coreEnvFunctions.js +22 -0
- package/dist/common/coreEnvVars.d.ts +3 -0
- package/dist/common/coreEnvVars.js +6 -0
- package/dist/common/i18n.d.ts +18 -0
- package/dist/common/i18n.js +7193 -0
- package/dist/common/logger.d.ts +2 -0
- package/dist/common/logger.js +1 -0
- package/dist/common/messages/combinedMessages.dev.d.ts +7 -0
- package/dist/common/messages/combinedMessages.dev.js +44 -0
- package/dist/common/messages/combinedMessages.prod.d.ts +9264 -0
- package/dist/common/messages/combinedMessages.prod.js +9271 -0
- package/dist/common/messages/de.d.ts +297 -0
- package/dist/common/messages/de.js +7 -0
- package/dist/common/messages/def.d.ts +1119 -0
- package/dist/common/messages/def.js +7 -0
- package/dist/common/messages/es.d.ts +689 -0
- package/dist/common/messages/es.js +7 -0
- package/dist/common/messages/fr.d.ts +582 -0
- package/dist/common/messages/fr.js +7 -0
- package/dist/common/messages/he.d.ts +583 -0
- package/dist/common/messages/he.js +7 -0
- package/dist/common/messages/ja.d.ts +838 -0
- package/dist/common/messages/ja.js +7 -0
- package/dist/common/messages/ko.d.ts +800 -0
- package/dist/common/messages/ko.js +7 -0
- package/dist/common/messages/ru.d.ts +858 -0
- package/dist/common/messages/ru.js +7 -0
- package/dist/common/messages/zh-tw.d.ts +384 -0
- package/dist/common/messages/zh-tw.js +7 -0
- package/dist/common/messages/zh.d.ts +1093 -0
- package/dist/common/messages/zh.js +7 -0
- package/dist/common/messagesJson/de.json +295 -0
- package/dist/common/messagesJson/en.json +1117 -0
- package/dist/common/messagesJson/es.json +687 -0
- package/dist/common/messagesJson/fr.json +580 -0
- package/dist/common/messagesJson/he.json +581 -0
- package/dist/common/messagesJson/ja.json +836 -0
- package/dist/common/messagesJson/ko.json +798 -0
- package/dist/common/messagesJson/ru.json +856 -0
- package/dist/common/messagesJson/zh-tw.json +382 -0
- package/dist/common/messagesJson/zh.json +1091 -0
- package/dist/common/models/auth.type.d.ts +41 -0
- package/dist/common/models/auth.type.js +0 -0
- package/dist/common/models/db.const.d.ts +20 -0
- package/dist/common/models/db.const.js +28 -0
- package/dist/common/models/db.definition.d.ts +56 -0
- package/dist/common/models/db.definition.js +6 -0
- package/dist/common/models/db.type.d.ts +142 -0
- package/dist/common/models/db.type.js +0 -0
- package/dist/common/models/diff.definition.d.ts +16 -0
- package/dist/common/models/diff.definition.js +0 -0
- package/dist/common/models/fileaccess.const.d.ts +7 -0
- package/dist/common/models/fileaccess.const.js +16 -0
- package/dist/common/models/fileaccess.type.d.ts +72 -0
- package/dist/common/models/fileaccess.type.js +0 -0
- package/dist/common/models/redflag.const.d.ts +32 -0
- package/dist/common/models/redflag.const.js +27 -0
- package/dist/common/models/setting.const.d.ts +49 -0
- package/dist/common/models/setting.const.defaults.d.ts +3 -0
- package/dist/common/models/setting.const.defaults.js +185 -0
- package/dist/common/models/setting.const.js +68 -0
- package/dist/common/models/setting.const.preferred.d.ts +5 -0
- package/dist/common/models/setting.const.preferred.js +35 -0
- package/dist/common/models/setting.const.qr.d.ts +2 -0
- package/dist/common/models/setting.const.qr.js +174 -0
- package/dist/common/models/setting.type.d.ts +900 -0
- package/dist/common/models/setting.type.js +8 -0
- package/dist/common/models/shared.const.behabiour.d.ts +28 -0
- package/dist/common/models/shared.const.behabiour.js +36 -0
- package/dist/common/models/shared.const.d.ts +5 -0
- package/dist/common/models/shared.const.js +12 -0
- package/dist/common/models/shared.const.symbols.d.ts +9 -0
- package/dist/common/models/shared.const.symbols.js +20 -0
- package/dist/common/models/shared.definition.configNames.d.ts +36 -0
- package/dist/common/models/shared.definition.configNames.js +203 -0
- package/dist/common/models/shared.definition.d.ts +22 -0
- package/dist/common/models/shared.definition.js +24 -0
- package/dist/common/models/shared.type.util.d.ts +8 -0
- package/dist/common/models/shared.type.util.js +0 -0
- package/dist/common/models/sync.definition.d.ts +18 -0
- package/dist/common/models/sync.definition.js +20 -0
- package/dist/common/models/tweak.definition.d.ts +191 -0
- package/dist/common/models/tweak.definition.js +77 -0
- package/dist/common/rosetta.d.ts +42 -0
- package/dist/common/rosetta.js +57 -0
- package/dist/common/settingConstants.d.ts +216 -0
- package/dist/common/settingConstants.js +434 -0
- package/dist/common/typeUtils.d.ts +17 -0
- package/dist/common/typeUtils.js +51 -0
- package/dist/common/types.d.ts +107 -0
- package/dist/common/types.js +212 -0
- package/dist/common/utils.d.ts +129 -0
- package/dist/common/utils.doc.d.ts +11 -0
- package/dist/common/utils.doc.js +35 -0
- package/dist/common/utils.js +583 -0
- package/dist/common/utils.object.d.ts +2 -0
- package/dist/common/utils.object.js +14 -0
- package/dist/common/utils.patch.d.ts +8 -0
- package/dist/common/utils.patch.js +178 -0
- package/dist/common/utils.type.d.ts +1 -0
- package/dist/common/utils.type.js +0 -0
- package/dist/context.d.ts +8 -0
- package/dist/context.js +14 -0
- package/dist/databases/IndexedDBKeyValueDatabase.d.ts +26 -0
- package/dist/databases/IndexedDBKeyValueDatabase.js +130 -0
- package/dist/dataobject/StoredMap.d.ts +12 -0
- package/dist/dataobject/StoredMap.js +47 -0
- package/dist/dev/checks.d.ts +5 -0
- package/dist/dev/checks.js +38 -0
- package/dist/encryption/encryptHKDF.d.ts +3 -0
- package/dist/encryption/encryptHKDF.js +7 -0
- package/dist/encryption/stringEncryption.d.ts +27 -0
- package/dist/encryption/stringEncryption.js +59 -0
- package/dist/events/coreEvents.d.ts +54 -0
- package/dist/events/coreEvents.js +46 -0
- package/dist/hub/hub.d.ts +11 -0
- package/dist/hub/hub.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/AsyncActivityRunner.d.ts +18 -0
- package/dist/interfaces/AsyncActivityRunner.js +7 -0
- package/dist/interfaces/Confirm.d.ts +17 -0
- package/dist/interfaces/Confirm.js +0 -0
- package/dist/interfaces/DatabaseFileAccess.d.ts +14 -0
- package/dist/interfaces/DatabaseFileAccess.js +0 -0
- package/dist/interfaces/DatabaseRebuilder.d.ts +13 -0
- package/dist/interfaces/DatabaseRebuilder.js +0 -0
- package/dist/interfaces/FileHandler.d.ts +13 -0
- package/dist/interfaces/FileHandler.js +0 -0
- package/dist/interfaces/KeyValueDatabase.d.ts +11 -0
- package/dist/interfaces/KeyValueDatabase.js +0 -0
- package/dist/interfaces/ServiceModule.d.ts +59 -0
- package/dist/interfaces/ServiceModule.js +19 -0
- package/dist/interfaces/StorageAccess.d.ts +44 -0
- package/dist/interfaces/StorageAccess.js +0 -0
- package/dist/interfaces/StorageEventManager.d.ts +16 -0
- package/dist/interfaces/StorageEventManager.js +5 -0
- package/dist/managers/ChangeManager.d.ts +61 -0
- package/dist/managers/ChangeManager.js +104 -0
- package/dist/managers/ChunkDeliveryCoordinator.d.ts +51 -0
- package/dist/managers/ChunkDeliveryCoordinator.js +136 -0
- package/dist/managers/ChunkFetcher.d.ts +44 -0
- package/dist/managers/ChunkFetcher.js +251 -0
- package/dist/managers/ChunkManager.d.ts +2 -0
- package/dist/managers/ChunkManager.js +4 -0
- package/dist/managers/ConflictManager.d.ts +37 -0
- package/dist/managers/ConflictManager.js +322 -0
- package/dist/managers/EntryManager/EntryManager.d.ts +37 -0
- package/dist/managers/EntryManager/EntryManager.js +73 -0
- package/dist/managers/EntryManager/EntryManagerImpls.d.ts +74 -0
- package/dist/managers/EntryManager/EntryManagerImpls.js +499 -0
- package/dist/managers/HashManager/HashManager.d.ts +60 -0
- package/dist/managers/HashManager/HashManager.js +97 -0
- package/dist/managers/HashManager/HashManagerCore.d.ts +114 -0
- package/dist/managers/HashManager/HashManagerCore.js +99 -0
- package/dist/managers/HashManager/PureJSHashManager.d.ts +77 -0
- package/dist/managers/HashManager/PureJSHashManager.js +84 -0
- package/dist/managers/HashManager/XXHashHashManager.d.ts +96 -0
- package/dist/managers/HashManager/XXHashHashManager.js +111 -0
- package/dist/managers/LayeredChunkManager/ArrivalWaitLayer.d.ts +30 -0
- package/dist/managers/LayeredChunkManager/ArrivalWaitLayer.js +115 -0
- package/dist/managers/LayeredChunkManager/CacheLayer.d.ts +59 -0
- package/dist/managers/LayeredChunkManager/CacheLayer.js +161 -0
- package/dist/managers/LayeredChunkManager/ChunkLayerInterfaces.d.ts +37 -0
- package/dist/managers/LayeredChunkManager/ChunkLayerInterfaces.js +0 -0
- package/dist/managers/LayeredChunkManager/DatabaseReadLayer.d.ts +14 -0
- package/dist/managers/LayeredChunkManager/DatabaseReadLayer.js +78 -0
- package/dist/managers/LayeredChunkManager/DatabaseWriteLayer.d.ts +11 -0
- package/dist/managers/LayeredChunkManager/DatabaseWriteLayer.js +43 -0
- package/dist/managers/LayeredChunkManager/HotPackLayer.d.ts +9 -0
- package/dist/managers/LayeredChunkManager/HotPackLayer.js +8 -0
- package/dist/managers/LayeredChunkManager/types.d.ts +39 -0
- package/dist/managers/LayeredChunkManager/types.js +0 -0
- package/dist/managers/LayeredChunkManager.d.ts +53 -0
- package/dist/managers/LayeredChunkManager.js +240 -0
- package/dist/managers/LiveSyncManagers.d.ts +48 -0
- package/dist/managers/LiveSyncManagers.js +136 -0
- package/dist/managers/StorageEventManager.d.ts +135 -0
- package/dist/managers/StorageEventManager.js +564 -0
- package/dist/managers/StorageProcessingManager.d.ts +14 -0
- package/dist/managers/StorageProcessingManager.js +48 -0
- package/dist/managers/adapters/IStorageEventConverterAdapter.d.ts +16 -0
- package/dist/managers/adapters/IStorageEventConverterAdapter.js +0 -0
- package/dist/managers/adapters/IStorageEventManagerAdapter.d.ts +18 -0
- package/dist/managers/adapters/IStorageEventManagerAdapter.js +0 -0
- package/dist/managers/adapters/IStorageEventPersistenceAdapter.d.ts +15 -0
- package/dist/managers/adapters/IStorageEventPersistenceAdapter.js +0 -0
- package/dist/managers/adapters/IStorageEventStatusAdapter.d.ts +13 -0
- package/dist/managers/adapters/IStorageEventStatusAdapter.js +0 -0
- package/dist/managers/adapters/IStorageEventTypeGuardAdapter.d.ts +16 -0
- package/dist/managers/adapters/IStorageEventTypeGuardAdapter.js +0 -0
- package/dist/managers/adapters/IStorageEventWatchAdapter.d.ts +21 -0
- package/dist/managers/adapters/IStorageEventWatchAdapter.js +0 -0
- package/dist/managers/adapters/index.d.ts +6 -0
- package/dist/managers/adapters/index.js +0 -0
- package/dist/mock_and_interop/stores.d.ts +21 -0
- package/dist/mock_and_interop/stores.js +15 -0
- package/dist/mock_and_interop/wrapper.d.ts +7 -0
- package/dist/mock_and_interop/wrapper.js +37 -0
- package/dist/mods.d.ts +1 -0
- package/dist/mods.js +18 -0
- package/dist/platform/browser/index.d.ts +1 -0
- package/dist/platform/browser/index.js +10 -0
- package/dist/platform/browser/storage.d.ts +35 -0
- package/dist/platform/browser/storage.js +139 -0
- package/dist/platform/node/index.d.ts +23 -0
- package/dist/platform/node/index.js +33 -0
- package/dist/platform/node/storage.d.ts +31 -0
- package/dist/platform/node/storage.js +104 -0
- package/dist/platform/storagePath.d.ts +7 -0
- package/dist/platform/storagePath.js +20 -0
- package/dist/pouchdb/LiveSyncDBFunctions.d.ts +14 -0
- package/dist/pouchdb/LiveSyncDBFunctions.js +129 -0
- package/dist/pouchdb/LiveSyncLocalDB.d.ts +196 -0
- package/dist/pouchdb/LiveSyncLocalDB.js +381 -0
- package/dist/pouchdb/PouchDBConstructor.d.ts +3 -0
- package/dist/pouchdb/PouchDBConstructor.js +0 -0
- package/dist/pouchdb/ReplicatorShim.d.ts +51 -0
- package/dist/pouchdb/ReplicatorShim.js +109 -0
- package/dist/pouchdb/StreamingFetch.d.ts +19 -0
- package/dist/pouchdb/StreamingFetch.js +263 -0
- package/dist/pouchdb/chunks.d.ts +38 -0
- package/dist/pouchdb/chunks.js +314 -0
- package/dist/pouchdb/compress.d.ts +11 -0
- package/dist/pouchdb/compress.js +99 -0
- package/dist/pouchdb/encryption.d.ts +20 -0
- package/dist/pouchdb/encryption.js +458 -0
- package/dist/pouchdb/negotiation.d.ts +9 -0
- package/dist/pouchdb/negotiation.js +109 -0
- package/dist/pouchdb/pouchdb-browser.d.ts +2 -0
- package/dist/pouchdb/pouchdb-browser.js +96 -0
- package/dist/pouchdb/pouchdb-http.d.ts +2 -0
- package/dist/pouchdb/pouchdb-http.js +94 -0
- package/dist/pouchdb/pouchdb-test.d.ts +2 -0
- package/dist/pouchdb/pouchdb-test.js +12 -0
- package/dist/pouchdb/utils_couchdb.d.ts +4 -0
- package/dist/pouchdb/utils_couchdb.js +38 -0
- package/dist/replication/LiveSyncAbstractReplicator.d.ts +69 -0
- package/dist/replication/LiveSyncAbstractReplicator.js +92 -0
- package/dist/replication/SyncParamsHandler.d.ts +35 -0
- package/dist/replication/SyncParamsHandler.js +118 -0
- package/dist/replication/couchdb/LiveSyncReplicator.d.ts +85 -0
- package/dist/replication/couchdb/LiveSyncReplicator.js +1132 -0
- package/dist/replication/httplib.d.ts +75 -0
- package/dist/replication/httplib.js +187 -0
- package/dist/replication/journal/JournalSyncCore.d.ts +70 -0
- package/dist/replication/journal/JournalSyncCore.js +737 -0
- package/dist/replication/journal/JournalSyncTypes.d.ts +9 -0
- package/dist/replication/journal/JournalSyncTypes.js +11 -0
- package/dist/replication/journal/LiveSyncJournalReplicator.d.ts +40 -0
- package/dist/replication/journal/LiveSyncJournalReplicator.js +294 -0
- package/dist/replication/journal/LiveSyncJournalReplicatorEnv.d.ts +3 -0
- package/dist/replication/journal/LiveSyncJournalReplicatorEnv.js +0 -0
- package/dist/replication/journal/objectstore/JournalStorageAdapter.d.ts +15 -0
- package/dist/replication/journal/objectstore/JournalStorageAdapter.js +0 -0
- package/dist/replication/journal/objectstore/MinioStorageAdapter.d.ts +21 -0
- package/dist/replication/journal/objectstore/MinioStorageAdapter.js +204 -0
- package/dist/replication/trystero/LiveSyncTrysteroReplicator.d.ts +90 -0
- package/dist/replication/trystero/LiveSyncTrysteroReplicator.js +380 -0
- package/dist/replication/trystero/P2PLogCollector.d.ts +8 -0
- package/dist/replication/trystero/P2PLogCollector.js +91 -0
- package/dist/replication/trystero/P2PReplicatorBase.d.ts +19 -0
- package/dist/replication/trystero/P2PReplicatorBase.js +0 -0
- package/dist/replication/trystero/P2PReplicatorCore.d.ts +12 -0
- package/dist/replication/trystero/P2PReplicatorCore.js +126 -0
- package/dist/replication/trystero/P2PReplicatorPaneCommon.d.ts +41 -0
- package/dist/replication/trystero/P2PReplicatorPaneCommon.js +20 -0
- package/dist/replication/trystero/ProxiedDB.d.ts +13 -0
- package/dist/replication/trystero/ProxiedDB.js +20 -0
- package/dist/replication/trystero/TrysteroReplicator.d.ts +152 -0
- package/dist/replication/trystero/TrysteroReplicator.js +683 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PClient.d.ts +19 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PClient.js +80 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PConnection.d.ts +2 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PConnection.js +4 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PServer.d.ts +117 -0
- package/dist/replication/trystero/TrysteroReplicatorP2PServer.js +540 -0
- package/dist/replication/trystero/UseP2PReplicatorResult.d.ts +11 -0
- package/dist/replication/trystero/UseP2PReplicatorResult.js +0 -0
- package/dist/replication/trystero/addP2PEventHandlers.d.ts +35 -0
- package/dist/replication/trystero/addP2PEventHandlers.js +43 -0
- package/dist/replication/trystero/rpcCompat.d.ts +1 -0
- package/dist/replication/trystero/rpcCompat.js +9 -0
- package/dist/replication/trystero/types.d.ts +95 -0
- package/dist/replication/trystero/types.js +27 -0
- package/dist/replication/trystero/useP2PReplicatorCommands.d.ts +7 -0
- package/dist/replication/trystero/useP2PReplicatorCommands.js +25 -0
- package/dist/replication/trystero/useP2PReplicatorFeature.d.ts +17 -0
- package/dist/replication/trystero/useP2PReplicatorFeature.js +82 -0
- package/dist/rpc/RpcRoom.d.ts +24 -0
- package/dist/rpc/RpcRoom.js +300 -0
- package/dist/rpc/RpcSession.d.ts +9 -0
- package/dist/rpc/RpcSession.js +32 -0
- package/dist/rpc/chunking.d.ts +11 -0
- package/dist/rpc/chunking.js +58 -0
- package/dist/rpc/errors.d.ts +8 -0
- package/dist/rpc/errors.js +26 -0
- package/dist/rpc/index.d.ts +6 -0
- package/dist/rpc/index.js +12 -0
- package/dist/rpc/pouchdb/RpcPouchDBProxy.d.ts +75 -0
- package/dist/rpc/pouchdb/RpcPouchDBProxy.js +115 -0
- package/dist/rpc/pouchdb/RpcPouchDBServer.d.ts +16 -0
- package/dist/rpc/pouchdb/RpcPouchDBServer.js +55 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.d.ts +24 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.js +208 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.types.d.ts +64 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.types.js +12 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.utils.d.ts +33 -0
- package/dist/rpc/transports/DiagRTCPeerConnections.utils.js +217 -0
- package/dist/rpc/transports/TrysteroTransport.d.ts +216 -0
- package/dist/rpc/transports/TrysteroTransport.js +134 -0
- package/dist/rpc/transports/trysteroUtils.d.ts +3 -0
- package/dist/rpc/transports/trysteroUtils.js +37 -0
- package/dist/rpc/types.d.ts +75 -0
- package/dist/rpc/types.js +6 -0
- package/dist/serviceFeatures/checkRemoteSize.d.ts +28 -0
- package/dist/serviceFeatures/checkRemoteSize.js +178 -0
- package/dist/serviceFeatures/offlineScanner.d.ts +128 -0
- package/dist/serviceFeatures/offlineScanner.js +553 -0
- package/dist/serviceFeatures/prepareDatabaseForUse.d.ts +20 -0
- package/dist/serviceFeatures/prepareDatabaseForUse.js +39 -0
- package/dist/serviceFeatures/remoteConfig.d.ts +46 -0
- package/dist/serviceFeatures/remoteConfig.js +247 -0
- package/dist/serviceFeatures/setupObsidian/qrCode.d.ts +4 -0
- package/dist/serviceFeatures/setupObsidian/qrCode.js +67 -0
- package/dist/serviceFeatures/setupObsidian/setupUri.d.ts +7 -0
- package/dist/serviceFeatures/setupObsidian/setupUri.js +70 -0
- package/dist/serviceFeatures/setupObsidian/types.d.ts +2 -0
- package/dist/serviceFeatures/setupObsidian/types.js +0 -0
- package/dist/serviceFeatures/targetFilter.d.ts +24 -0
- package/dist/serviceFeatures/targetFilter.js +178 -0
- package/dist/serviceModules/FileAccessBase.d.ts +93 -0
- package/dist/serviceModules/FileAccessBase.js +219 -0
- package/dist/serviceModules/Rebuilder.d.ts +92 -0
- package/dist/serviceModules/Rebuilder.js +449 -0
- package/dist/serviceModules/ServiceDatabaseFileAccessBase.d.ts +40 -0
- package/dist/serviceModules/ServiceDatabaseFileAccessBase.js +306 -0
- package/dist/serviceModules/ServiceFileAccessBase.d.ts +64 -0
- package/dist/serviceModules/ServiceFileAccessBase.js +312 -0
- package/dist/serviceModules/ServiceFileHandlerBase.d.ts +52 -0
- package/dist/serviceModules/ServiceFileHandlerBase.js +493 -0
- package/dist/serviceModules/ServiceModuleBase.d.ts +10 -0
- package/dist/serviceModules/ServiceModuleBase.js +13 -0
- package/dist/serviceModules/adapters/IConversionAdapter.d.ts +15 -0
- package/dist/serviceModules/adapters/IConversionAdapter.js +0 -0
- package/dist/serviceModules/adapters/IFileSystemAdapter.d.ts +47 -0
- package/dist/serviceModules/adapters/IFileSystemAdapter.js +0 -0
- package/dist/serviceModules/adapters/IPathAdapter.d.ts +15 -0
- package/dist/serviceModules/adapters/IPathAdapter.js +0 -0
- package/dist/serviceModules/adapters/IStorageAdapter.d.ts +56 -0
- package/dist/serviceModules/adapters/IStorageAdapter.js +0 -0
- package/dist/serviceModules/adapters/ITypeGuardAdapter.d.ts +14 -0
- package/dist/serviceModules/adapters/ITypeGuardAdapter.js +0 -0
- package/dist/serviceModules/adapters/IVaultAdapter.d.ts +51 -0
- package/dist/serviceModules/adapters/IVaultAdapter.js +0 -0
- package/dist/serviceModules/adapters/index.d.ts +6 -0
- package/dist/serviceModules/adapters/index.js +0 -0
- package/dist/services/BrowserServices.d.ts +36 -0
- package/dist/services/BrowserServices.js +123 -0
- package/dist/services/HeadlessServices.d.ts +14 -0
- package/dist/services/HeadlessServices.js +144 -0
- package/dist/services/InjectableServices.d.ts +1 -0
- package/dist/services/InjectableServices.js +4 -0
- package/dist/services/ServiceHub.d.ts +82 -0
- package/dist/services/ServiceHub.js +66 -0
- package/dist/services/base/APIService.d.ts +93 -0
- package/dist/services/base/APIService.js +44 -0
- package/dist/services/base/AppLifecycleService.d.ts +132 -0
- package/dist/services/base/AppLifecycleService.js +123 -0
- package/dist/services/base/ConfigService.d.ts +7 -0
- package/dist/services/base/ConfigService.js +6 -0
- package/dist/services/base/ConflictService.d.ts +54 -0
- package/dist/services/base/ConflictService.js +22 -0
- package/dist/services/base/ControlService.d.ts +54 -0
- package/dist/services/base/ControlService.js +103 -0
- package/dist/services/base/DatabaseEventService.d.ts +38 -0
- package/dist/services/base/DatabaseEventService.js +38 -0
- package/dist/services/base/DatabaseService.d.ts +40 -0
- package/dist/services/base/DatabaseService.js +79 -0
- package/dist/services/base/FileProcessingService.d.ts +25 -0
- package/dist/services/base/FileProcessingService.js +28 -0
- package/dist/services/base/IService.d.ts +284 -0
- package/dist/services/base/IService.js +1 -0
- package/dist/services/base/KeyValueDBService.d.ts +42 -0
- package/dist/services/base/KeyValueDBService.js +133 -0
- package/dist/services/base/MessageTranslator.d.ts +6 -0
- package/dist/services/base/MessageTranslator.js +4 -0
- package/dist/services/base/PathService.d.ts +38 -0
- package/dist/services/base/PathService.js +66 -0
- package/dist/services/base/RemoteService.d.ts +61 -0
- package/dist/services/base/RemoteService.js +212 -0
- package/dist/services/base/ReplicationService.d.ts +92 -0
- package/dist/services/base/ReplicationService.js +261 -0
- package/dist/services/base/ReplicatorService.d.ts +66 -0
- package/dist/services/base/ReplicatorService.js +164 -0
- package/dist/services/base/ServiceBase.d.ts +33 -0
- package/dist/services/base/ServiceBase.js +27 -0
- package/dist/services/base/SettingService.d.ts +112 -0
- package/dist/services/base/SettingService.js +543 -0
- package/dist/services/base/TestService.d.ts +28 -0
- package/dist/services/base/TestService.js +19 -0
- package/dist/services/base/TweakValueService.d.ts +40 -0
- package/dist/services/base/TweakValueService.js +6 -0
- package/dist/services/base/UnresolvedErrorManager.d.ts +15 -0
- package/dist/services/base/UnresolvedErrorManager.js +44 -0
- package/dist/services/base/VaultService.d.ts +69 -0
- package/dist/services/base/VaultService.js +70 -0
- package/dist/services/implements/base/SvelteDialog.d.ts +79 -0
- package/dist/services/implements/base/SvelteDialog.js +134 -0
- package/dist/services/implements/base/UIService.d.ts +24 -0
- package/dist/services/implements/base/UIService.js +37 -0
- package/dist/services/implements/browser/BrowserAPIService.d.ts +54 -0
- package/dist/services/implements/browser/BrowserAPIService.js +298 -0
- package/dist/services/implements/browser/BrowserDatabaseService.d.ts +7 -0
- package/dist/services/implements/browser/BrowserDatabaseService.js +10 -0
- package/dist/services/implements/browser/ConfigServiceBrowserCompat.d.ts +16 -0
- package/dist/services/implements/browser/ConfigServiceBrowserCompat.js +23 -0
- package/dist/services/implements/headless/HeadlessAPIService.d.ts +52 -0
- package/dist/services/implements/headless/HeadlessAPIService.js +127 -0
- package/dist/services/implements/headless/HeadlessDatabaseService.d.ts +7 -0
- package/dist/services/implements/headless/HeadlessDatabaseService.js +10 -0
- package/dist/services/implements/injectable/InjectableAPIService.d.ts +7 -0
- package/dist/services/implements/injectable/InjectableAPIService.js +18 -0
- package/dist/services/implements/injectable/InjectableAppLifecycleService.d.ts +11 -0
- package/dist/services/implements/injectable/InjectableAppLifecycleService.js +14 -0
- package/dist/services/implements/injectable/InjectableConflictService.d.ts +11 -0
- package/dist/services/implements/injectable/InjectableConflictService.js +14 -0
- package/dist/services/implements/injectable/InjectableDatabaseEventService.d.ts +4 -0
- package/dist/services/implements/injectable/InjectableDatabaseEventService.js +7 -0
- package/dist/services/implements/injectable/InjectableFileProcessingService.d.ts +4 -0
- package/dist/services/implements/injectable/InjectableFileProcessingService.js +6 -0
- package/dist/services/implements/injectable/InjectablePathService.d.ts +12 -0
- package/dist/services/implements/injectable/InjectablePathService.js +36 -0
- package/dist/services/implements/injectable/InjectableRemoteService.d.ts +4 -0
- package/dist/services/implements/injectable/InjectableRemoteService.js +7 -0
- package/dist/services/implements/injectable/InjectableReplicationService.d.ts +4 -0
- package/dist/services/implements/injectable/InjectableReplicationService.js +6 -0
- package/dist/services/implements/injectable/InjectableReplicatorService.d.ts +4 -0
- package/dist/services/implements/injectable/InjectableReplicatorService.js +7 -0
- package/dist/services/implements/injectable/InjectableServiceHub.d.ts +72 -0
- package/dist/services/implements/injectable/InjectableServiceHub.js +125 -0
- package/dist/services/implements/injectable/InjectableServices.d.ts +36 -0
- package/dist/services/implements/injectable/InjectableServices.js +1 -0
- package/dist/services/implements/injectable/InjectableSettingService.d.ts +11 -0
- package/dist/services/implements/injectable/InjectableSettingService.js +33 -0
- package/dist/services/implements/injectable/InjectableTestService.d.ts +5 -0
- package/dist/services/implements/injectable/InjectableTestService.js +8 -0
- package/dist/services/implements/injectable/InjectableTweakValueService.d.ts +15 -0
- package/dist/services/implements/injectable/InjectableTweakValueService.js +12 -0
- package/dist/services/implements/injectable/InjectableVaultService.d.ts +9 -0
- package/dist/services/implements/injectable/InjectableVaultService.js +20 -0
- package/dist/services/lib/HandlerUtils.d.ts +374 -0
- package/dist/services/lib/HandlerUtils.js +412 -0
- package/dist/services/lib/logUtils.d.ts +13 -0
- package/dist/services/lib/logUtils.js +28 -0
- package/dist/services/lib/remoteActivity.d.ts +13 -0
- package/dist/services/lib/remoteActivity.js +11 -0
- package/dist/string_and_binary/chunks.d.ts +10 -0
- package/dist/string_and_binary/chunks.js +561 -0
- package/dist/string_and_binary/convert.d.ts +8 -0
- package/dist/string_and_binary/convert.js +46 -0
- package/dist/string_and_binary/hash.d.ts +2 -0
- package/dist/string_and_binary/hash.js +1 -0
- package/dist/string_and_binary/path.d.ts +35 -0
- package/dist/string_and_binary/path.js +240 -0
- package/dist/worker/bg.common.d.ts +2 -0
- package/dist/worker/bg.common.js +6 -0
- package/dist/worker/bg.worker.d.ts +1 -0
- package/dist/worker/bg.worker.encryption.d.ts +7 -0
- package/dist/worker/bg.worker.encryption.js +30 -0
- package/dist/worker/bg.worker.js +14 -0
- package/dist/worker/bg.worker.splitting.d.ts +6 -0
- package/dist/worker/bg.worker.splitting.js +36 -0
- package/dist/worker/bgWorker.d.ts +25 -0
- package/dist/worker/bgWorker.direct.d.ts +40 -0
- package/dist/worker/bgWorker.direct.js +65 -0
- package/dist/worker/bgWorker.encryption.d.ts +22 -0
- package/dist/worker/bgWorker.encryption.js +40 -0
- package/dist/worker/bgWorker.js +348 -0
- package/dist/worker/bgWorker.splitting.d.ts +27 -0
- package/dist/worker/bgWorker.splitting.js +123 -0
- package/dist/worker/universalTypes.d.ts +63 -0
- package/dist/worker/universalTypes.js +4 -0
- package/docs/development.md +51 -0
- package/docs/platform-storage.md +60 -0
- package/docs/releasing.md +69 -0
- package/package.json +693 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { selfId, joinRoom } from "@trystero-p2p/nostr";
|
|
2
|
+
import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE } from "../../common/types.js";
|
|
3
|
+
import { LOG_LEVEL_VERBOSE, Logger } from "../../common/logger.js";
|
|
4
|
+
import {
|
|
5
|
+
DIRECTION_RESPONSE,
|
|
6
|
+
ResponsePreventedError,
|
|
7
|
+
DIRECTION_REQUEST
|
|
8
|
+
} from "./types.js";
|
|
9
|
+
import { StoredMapLike } from "../../dataobject/StoredMap.js";
|
|
10
|
+
import { TrysteroReplicatorP2PClient } from "./TrysteroReplicatorP2PClient.js";
|
|
11
|
+
import { createHostingDB } from "./ProxiedDB.js";
|
|
12
|
+
import { EVENT_PLATFORM_UNLOADED } from "../../events/coreEvents.js";
|
|
13
|
+
import { shareRunningResult } from "octagonal-wheels/concurrency/lock_v2";
|
|
14
|
+
import { Computed } from "octagonal-wheels/dataobject/Computed";
|
|
15
|
+
import { RpcRoom } from "../../rpc/index.js";
|
|
16
|
+
import { TRYSTERO_RPC_DEFAULTS } from "../../rpc/transports/TrysteroTransport.js";
|
|
17
|
+
import { toRpcMethodName } from "./rpcCompat.js";
|
|
18
|
+
import { generateJoinRoomOptions } from "../../rpc/transports/trysteroUtils.js";
|
|
19
|
+
import { subscribeConnectionStatus, subscribeFailureDiagnosis } from "../../rpc/transports/DiagRTCPeerConnections.js";
|
|
20
|
+
import {} from "../../rpc/transports/DiagRTCPeerConnections.types.js";
|
|
21
|
+
const EVENT_SERVER_STATUS = "p2p-server-status";
|
|
22
|
+
const EVENT_MAKE_DECISION = "make-decision-p2p-peer";
|
|
23
|
+
const EVENT_REVOKE_DECISION = "revoke-decision-p2p-peer";
|
|
24
|
+
const EVENT_ADVERTISEMENT_RECEIVED = "p2p-advertisement-received";
|
|
25
|
+
const EVENT_DEVICE_LEAVED = "p2p-device-leaved";
|
|
26
|
+
const EVENT_REQUEST_STATUS = "p2p-request-status";
|
|
27
|
+
const EVENT_P2P_REQUEST_FORCE_OPEN = "p2p-request-force-open";
|
|
28
|
+
const EVENT_P2P_CONNECTED = "p2p-connected";
|
|
29
|
+
const EVENT_P2P_DISCONNECTED = "p2p-disconnected";
|
|
30
|
+
const EVENT_P2P_REPLICATOR_STATUS = "p2p-replicator-status";
|
|
31
|
+
const EVENT_P2P_REPLICATOR_PROGRESS = "p2p-replicator-progress";
|
|
32
|
+
class TrysteroReplicatorP2PServer {
|
|
33
|
+
_env;
|
|
34
|
+
_room;
|
|
35
|
+
_serverPeerId;
|
|
36
|
+
_activeRoomId = "";
|
|
37
|
+
___send;
|
|
38
|
+
assignedFunctions = /* @__PURE__ */ new Map();
|
|
39
|
+
clients = /* @__PURE__ */ new Map();
|
|
40
|
+
_bindingObjects = [];
|
|
41
|
+
_rpcRoom;
|
|
42
|
+
_peerStatusEventCleanup = void 0;
|
|
43
|
+
_peerFailureAnalysisCleanup = void 0;
|
|
44
|
+
_peerConnectionEventCleanup() {
|
|
45
|
+
if (this._peerStatusEventCleanup) {
|
|
46
|
+
this._peerStatusEventCleanup();
|
|
47
|
+
this._peerStatusEventCleanup = void 0;
|
|
48
|
+
}
|
|
49
|
+
if (this._peerFailureAnalysisCleanup) {
|
|
50
|
+
this._peerFailureAnalysisCleanup();
|
|
51
|
+
this._peerFailureAnalysisCleanup = void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_diagStats = {
|
|
55
|
+
totalNewConnections: 0,
|
|
56
|
+
totalFailedConnections: 0,
|
|
57
|
+
totalSuccessfulConnections: 0,
|
|
58
|
+
totalClosedConnections: 0,
|
|
59
|
+
details: {}
|
|
60
|
+
};
|
|
61
|
+
get isDisposed() {
|
|
62
|
+
return !this._room;
|
|
63
|
+
}
|
|
64
|
+
get isServing() {
|
|
65
|
+
return this._room !== void 0;
|
|
66
|
+
}
|
|
67
|
+
async ensureLeaved() {
|
|
68
|
+
if (this._room) {
|
|
69
|
+
try {
|
|
70
|
+
await this._room?.leave();
|
|
71
|
+
} catch (ex) {
|
|
72
|
+
Logger(
|
|
73
|
+
`Some error has been occurred while leaving the room, but possibly can be ignored`,
|
|
74
|
+
LOG_LEVEL_VERBOSE
|
|
75
|
+
);
|
|
76
|
+
Logger(ex, LOG_LEVEL_VERBOSE);
|
|
77
|
+
}
|
|
78
|
+
this._room = void 0;
|
|
79
|
+
this._env.events.emitEvent(EVENT_P2P_DISCONNECTED);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async setRoom(room) {
|
|
83
|
+
await this._room?.leave();
|
|
84
|
+
this._room = room;
|
|
85
|
+
}
|
|
86
|
+
async shutdown() {
|
|
87
|
+
try {
|
|
88
|
+
await this.close();
|
|
89
|
+
await this.ensureLeaved();
|
|
90
|
+
this._rpcRoom?.close();
|
|
91
|
+
this._rpcRoom = void 0;
|
|
92
|
+
} catch (ex) {
|
|
93
|
+
Logger(`Some error has been occurred while shutting down the server`, LOG_LEVEL_INFO);
|
|
94
|
+
Logger(ex, LOG_LEVEL_VERBOSE);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async dispatchConnectionStatus() {
|
|
98
|
+
const adsTasks = [...this.knownAdvertisements].map(async (e) => {
|
|
99
|
+
const isAccepted = await this.acceptedPeers.get(e.name);
|
|
100
|
+
const isTemporaryAccepted = this.temporaryAcceptedPeers.get(e.peerId);
|
|
101
|
+
return {
|
|
102
|
+
...e,
|
|
103
|
+
isAccepted,
|
|
104
|
+
isTemporaryAccepted
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
const ads = await Promise.all(adsTasks);
|
|
108
|
+
this._env.events.emitEvent(EVENT_SERVER_STATUS, {
|
|
109
|
+
isConnected: this.isServing,
|
|
110
|
+
knownAdvertisements: ads,
|
|
111
|
+
serverPeerId: this.serverPeerId,
|
|
112
|
+
roomId: this._activeRoomId,
|
|
113
|
+
diag: this._diagStats
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
constructor(env, _serverPeerId = selfId) {
|
|
117
|
+
this._env = env;
|
|
118
|
+
this._serverPeerId = _serverPeerId;
|
|
119
|
+
this._env.events.onEvent(EVENT_PLATFORM_UNLOADED, () => {
|
|
120
|
+
void this.shutdown();
|
|
121
|
+
});
|
|
122
|
+
this.acceptedPeers = new StoredMapLike(
|
|
123
|
+
this._env.simpleStore,
|
|
124
|
+
"p2p-device-decisions"
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
async makeDecision(decision) {
|
|
128
|
+
if (decision.decision) {
|
|
129
|
+
if (decision.isTemporary) {
|
|
130
|
+
this.temporaryAcceptedPeers.set(decision.peerId, true);
|
|
131
|
+
} else {
|
|
132
|
+
await this.acceptedPeers.set(decision.name, true);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
if (decision.isTemporary) {
|
|
136
|
+
this.temporaryAcceptedPeers.set(decision.peerId, false);
|
|
137
|
+
} else {
|
|
138
|
+
await this.acceptedPeers.set(decision.name, false);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
await this.dispatchConnectionStatus();
|
|
142
|
+
}
|
|
143
|
+
async revokeDecision(decision) {
|
|
144
|
+
this.temporaryAcceptedPeers.delete(decision.peerId);
|
|
145
|
+
await this.acceptedPeers.delete(decision.name);
|
|
146
|
+
await this.dispatchConnectionStatus();
|
|
147
|
+
}
|
|
148
|
+
get room() {
|
|
149
|
+
return this._room;
|
|
150
|
+
}
|
|
151
|
+
get serverPeerId() {
|
|
152
|
+
return this._serverPeerId;
|
|
153
|
+
}
|
|
154
|
+
get db() {
|
|
155
|
+
return this._env.db;
|
|
156
|
+
}
|
|
157
|
+
get confirm() {
|
|
158
|
+
return this._env.confirm;
|
|
159
|
+
}
|
|
160
|
+
get settings() {
|
|
161
|
+
return this._env.settings;
|
|
162
|
+
}
|
|
163
|
+
get isEnabled() {
|
|
164
|
+
return this.settings.P2P_Enabled;
|
|
165
|
+
}
|
|
166
|
+
get deviceInfo() {
|
|
167
|
+
return {
|
|
168
|
+
currentPeerId: this._serverPeerId,
|
|
169
|
+
name: this._env.deviceName,
|
|
170
|
+
platform: this._env.platform,
|
|
171
|
+
version: "0.0.0"
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
_sendAdvertisement;
|
|
175
|
+
// _advertisementTimer?: ReturnType<typeof setInterval>;
|
|
176
|
+
sendAdvertisement(peerId) {
|
|
177
|
+
if (!this.isEnabled) return;
|
|
178
|
+
const devInfo = this.deviceInfo;
|
|
179
|
+
const data = {
|
|
180
|
+
peerId: devInfo.currentPeerId,
|
|
181
|
+
name: devInfo.name,
|
|
182
|
+
platform: devInfo.platform
|
|
183
|
+
};
|
|
184
|
+
if (this._sendAdvertisement) {
|
|
185
|
+
Logger(`peerId: ${this.serverPeerId} Sending Advertisement to ${peerId ?? "All"}`, LOG_LEVEL_VERBOSE);
|
|
186
|
+
void this._sendAdvertisement(data, peerId);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// startAdvertisementBroadcast() {
|
|
190
|
+
// if (this._advertisementTimer) {
|
|
191
|
+
// clearInterval(this._advertisementTimer);
|
|
192
|
+
// }
|
|
193
|
+
// this._advertisementTimer = setInterval(() => {
|
|
194
|
+
// if (!this.isServing || !this.isEnabled) {
|
|
195
|
+
// return;
|
|
196
|
+
// }
|
|
197
|
+
// this.sendAdvertisement();
|
|
198
|
+
// }, ADVERTISEMENT_REBROADCAST_INTERVAL_MS);
|
|
199
|
+
// }
|
|
200
|
+
// stopAdvertisementBroadcast() {
|
|
201
|
+
// if (this._advertisementTimer) {
|
|
202
|
+
// clearInterval(this._advertisementTimer);
|
|
203
|
+
// this._advertisementTimer = undefined;
|
|
204
|
+
// }
|
|
205
|
+
// }
|
|
206
|
+
_knownAdvertisements = /* @__PURE__ */ new Map();
|
|
207
|
+
get knownAdvertisements() {
|
|
208
|
+
return [...this._knownAdvertisements.values()];
|
|
209
|
+
}
|
|
210
|
+
onAdvertisement(data, peerId) {
|
|
211
|
+
if (!this.isEnabled) return;
|
|
212
|
+
Logger(`Advertisement from ${peerId}`, LOG_LEVEL_VERBOSE);
|
|
213
|
+
if (peerId === this.serverPeerId) return;
|
|
214
|
+
if (data.peerId === this.serverPeerId) return;
|
|
215
|
+
if (data.peerId !== peerId) return;
|
|
216
|
+
this._knownAdvertisements.set(peerId, data);
|
|
217
|
+
void this.dispatchConnectionStatus();
|
|
218
|
+
void this._env.events.emitEvent(EVENT_ADVERTISEMENT_RECEIVED, data);
|
|
219
|
+
}
|
|
220
|
+
acceptedPeers;
|
|
221
|
+
temporaryAcceptedPeers = /* @__PURE__ */ new Map();
|
|
222
|
+
confirmUserToAccept(peerId) {
|
|
223
|
+
return shareRunningResult(`confirmUserToAccept-${peerId}`, () => this._confirmUserToAccept(peerId));
|
|
224
|
+
}
|
|
225
|
+
_confirmUserToAccept(peerId) {
|
|
226
|
+
const peerInfo = this._knownAdvertisements.get(peerId);
|
|
227
|
+
if (!peerInfo) throw new Error("Unknown Peer");
|
|
228
|
+
const peerName = peerInfo.name;
|
|
229
|
+
const message = `Are you sure to establish connection to ${peerName} (${peerId})?
|
|
230
|
+
You can chose as follows:
|
|
231
|
+
- Accept: Accept all connections from this peer.
|
|
232
|
+
- Ignore: Reject all connections from this peer.
|
|
233
|
+
- Accept Temporarily: Accept the connection for this session only.
|
|
234
|
+
- Ignore Temporarily: Reject the connection for this session only.
|
|
235
|
+
|
|
236
|
+
>[!INFO] You can revoke your decision from the Peer-to-Peer Replicator Pane.`;
|
|
237
|
+
const OPTION_ACCEPT = "Accept";
|
|
238
|
+
const OPTION_IGNORE = "Ignore";
|
|
239
|
+
const OPTION_ACCEPT_TEMPORARILY = "Accept Temporarily";
|
|
240
|
+
const OPTION_IGNORE_TEMPORARILY = "Ignore Temporarily";
|
|
241
|
+
const OPTIONS = [OPTION_ACCEPT, OPTION_IGNORE, OPTION_ACCEPT_TEMPORARILY, OPTION_IGNORE_TEMPORARILY];
|
|
242
|
+
return this.confirm.askSelectStringDialogue(message, OPTIONS, {
|
|
243
|
+
title: "P2P Connection Request",
|
|
244
|
+
defaultAction: "Ignore Temporarily",
|
|
245
|
+
timeout: 30
|
|
246
|
+
}).then((decision) => {
|
|
247
|
+
if (decision === OPTION_ACCEPT_TEMPORARILY) {
|
|
248
|
+
this.temporaryAcceptedPeers.set(peerId, true);
|
|
249
|
+
void this.dispatchConnectionStatus();
|
|
250
|
+
return true;
|
|
251
|
+
} else if (decision === OPTION_IGNORE_TEMPORARILY) {
|
|
252
|
+
this.temporaryAcceptedPeers.set(peerId, false);
|
|
253
|
+
void this.dispatchConnectionStatus();
|
|
254
|
+
return false;
|
|
255
|
+
} else if (decision === OPTION_ACCEPT) {
|
|
256
|
+
this.temporaryAcceptedPeers.delete(peerId);
|
|
257
|
+
void this.acceptedPeers.set(peerName, true);
|
|
258
|
+
void this.dispatchConnectionStatus();
|
|
259
|
+
return true;
|
|
260
|
+
} else if (decision === OPTION_IGNORE) {
|
|
261
|
+
this.temporaryAcceptedPeers.delete(peerId);
|
|
262
|
+
void this.acceptedPeers.set(peerName, false);
|
|
263
|
+
void this.dispatchConnectionStatus();
|
|
264
|
+
return false;
|
|
265
|
+
} else {
|
|
266
|
+
throw new ResponsePreventedError("User Accepting failed");
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
_acceptablePeers = new Computed({
|
|
271
|
+
evaluation: (settings) => {
|
|
272
|
+
return `${settings?.P2P_AutoAcceptingPeers ?? ""}`.split(",").map((e) => e.trim()).filter((e) => !!e).map((e) => e.startsWith("~") ? new RegExp(e.substring(1), "i") : new RegExp(`^${e}$`, "i"));
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
_shouldDenyPeers = new Computed({
|
|
276
|
+
evaluation: (settings) => {
|
|
277
|
+
return `${settings?.P2P_AutoDenyingPeers ?? ""}`.split(",").map((e) => e.trim()).filter((e) => !!e).map((e) => e.startsWith("~") ? new RegExp(e.substring(1), "i") : new RegExp(`^${e}$`, "i"));
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
async isAcceptablePeer(peerId) {
|
|
281
|
+
if (!this.isEnabled) return void 0;
|
|
282
|
+
const peerInfo = this._knownAdvertisements.get(peerId);
|
|
283
|
+
if (!peerInfo) return false;
|
|
284
|
+
const peerName = peerInfo.name;
|
|
285
|
+
if (this.temporaryAcceptedPeers.has(peerId)) return this.temporaryAcceptedPeers.get(peerId);
|
|
286
|
+
const accepted = await this.acceptedPeers.get(peerName);
|
|
287
|
+
if (accepted !== void 0 && accepted !== null) return accepted;
|
|
288
|
+
const isAcceptable = (await this._acceptablePeers.update(this.settings)).value.some((e) => e.test(peerName));
|
|
289
|
+
const isDeny = (await this._shouldDenyPeers.update(this.settings)).value.some((e) => e.test(peerName));
|
|
290
|
+
if (isAcceptable) {
|
|
291
|
+
if (isDeny) return false;
|
|
292
|
+
this.temporaryAcceptedPeers.set(peerId, true);
|
|
293
|
+
void this.dispatchConnectionStatus();
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
if (this.settings.P2P_IsHeadless) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return await this.confirmUserToAccept(peerId);
|
|
300
|
+
}
|
|
301
|
+
async __send(data, peerId) {
|
|
302
|
+
if (!this.isEnabled) return;
|
|
303
|
+
if (!await this.isAcceptablePeer(peerId)) {
|
|
304
|
+
Logger(`Invalid Message to ${peerId}`, LOG_LEVEL_VERBOSE);
|
|
305
|
+
Logger(data, LOG_LEVEL_VERBOSE);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (this.___send) {
|
|
309
|
+
return await this.___send(data, peerId);
|
|
310
|
+
} else {
|
|
311
|
+
Logger(`Cannot send response, no send function`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async processArrivedRPC(data, peerId) {
|
|
315
|
+
if (!this.isEnabled) return;
|
|
316
|
+
if (!data.type.startsWith("!")) {
|
|
317
|
+
const isAcceptable = await this.isAcceptablePeer(peerId);
|
|
318
|
+
if (!isAcceptable) {
|
|
319
|
+
throw new Error(`Not acceptable peer ${peerId}`);
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
}
|
|
323
|
+
if (data.direction === DIRECTION_RESPONSE) {
|
|
324
|
+
this.__onResponse(data, peerId);
|
|
325
|
+
} else if (data.direction === DIRECTION_REQUEST) {
|
|
326
|
+
await this.__onRequest(data, peerId);
|
|
327
|
+
} else {
|
|
328
|
+
throw new Error(`Invalid Message from ${peerId}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
_onPeerJoin(peerId) {
|
|
332
|
+
if (!this._room) {
|
|
333
|
+
Logger(`Received peer join event from ${peerId}, but no active room. Ignoring.`, LOG_LEVEL_VERBOSE);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
const peers = this._room.getPeers();
|
|
337
|
+
const peer = peers[peerId];
|
|
338
|
+
Logger(`Peer joined: ${peerId}`, LOG_LEVEL_VERBOSE);
|
|
339
|
+
this.activePeer.set(peerId, peer);
|
|
340
|
+
this.sendAdvertisement(peerId);
|
|
341
|
+
}
|
|
342
|
+
_onPeerLeave(peerId) {
|
|
343
|
+
Logger(`Peer left: ${peerId}`, LOG_LEVEL_VERBOSE);
|
|
344
|
+
this._knownAdvertisements.delete(peerId);
|
|
345
|
+
const peerConn = this.activePeer.get(peerId);
|
|
346
|
+
if (peerConn) {
|
|
347
|
+
peerConn.close();
|
|
348
|
+
this.activePeer.delete(peerId);
|
|
349
|
+
}
|
|
350
|
+
void this._env.events.emitEvent(EVENT_DEVICE_LEAVED, peerId);
|
|
351
|
+
void this.dispatchConnectionStatus();
|
|
352
|
+
}
|
|
353
|
+
activePeer = /* @__PURE__ */ new Map();
|
|
354
|
+
onAfterJoinRoom() {
|
|
355
|
+
Logger(`Initializing...`, LOG_LEVEL_VERBOSE);
|
|
356
|
+
const room = this.room;
|
|
357
|
+
if (!room) throw new Error("This server has been already disconnected");
|
|
358
|
+
const [sendRpc, arrivedRpc] = room.makeAction("rpc2");
|
|
359
|
+
const transport = {
|
|
360
|
+
send: (message, peerId) => {
|
|
361
|
+
return sendRpc(message, peerId).then(() => void 0);
|
|
362
|
+
},
|
|
363
|
+
onMessage: (handler) => {
|
|
364
|
+
arrivedRpc((data, peerId) => {
|
|
365
|
+
handler(data, peerId);
|
|
366
|
+
});
|
|
367
|
+
return () => void 0;
|
|
368
|
+
},
|
|
369
|
+
onPeerJoin: (handler) => {
|
|
370
|
+
room.onPeerJoin((peerId) => {
|
|
371
|
+
this._onPeerJoin(peerId);
|
|
372
|
+
handler(peerId);
|
|
373
|
+
});
|
|
374
|
+
return () => void 0;
|
|
375
|
+
},
|
|
376
|
+
onPeerLeave: (handler) => {
|
|
377
|
+
room.onPeerLeave((peerId) => {
|
|
378
|
+
this._onPeerLeave(peerId);
|
|
379
|
+
handler(peerId);
|
|
380
|
+
});
|
|
381
|
+
return () => void 0;
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
this._rpcRoom?.close();
|
|
385
|
+
this._rpcRoom = new RpcRoom({
|
|
386
|
+
...TRYSTERO_RPC_DEFAULTS,
|
|
387
|
+
transport,
|
|
388
|
+
canAcceptRequest: async (peerId, method) => {
|
|
389
|
+
if (method === toRpcMethodName("!reqAuth")) return true;
|
|
390
|
+
return await this.isAcceptablePeer(peerId) === true;
|
|
391
|
+
},
|
|
392
|
+
onProtocolWarning: (message, peerId) => {
|
|
393
|
+
Logger(`RPC Protocol warning${peerId ? ` from ${peerId}` : ""}: ${message}`, LOG_LEVEL_VERBOSE);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
const [adSend, adArrived] = room.makeAction("ad");
|
|
397
|
+
this._sendAdvertisement = adSend;
|
|
398
|
+
adArrived((data, peerId) => {
|
|
399
|
+
void this.onAdvertisement(data, peerId);
|
|
400
|
+
});
|
|
401
|
+
this._env.events.emitEvent(EVENT_P2P_CONNECTED);
|
|
402
|
+
void this.dispatchConnectionStatus();
|
|
403
|
+
}
|
|
404
|
+
async startService(bindings = []) {
|
|
405
|
+
if (!this.isEnabled) {
|
|
406
|
+
Logger(this._env.translate("P2P.NotEnabled"), LOG_LEVEL_NOTICE);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const servingDB = createHostingDB(this._env);
|
|
410
|
+
this._bindingObjects = [...bindings, servingDB];
|
|
411
|
+
this._bindingObjects.forEach((b) => {
|
|
412
|
+
this.serveObject(b);
|
|
413
|
+
});
|
|
414
|
+
await Promise.resolve(this.sendAdvertisement());
|
|
415
|
+
}
|
|
416
|
+
async start(bindings = []) {
|
|
417
|
+
await this.shutdown();
|
|
418
|
+
if (!this.settings.P2P_Enabled) {
|
|
419
|
+
Logger(this._env.translate("P2P.NotEnabled"), LOG_LEVEL_NOTICE);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const options = generateJoinRoomOptions(this.settings);
|
|
423
|
+
const roomId = this.settings.P2P_roomID;
|
|
424
|
+
this._peerConnectionEventCleanup();
|
|
425
|
+
this._peerStatusEventCleanup = subscribeConnectionStatus((status) => {
|
|
426
|
+
this._diagStats = status;
|
|
427
|
+
void this.dispatchConnectionStatus();
|
|
428
|
+
});
|
|
429
|
+
this._peerFailureAnalysisCleanup = subscribeFailureDiagnosis((status) => {
|
|
430
|
+
Logger(`[P2P] Connection failure detected: ${status.userMessage}`, LOG_LEVEL_NOTICE);
|
|
431
|
+
});
|
|
432
|
+
const room = joinRoom(options, roomId, {
|
|
433
|
+
handshakeTimeoutMs: 3e4,
|
|
434
|
+
onJoinError: (error) => {
|
|
435
|
+
Logger("Some peer Failed to join Trystero room");
|
|
436
|
+
Logger(error, LOG_LEVEL_VERBOSE);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
await this.setRoom(room);
|
|
440
|
+
this._activeRoomId = roomId;
|
|
441
|
+
this.onAfterJoinRoom();
|
|
442
|
+
void this.dispatchConnectionStatus();
|
|
443
|
+
await this.startService(bindings);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* @deprecated Use serveFunction or serveObject instead. This is only for backward compatibility and may be removed in the future.
|
|
447
|
+
* @param type
|
|
448
|
+
* @param func
|
|
449
|
+
*/
|
|
450
|
+
serveFunction(type, func) {
|
|
451
|
+
this.assignedFunctions.set(type, func);
|
|
452
|
+
this._rpcRoom?.register(toRpcMethodName(type), async (peerId, ...args) => {
|
|
453
|
+
return await Promise.resolve(func.apply(this, [peerId, ...args]));
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
serveObject(obj) {
|
|
457
|
+
const keys = Object.keys(obj);
|
|
458
|
+
keys.forEach((key) => {
|
|
459
|
+
if (key.toString().startsWith("_")) return;
|
|
460
|
+
const func = obj[key].bind(obj);
|
|
461
|
+
this.assignedFunctions.set(key.toString(), func);
|
|
462
|
+
this._rpcRoom?.register(toRpcMethodName(key.toString()), async (_peerId, ...args) => {
|
|
463
|
+
return await Promise.resolve(func(...args));
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
__onResponse(data, peerId) {
|
|
468
|
+
const peer = this.clients.get(peerId);
|
|
469
|
+
if (!peer) {
|
|
470
|
+
Logger(`Response from unknown peer ${peerId}`, LOG_LEVEL_VERBOSE);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
peer.__onResponse(data);
|
|
474
|
+
}
|
|
475
|
+
async __onRequest(data, peerId) {
|
|
476
|
+
try {
|
|
477
|
+
const func = this.assignedFunctions.get(data.type);
|
|
478
|
+
if (typeof func !== "function")
|
|
479
|
+
throw new Error(`Cannot serve function ${data.type}, no function provided or I am only a client`);
|
|
480
|
+
const r = await Promise.resolve(func.apply(this, data.args));
|
|
481
|
+
await this.__send({ type: data.type, seq: data.seq, direction: DIRECTION_RESPONSE, data: r }, peerId);
|
|
482
|
+
} catch (e) {
|
|
483
|
+
if (e instanceof ResponsePreventedError) {
|
|
484
|
+
Logger(`Serving function: [FAILED] ${data.type}: Response prevented.`, LOG_LEVEL_VERBOSE);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
Logger(`Serving function: [FAILED] ${data.type} sending back the failure information`, LOG_LEVEL_VERBOSE);
|
|
488
|
+
Logger(e instanceof Error ? e.message : e, LOG_LEVEL_VERBOSE);
|
|
489
|
+
await this.__send(
|
|
490
|
+
{ type: data.type, seq: data.seq, direction: DIRECTION_RESPONSE, data: void 0, error: e },
|
|
491
|
+
peerId
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
async close() {
|
|
496
|
+
this.assignedFunctions.clear();
|
|
497
|
+
const peers = this.room?.getPeers() ?? {};
|
|
498
|
+
this.clients.forEach((client) => client.close());
|
|
499
|
+
this.clients.clear();
|
|
500
|
+
this._rpcRoom?.close();
|
|
501
|
+
this._rpcRoom = void 0;
|
|
502
|
+
for (const [, peer] of Object.entries(peers)) {
|
|
503
|
+
peer.close();
|
|
504
|
+
}
|
|
505
|
+
await this.ensureLeaved();
|
|
506
|
+
this._activeRoomId = "";
|
|
507
|
+
this._knownAdvertisements.clear();
|
|
508
|
+
this._peerConnectionEventCleanup();
|
|
509
|
+
await this.dispatchConnectionStatus();
|
|
510
|
+
}
|
|
511
|
+
getConnection(peerId) {
|
|
512
|
+
if (this.clients.has(peerId)) {
|
|
513
|
+
return this.clients.get(peerId);
|
|
514
|
+
}
|
|
515
|
+
if (!this._knownAdvertisements.has(peerId)) {
|
|
516
|
+
throw new Error(`Unknown Peer ${peerId}`);
|
|
517
|
+
}
|
|
518
|
+
const client = new TrysteroReplicatorP2PClient(this, peerId);
|
|
519
|
+
this.clients.set(peerId, client);
|
|
520
|
+
return client;
|
|
521
|
+
}
|
|
522
|
+
get rpcRoom() {
|
|
523
|
+
return this._rpcRoom;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
export {
|
|
527
|
+
EVENT_ADVERTISEMENT_RECEIVED,
|
|
528
|
+
EVENT_DEVICE_LEAVED,
|
|
529
|
+
EVENT_MAKE_DECISION,
|
|
530
|
+
EVENT_P2P_CONNECTED,
|
|
531
|
+
EVENT_P2P_DISCONNECTED,
|
|
532
|
+
EVENT_P2P_REPLICATOR_PROGRESS,
|
|
533
|
+
EVENT_P2P_REPLICATOR_STATUS,
|
|
534
|
+
EVENT_P2P_REQUEST_FORCE_OPEN,
|
|
535
|
+
EVENT_REQUEST_STATUS,
|
|
536
|
+
EVENT_REVOKE_DECISION,
|
|
537
|
+
EVENT_SERVER_STATUS,
|
|
538
|
+
TrysteroReplicatorP2PServer as P2PHost,
|
|
539
|
+
TrysteroReplicatorP2PServer
|
|
540
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactiveSource } from "octagonal-wheels/dataobject/reactive_v2";
|
|
2
|
+
import type { LiveSyncTrysteroReplicator } from "./LiveSyncTrysteroReplicator.js";
|
|
3
|
+
import type { P2PLogCollector } from "./P2PLogCollector.js";
|
|
4
|
+
export type UseP2PReplicatorResult = {
|
|
5
|
+
replicator: LiveSyncTrysteroReplicator;
|
|
6
|
+
};
|
|
7
|
+
export type P2PPaneParams = {
|
|
8
|
+
replicator: LiveSyncTrysteroReplicator;
|
|
9
|
+
p2pLogCollector: P2PLogCollector;
|
|
10
|
+
storeP2PStatusLine: ReactiveSource<string>;
|
|
11
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LiveSyncEventHub } from "../../hub/hub.js";
|
|
2
|
+
import type { LiveSyncTrysteroReplicator } from "./LiveSyncTrysteroReplicator.js";
|
|
3
|
+
import type { Advertisement } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Minimal interface that a P2P replicator instance should satisfy for addP2PEventHandlers to work.
|
|
6
|
+
*/
|
|
7
|
+
export interface P2PReplicatorLike {
|
|
8
|
+
onNewPeer(peer: Advertisement): Promise<void> | void;
|
|
9
|
+
onPeerLeaved(peerId: string): void;
|
|
10
|
+
requestStatus(): void;
|
|
11
|
+
open(): Promise<void>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
/** Indicates whether the room is currently active. */
|
|
14
|
+
readonly isServing?: boolean;
|
|
15
|
+
/** Legacy: host object that may carry isServing (LiveSyncTrysteroReplicator). */
|
|
16
|
+
readonly server?: {
|
|
17
|
+
isServing?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Add event handlers for P2P replication related events.
|
|
22
|
+
* @param instance P2PReplicatorLike instance
|
|
23
|
+
*/
|
|
24
|
+
export declare function addP2PEventHandlers(instance: P2PReplicatorLike, events: LiveSyncEventHub): void;
|
|
25
|
+
/**
|
|
26
|
+
* open P2P replicator if not opened yet.
|
|
27
|
+
* @param instance
|
|
28
|
+
*/
|
|
29
|
+
export declare function openP2PReplicator(instance: P2PReplicatorLike): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* close P2P replicator
|
|
32
|
+
* @param instance
|
|
33
|
+
*/
|
|
34
|
+
export declare function closeP2PReplicator(instance: P2PReplicatorLike): Promise<void>;
|
|
35
|
+
export type { LiveSyncTrysteroReplicator };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EVENT_DATABASE_REBUILT, EVENT_PLATFORM_UNLOADED, EVENT_SETTING_SAVED } from "../../events/coreEvents.js";
|
|
2
|
+
import { EVENT_ADVERTISEMENT_RECEIVED, EVENT_DEVICE_LEAVED, EVENT_REQUEST_STATUS } from "./TrysteroReplicatorP2PServer.js";
|
|
3
|
+
function addP2PEventHandlers(instance, events) {
|
|
4
|
+
events.onEvent(EVENT_ADVERTISEMENT_RECEIVED, (peer) => {
|
|
5
|
+
void instance.onNewPeer(peer);
|
|
6
|
+
});
|
|
7
|
+
events.onEvent(EVENT_DEVICE_LEAVED, (peerId) => {
|
|
8
|
+
instance.onPeerLeaved(peerId);
|
|
9
|
+
});
|
|
10
|
+
events.onEvent(EVENT_REQUEST_STATUS, () => {
|
|
11
|
+
instance.requestStatus();
|
|
12
|
+
});
|
|
13
|
+
events.onEvent(EVENT_DATABASE_REBUILT, async () => {
|
|
14
|
+
await instance.open();
|
|
15
|
+
});
|
|
16
|
+
events.onEvent(EVENT_PLATFORM_UNLOADED, () => {
|
|
17
|
+
void instance.close();
|
|
18
|
+
});
|
|
19
|
+
events.onEvent(EVENT_SETTING_SAVED, async (settings) => {
|
|
20
|
+
const isOpen = instance.isServing ?? instance.server?.isServing ?? false;
|
|
21
|
+
if (settings.P2P_Enabled && settings.P2P_AutoStart) {
|
|
22
|
+
await instance.open();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (isOpen) {
|
|
26
|
+
await instance.close();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function openP2PReplicator(instance) {
|
|
31
|
+
const isOpen = instance.isServing ?? instance.server?.isServing ?? false;
|
|
32
|
+
if (!isOpen) {
|
|
33
|
+
await instance.open();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function closeP2PReplicator(instance) {
|
|
37
|
+
await instance.close();
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
addP2PEventHandlers,
|
|
41
|
+
closeP2PReplicator,
|
|
42
|
+
openP2PReplicator
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toRpcMethodName(method: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const DB_METHODS = /* @__PURE__ */ new Set(["info", "changes", "revsDiff", "bulkDocs", "bulkGet", "put", "get"]);
|
|
2
|
+
function toRpcMethodName(method) {
|
|
3
|
+
if (method.includes(".") || method.includes("/")) return method;
|
|
4
|
+
if (DB_METHODS.has(method)) return `db.${method}`;
|
|
5
|
+
return `legacy/${method}`;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
toRpcMethodName
|
|
9
|
+
};
|