@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,44 @@
|
|
|
1
|
+
import { EVENT_ON_UNRESOLVED_ERROR } from "../../events/coreEvents.js";
|
|
2
|
+
import { LEVEL_NOTICE, LEVEL_INFO } from "octagonal-wheels/common/logger";
|
|
3
|
+
import { createInstanceLogFunction } from "../lib/logUtils.js";
|
|
4
|
+
class UnresolvedErrorManager {
|
|
5
|
+
constructor(appLifecycleService, events) {
|
|
6
|
+
this.events = events;
|
|
7
|
+
this.appLifecycleService = appLifecycleService;
|
|
8
|
+
this.appLifecycleService.getUnresolvedMessages.addHandler(this._reportUnresolvedMessages.bind(this));
|
|
9
|
+
}
|
|
10
|
+
events;
|
|
11
|
+
_log = createInstanceLogFunction("UnresolvedErrorManager");
|
|
12
|
+
appLifecycleService;
|
|
13
|
+
_occurredErrors = /* @__PURE__ */ new Set();
|
|
14
|
+
showError(msg, max_log_level = LEVEL_NOTICE) {
|
|
15
|
+
const level = this._occurredErrors.has(msg) ? LEVEL_INFO : max_log_level;
|
|
16
|
+
this._log(msg, level);
|
|
17
|
+
if (!this._occurredErrors.has(msg)) {
|
|
18
|
+
this._occurredErrors.add(msg);
|
|
19
|
+
this.events.emitEvent(EVENT_ON_UNRESOLVED_ERROR);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
clearError(msg) {
|
|
23
|
+
if (!this._occurredErrors.has(msg)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this._occurredErrors.delete(msg);
|
|
27
|
+
this.events.emitEvent(EVENT_ON_UNRESOLVED_ERROR);
|
|
28
|
+
}
|
|
29
|
+
clearErrors() {
|
|
30
|
+
this._occurredErrors.clear();
|
|
31
|
+
this.events.emitEvent(EVENT_ON_UNRESOLVED_ERROR);
|
|
32
|
+
}
|
|
33
|
+
countErrors(needle) {
|
|
34
|
+
return Array.from(this._occurredErrors).filter(
|
|
35
|
+
(error) => typeof error === "string" && error.indexOf(needle) !== -1
|
|
36
|
+
).length;
|
|
37
|
+
}
|
|
38
|
+
_reportUnresolvedMessages() {
|
|
39
|
+
return Promise.resolve(Array.from(this._occurredErrors));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
UnresolvedErrorManager
|
|
44
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { FilePath } from "../../common/types.js";
|
|
2
|
+
import type { IAPIService, ISettingService, IVaultService } from "./IService.js";
|
|
3
|
+
import { ServiceBase, type ServiceContext } from "./ServiceBase.js";
|
|
4
|
+
export interface VaultServiceDependencies {
|
|
5
|
+
settingService: ISettingService;
|
|
6
|
+
APIService: IAPIService;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The VaultService provides methods for interacting with the vault (local file system).
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class VaultService<T extends ServiceContext = ServiceContext> extends ServiceBase<T> implements IVaultService {
|
|
12
|
+
protected settingService: ISettingService;
|
|
13
|
+
protected APIService: IAPIService;
|
|
14
|
+
get settings(): import("../../common/types.js").ObsidianLiveSyncSettings;
|
|
15
|
+
constructor(context: T, dependencies: VaultServiceDependencies);
|
|
16
|
+
/**
|
|
17
|
+
* Get the vault name only.
|
|
18
|
+
*/
|
|
19
|
+
vaultName(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the vault name with additional suffixes.
|
|
22
|
+
*/
|
|
23
|
+
getVaultName(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Scan the vault for changes (especially for changes during the plug-in were not running).
|
|
26
|
+
* @param showingNotice Whether to show a notice to the user.
|
|
27
|
+
* @param ignoreSuspending Whether to ignore any suspending state.
|
|
28
|
+
*/
|
|
29
|
+
readonly scanVault: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(showingNotice?: boolean, ignoreSuspending?: boolean) => Promise<boolean>>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a file is ignored by the ignore file (e.g., .gitignore, .obsidianignore).
|
|
32
|
+
* @param file The file path or file info stub to check.
|
|
33
|
+
*/
|
|
34
|
+
readonly isIgnoredByIgnoreFile: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(file: string | import("../../common/types.js").UXFileInfoStub) => Promise<boolean>>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a file is a target file for synchronisation.
|
|
37
|
+
* @param file The file path or file info stub to check.
|
|
38
|
+
* @param keepFileCheckList Whether to keep the file in the check list.
|
|
39
|
+
*/
|
|
40
|
+
readonly isTargetFile: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(file: string | import("../../common/types.js").UXFileInfoStub) => Promise<boolean>>;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a file is a target file for some extra feature
|
|
43
|
+
*/
|
|
44
|
+
readonly isTargetFileInExtra: import("../lib/HandlerUtils.js").BooleanMultipleHandlerFunction<(file: string | import("../../common/types.js").UXFileInfoStub) => Promise<boolean>>;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a filesize is too large against the current settings.
|
|
47
|
+
* @param size The file size to check.
|
|
48
|
+
*/
|
|
49
|
+
isFileSizeTooLarge(size: number): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get the currently active file path in the editor, if any.
|
|
52
|
+
*/
|
|
53
|
+
abstract getActiveFilePath(): FilePath | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Check if the vault is on a case-insensitive file system.
|
|
56
|
+
* This is important for certain operating systems like Windows and macOS.
|
|
57
|
+
*/
|
|
58
|
+
abstract isStorageInsensitive(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Check if the file system should be treated case-insensitively.
|
|
61
|
+
* This is important for certain operating systems like Windows and macOS.
|
|
62
|
+
*/
|
|
63
|
+
shouldCheckCaseInsensitively(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Check if a given path is valid in the vault.
|
|
66
|
+
* @param path The file path to check.
|
|
67
|
+
*/
|
|
68
|
+
abstract isValidPath(path: string): boolean;
|
|
69
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ServiceBase } from "./ServiceBase.js";
|
|
2
|
+
import { handlers } from "../lib/HandlerUtils.js";
|
|
3
|
+
class VaultService extends ServiceBase {
|
|
4
|
+
settingService;
|
|
5
|
+
APIService;
|
|
6
|
+
get settings() {
|
|
7
|
+
return this.settingService.currentSettings();
|
|
8
|
+
}
|
|
9
|
+
constructor(context, dependencies) {
|
|
10
|
+
super(context);
|
|
11
|
+
this.settingService = dependencies.settingService;
|
|
12
|
+
this.APIService = dependencies.APIService;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the vault name only.
|
|
16
|
+
*/
|
|
17
|
+
vaultName() {
|
|
18
|
+
return this.APIService.getSystemVaultName();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the vault name with additional suffixes.
|
|
22
|
+
*/
|
|
23
|
+
getVaultName() {
|
|
24
|
+
return this.vaultName() + (this.settings.additionalSuffixOfDatabaseName ? "-" + this.settings.additionalSuffixOfDatabaseName : "");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Scan the vault for changes (especially for changes during the plug-in were not running).
|
|
28
|
+
* @param showingNotice Whether to show a notice to the user.
|
|
29
|
+
* @param ignoreSuspending Whether to ignore any suspending state.
|
|
30
|
+
*/
|
|
31
|
+
scanVault = handlers().bailFirstFailure("scanVault");
|
|
32
|
+
/**
|
|
33
|
+
* Check if a file is ignored by the ignore file (e.g., .gitignore, .obsidianignore).
|
|
34
|
+
* @param file The file path or file info stub to check.
|
|
35
|
+
*/
|
|
36
|
+
isIgnoredByIgnoreFile = handlers().anySuccess("isIgnoredByIgnoreFile");
|
|
37
|
+
/**
|
|
38
|
+
* Check if a file is a target file for synchronisation.
|
|
39
|
+
* @param file The file path or file info stub to check.
|
|
40
|
+
* @param keepFileCheckList Whether to keep the file in the check list.
|
|
41
|
+
*/
|
|
42
|
+
isTargetFile = handlers().bailFirstFailure("isTargetFile");
|
|
43
|
+
/**
|
|
44
|
+
* Check if a file is a target file for some extra feature
|
|
45
|
+
*/
|
|
46
|
+
isTargetFileInExtra = handlers().anySuccess("isTargetFileInExtra");
|
|
47
|
+
/**
|
|
48
|
+
* Check if a filesize is too large against the current settings.
|
|
49
|
+
* @param size The file size to check.
|
|
50
|
+
*/
|
|
51
|
+
isFileSizeTooLarge(size) {
|
|
52
|
+
const maxSize = this.settings.syncMaxSizeInMB;
|
|
53
|
+
if (maxSize > 0 && size > 0) {
|
|
54
|
+
if (maxSize * 1024 * 1024 < size) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if the file system should be treated case-insensitively.
|
|
62
|
+
* This is important for certain operating systems like Windows and macOS.
|
|
63
|
+
*/
|
|
64
|
+
shouldCheckCaseInsensitively() {
|
|
65
|
+
return !this.settings.handleFilenameCaseSensitive;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
VaultService
|
|
70
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ConfigService } from "../../base/ConfigService.js";
|
|
2
|
+
import type { AppLifecycleService } from "../../base/AppLifecycleService.js";
|
|
3
|
+
import type { ReplicatorService } from "../../base/ReplicatorService.js";
|
|
4
|
+
import type { Confirm } from "../../../interfaces/Confirm.js";
|
|
5
|
+
import { type Component } from "svelte";
|
|
6
|
+
import type { ServiceContext } from "../../base/ServiceBase.js";
|
|
7
|
+
import type { IControlService } from "../../base/IService.js";
|
|
8
|
+
import type { Constructor } from "../../../common/utils.type.js";
|
|
9
|
+
export type SvelteDialogManagerDependencies<T extends ServiceContext = ServiceContext> = {
|
|
10
|
+
appLifecycle: AppLifecycleService<T>;
|
|
11
|
+
replicator: ReplicatorService<T>;
|
|
12
|
+
config: ConfigService<T>;
|
|
13
|
+
confirm: Confirm;
|
|
14
|
+
control: IControlService;
|
|
15
|
+
};
|
|
16
|
+
export type HasSetResult<T> = {
|
|
17
|
+
setResult: (result: T) => void;
|
|
18
|
+
};
|
|
19
|
+
export type HasGetInitialData<T> = {
|
|
20
|
+
getInitialData?: () => T | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type ComponentHasResult<T, U> = Component<HasSetResult<T> & HasGetInitialData<U>>;
|
|
23
|
+
export type GuestDialogProps<T, U> = HasSetResult<T> & HasGetInitialData<U>;
|
|
24
|
+
export type DialogSvelteComponentBaseProps<T, U> = {
|
|
25
|
+
setTitle: (title: string) => void;
|
|
26
|
+
closeDialog: () => void;
|
|
27
|
+
} & HasSetResult<T> & HasGetInitialData<U>;
|
|
28
|
+
export type DialogControlBase<T, U> = {
|
|
29
|
+
setTitle: (title: string) => void;
|
|
30
|
+
closeDialog: () => void;
|
|
31
|
+
} & HasSetResult<T> & HasGetInitialData<U>;
|
|
32
|
+
export type DialogHostProps<T = any, U = any> = DialogSvelteComponentBaseProps<T, U> & {
|
|
33
|
+
/**
|
|
34
|
+
* The Svelte component to mount inside the dialog host
|
|
35
|
+
*/
|
|
36
|
+
mountComponent: ComponentHasResult<T, U>;
|
|
37
|
+
/**
|
|
38
|
+
* Callback function to setup the dialog context
|
|
39
|
+
* @param props
|
|
40
|
+
*/
|
|
41
|
+
onSetupContext?(props: DialogSvelteComponentBaseProps<T, U>): void;
|
|
42
|
+
};
|
|
43
|
+
export type DialogContext<C extends ServiceContext = ServiceContext, T = any, U = any> = DialogControlBase<T, U> & {
|
|
44
|
+
context: C;
|
|
45
|
+
services: SvelteDialogManagerDependencies<C>;
|
|
46
|
+
};
|
|
47
|
+
export interface SvelteDialogManager<T extends ServiceContext> {
|
|
48
|
+
open<TResult, TInitial = TResult>(component: ComponentHasResult<TResult, TInitial>, initialData?: TInitial): Promise<TResult | undefined>;
|
|
49
|
+
openWithExplicitCancel<TResult, TInitial = TResult>(component: ComponentHasResult<TResult, TInitial>, initialData?: TInitial): Promise<TResult>;
|
|
50
|
+
}
|
|
51
|
+
export declare const CONTEXT_DIALOG_CONTROLS = "svelte-dialog-controls";
|
|
52
|
+
export declare function setupDialogContext<T extends DialogContext>(controls: T): void;
|
|
53
|
+
export declare function getDialogContext<T = unknown, U = unknown>(): DialogContext<ServiceContext, T, U>;
|
|
54
|
+
export interface IModalBase {
|
|
55
|
+
contentEl: HTMLElement;
|
|
56
|
+
close(): void;
|
|
57
|
+
setTitle(title: string): void;
|
|
58
|
+
onOpen(): void;
|
|
59
|
+
onClose(): void;
|
|
60
|
+
open(): void;
|
|
61
|
+
}
|
|
62
|
+
export interface SvelteDialogInstance<T, U, C extends ServiceContext = ServiceContext> extends IModalBase {
|
|
63
|
+
initDialog(context: C, dependents: SvelteDialogManagerDependencies<C>, component: ComponentHasResult<T, U>, initialData?: U): void;
|
|
64
|
+
waitForClose(): Promise<T | undefined>;
|
|
65
|
+
}
|
|
66
|
+
export type SvelteDialogClass<TBase extends Constructor<IModalBase>> = {
|
|
67
|
+
new <T, U, C extends ServiceContext = ServiceContext>(...args: ConstructorParameters<TBase>): SvelteDialogInstance<T, U, C>;
|
|
68
|
+
};
|
|
69
|
+
export declare function SvelteDialogMixIn<TBase extends Constructor<IModalBase>>(TBase: TBase, d: Component<DialogHostProps>): SvelteDialogClass<TBase>;
|
|
70
|
+
export declare abstract class SvelteDialogManagerBase<T extends ServiceContext> implements SvelteDialogManager<T> {
|
|
71
|
+
abstract openSvelteDialog<T, U = T>(component: ComponentHasResult<T, U>, initialData?: U): Promise<T | undefined>;
|
|
72
|
+
protected _context: T;
|
|
73
|
+
protected _dependents: SvelteDialogManagerDependencies<T>;
|
|
74
|
+
get context(): T;
|
|
75
|
+
get dependents(): SvelteDialogManagerDependencies<T>;
|
|
76
|
+
constructor(c: T, dependents: SvelteDialogManagerDependencies<T>);
|
|
77
|
+
open<T, U = T>(component: ComponentHasResult<T, U>, initialData?: U): Promise<T | undefined>;
|
|
78
|
+
openWithExplicitCancel<T, U = T>(component: ComponentHasResult<T, U>, initialData?: U): Promise<T>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getContext, mount, setContext, unmount } from "svelte";
|
|
2
|
+
import { LOG_LEVEL_NOTICE, Logger } from "../../../common/logger.js";
|
|
3
|
+
import { fireAndForget, promiseWithResolvers } from "octagonal-wheels/promises";
|
|
4
|
+
import { EVENT_PLUGIN_UNLOADED } from "../../../events/coreEvents.js";
|
|
5
|
+
const CONTEXT_DIALOG_CONTROLS = "svelte-dialog-controls";
|
|
6
|
+
function setupDialogContext(controls) {
|
|
7
|
+
setContext(CONTEXT_DIALOG_CONTROLS, controls);
|
|
8
|
+
}
|
|
9
|
+
function getDialogContext() {
|
|
10
|
+
return getContext(CONTEXT_DIALOG_CONTROLS);
|
|
11
|
+
}
|
|
12
|
+
function SvelteDialogMixIn(TBase, d) {
|
|
13
|
+
const SvelteDialog = class SvelteDialog extends TBase {
|
|
14
|
+
constructor(...args) {
|
|
15
|
+
super(...args);
|
|
16
|
+
}
|
|
17
|
+
// plugin: ObsidianLiveSyncPlugin;
|
|
18
|
+
_context;
|
|
19
|
+
get context() {
|
|
20
|
+
return this._context;
|
|
21
|
+
}
|
|
22
|
+
dependents;
|
|
23
|
+
mountedComponent;
|
|
24
|
+
component;
|
|
25
|
+
result;
|
|
26
|
+
initialData;
|
|
27
|
+
title = "Self-hosted LiveSync - Setup Wizard";
|
|
28
|
+
initDialog(context, dependents, component, initialData) {
|
|
29
|
+
this._context = context;
|
|
30
|
+
this.dependents = dependents;
|
|
31
|
+
this.component = component;
|
|
32
|
+
this.initialData = initialData;
|
|
33
|
+
}
|
|
34
|
+
resolveResult() {
|
|
35
|
+
this.resultPromiseWithResolvers?.resolve(this.result);
|
|
36
|
+
this.resultPromiseWithResolvers = void 0;
|
|
37
|
+
}
|
|
38
|
+
resultPromiseWithResolvers;
|
|
39
|
+
onOpen() {
|
|
40
|
+
const { contentEl } = this;
|
|
41
|
+
contentEl.replaceChildren();
|
|
42
|
+
const dialog = this;
|
|
43
|
+
if (this.resultPromiseWithResolvers) {
|
|
44
|
+
this.resultPromiseWithResolvers.reject("Dialog opened again");
|
|
45
|
+
}
|
|
46
|
+
const pr = promiseWithResolvers();
|
|
47
|
+
this.context.events.once(EVENT_PLUGIN_UNLOADED, () => {
|
|
48
|
+
if (this.resultPromiseWithResolvers === pr) {
|
|
49
|
+
pr.reject("Plugin unloaded");
|
|
50
|
+
this.close();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.resultPromiseWithResolvers = pr;
|
|
54
|
+
this.mountedComponent = mount(d, {
|
|
55
|
+
target: contentEl,
|
|
56
|
+
props: {
|
|
57
|
+
onSetupContext: (props) => {
|
|
58
|
+
setupDialogContext({
|
|
59
|
+
...props,
|
|
60
|
+
context: this.context,
|
|
61
|
+
services: this.dependents
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
setTitle: (title) => {
|
|
65
|
+
dialog.setTitle(title);
|
|
66
|
+
},
|
|
67
|
+
closeDialog: () => {
|
|
68
|
+
dialog.close();
|
|
69
|
+
},
|
|
70
|
+
setResult: (result) => {
|
|
71
|
+
this.result = result;
|
|
72
|
+
},
|
|
73
|
+
getInitialData: () => this.initialData,
|
|
74
|
+
mountComponent: this.component
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
waitForClose() {
|
|
79
|
+
if (!this.resultPromiseWithResolvers) {
|
|
80
|
+
throw new Error("Dialog not opened yet");
|
|
81
|
+
}
|
|
82
|
+
return this.resultPromiseWithResolvers.promise;
|
|
83
|
+
}
|
|
84
|
+
onClose() {
|
|
85
|
+
this.resolveResult();
|
|
86
|
+
fireAndForget(async () => {
|
|
87
|
+
if (this.mountedComponent) {
|
|
88
|
+
await unmount(this.mountedComponent);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return SvelteDialog;
|
|
94
|
+
}
|
|
95
|
+
class SvelteDialogManagerBase {
|
|
96
|
+
_context;
|
|
97
|
+
_dependents;
|
|
98
|
+
get context() {
|
|
99
|
+
return this._context;
|
|
100
|
+
}
|
|
101
|
+
get dependents() {
|
|
102
|
+
return this._dependents;
|
|
103
|
+
}
|
|
104
|
+
constructor(c, dependents) {
|
|
105
|
+
this._context = c;
|
|
106
|
+
this._dependents = dependents;
|
|
107
|
+
}
|
|
108
|
+
async open(component, initialData) {
|
|
109
|
+
return await this.openSvelteDialog(component, initialData);
|
|
110
|
+
}
|
|
111
|
+
async openWithExplicitCancel(component, initialData) {
|
|
112
|
+
for (let i = 0; i < 10; i++) {
|
|
113
|
+
const ret = await this.openSvelteDialog(component, initialData);
|
|
114
|
+
if (ret !== void 0) {
|
|
115
|
+
return ret;
|
|
116
|
+
}
|
|
117
|
+
if (this.dependents.control.hasUnloaded()) {
|
|
118
|
+
throw new Error("Operation cancelled due to app shutdown.");
|
|
119
|
+
}
|
|
120
|
+
Logger(
|
|
121
|
+
this.context.translate("Please select 'Cancel' explicitly to cancel this operation."),
|
|
122
|
+
LOG_LEVEL_NOTICE
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
throw new Error("Operation Forcibly cancelled by user.");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
CONTEXT_DIALOG_CONTROLS,
|
|
130
|
+
SvelteDialogManagerBase,
|
|
131
|
+
SvelteDialogMixIn,
|
|
132
|
+
getDialogContext,
|
|
133
|
+
setupDialogContext
|
|
134
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Confirm } from "../../../interfaces/Confirm.js";
|
|
2
|
+
import type { ComponentHasResult, SvelteDialogManager } from "./SvelteDialog.js";
|
|
3
|
+
import type { IAPIService, IUIService } from "../../base/IService.js";
|
|
4
|
+
import { ServiceBase, type ServiceContext } from "../../base/ServiceBase.js";
|
|
5
|
+
export type UIServiceDependencies<T extends ServiceContext = ServiceContext> = {
|
|
6
|
+
dialogManager: SvelteDialogManager<T>;
|
|
7
|
+
APIService: IAPIService;
|
|
8
|
+
};
|
|
9
|
+
type DialogResult = "ok" | "cancel";
|
|
10
|
+
type DialogParams = {
|
|
11
|
+
title: string;
|
|
12
|
+
dataToCopy: string;
|
|
13
|
+
};
|
|
14
|
+
export declare abstract class UIService<T extends ServiceContext = ServiceContext> extends ServiceBase<T> implements IUIService {
|
|
15
|
+
private _dialogManager;
|
|
16
|
+
protected _APIService: IAPIService;
|
|
17
|
+
abstract get dialogToCopy(): ComponentHasResult<DialogResult, DialogParams>;
|
|
18
|
+
constructor(context: T, dependents: UIServiceDependencies<T>);
|
|
19
|
+
get dialogManager(): SvelteDialogManager<T>;
|
|
20
|
+
promptCopyToClipboard(title: string, value: string): Promise<boolean>;
|
|
21
|
+
showMarkdownDialog<T extends string[]>(title: string, contentMD: string, buttons: T, defaultAction?: (typeof buttons)[number]): Promise<(typeof buttons)[number] | false>;
|
|
22
|
+
get confirm(): Confirm;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ServiceBase } from "../../base/ServiceBase.js";
|
|
2
|
+
class UIService extends ServiceBase {
|
|
3
|
+
_dialogManager;
|
|
4
|
+
_APIService;
|
|
5
|
+
constructor(context, dependents) {
|
|
6
|
+
super(context);
|
|
7
|
+
this._dialogManager = dependents.dialogManager;
|
|
8
|
+
this._APIService = dependents.APIService;
|
|
9
|
+
}
|
|
10
|
+
get dialogManager() {
|
|
11
|
+
return this._dialogManager;
|
|
12
|
+
}
|
|
13
|
+
async promptCopyToClipboard(title, value) {
|
|
14
|
+
const param = {
|
|
15
|
+
title,
|
|
16
|
+
dataToCopy: value
|
|
17
|
+
};
|
|
18
|
+
const result = await this._dialogManager.open(this.dialogToCopy, param);
|
|
19
|
+
if (result !== "ok") {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
showMarkdownDialog(title, contentMD, buttons, defaultAction) {
|
|
25
|
+
return this._APIService.confirm.askSelectStringDialogue(contentMD, buttons, {
|
|
26
|
+
title,
|
|
27
|
+
defaultAction: defaultAction ?? buttons[0],
|
|
28
|
+
timeout: 0
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
get confirm() {
|
|
32
|
+
return this._APIService.confirm;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
UIService
|
|
37
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ServiceContext } from "../../base/ServiceBase.js";
|
|
2
|
+
import { InjectableAPIService } from "../injectable/InjectableAPIService.js";
|
|
3
|
+
import type { FetchHttpHandler } from "@smithy/fetch-http-handler";
|
|
4
|
+
import type { ICommandCompat } from "../../base/IService.js";
|
|
5
|
+
import type { Confirm } from "../../../interfaces/Confirm.js";
|
|
6
|
+
export declare const PACKAGE_VERSION: string;
|
|
7
|
+
export declare const MANIFEST_VERSION: string;
|
|
8
|
+
export type BrowserAPIServiceDependencies = {
|
|
9
|
+
confirm: Confirm;
|
|
10
|
+
};
|
|
11
|
+
export declare class BrowserAPIService<T extends ServiceContext> extends InjectableAPIService<T> {
|
|
12
|
+
_confirmInstance: Confirm;
|
|
13
|
+
private commandBar;
|
|
14
|
+
private commandButtons;
|
|
15
|
+
private logPanel;
|
|
16
|
+
private logViewport;
|
|
17
|
+
private readonly maxLogLines;
|
|
18
|
+
private windowFactories;
|
|
19
|
+
private windowInstances;
|
|
20
|
+
private windowRoot;
|
|
21
|
+
private windowTabs;
|
|
22
|
+
private windowBody;
|
|
23
|
+
private windowPanels;
|
|
24
|
+
private activeWindowType;
|
|
25
|
+
constructor(context: T, dependencies: BrowserAPIServiceDependencies);
|
|
26
|
+
get confirm(): Confirm;
|
|
27
|
+
showWindow(type: string): Promise<void>;
|
|
28
|
+
getCustomFetchHandler(): FetchHttpHandler;
|
|
29
|
+
isMobile(): boolean;
|
|
30
|
+
getAppID(): string;
|
|
31
|
+
getSystemVaultName: import("../../lib/HandlerUtils.js").HandlerFunction<() => string, unknown>;
|
|
32
|
+
getAppVersion(): string;
|
|
33
|
+
getPluginVersion(): string;
|
|
34
|
+
getPlatform(): string;
|
|
35
|
+
getCrypto(): Crypto;
|
|
36
|
+
nativeFetch(req: string | Request, opts?: RequestInit): Promise<Response>;
|
|
37
|
+
private ensureLogPanel;
|
|
38
|
+
private formatLogLine;
|
|
39
|
+
private appendLog;
|
|
40
|
+
private ensureCommandBar;
|
|
41
|
+
private ensureWindowHost;
|
|
42
|
+
private ensureWindowTab;
|
|
43
|
+
private ensureWindowPanel;
|
|
44
|
+
private activateWindow;
|
|
45
|
+
private createLeafShim;
|
|
46
|
+
private evaluateEnabled;
|
|
47
|
+
private executeCommand;
|
|
48
|
+
private refreshCommandStates;
|
|
49
|
+
addCommand<TCommand extends ICommandCompat>(command: TCommand): TCommand;
|
|
50
|
+
addRibbonIcon(icon: string, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
|
|
51
|
+
registerWindow(type: string, factory: (leaf: any) => any): void;
|
|
52
|
+
registerProtocolHandler(action: string, handler: (params: Record<string, string>) => any): void;
|
|
53
|
+
addStatusBarItem(): HTMLElement | undefined;
|
|
54
|
+
}
|