@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,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focused compatibility views of the existing storage adapter.
|
|
3
|
+
*
|
|
4
|
+
* These interfaces allow internal consumers to depend on fewer operations while
|
|
5
|
+
* retaining the existing `UXStat`, `UXDataWriteOptions`, and method semantics.
|
|
6
|
+
* They are not a neutral or extraction-ready storage API. Their names, shared
|
|
7
|
+
* types, and behavioural contracts may change when the cross-platform contract
|
|
8
|
+
* is designed and stabilised.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import type { UXDataWriteOptions, UXStat } from "../../common/types.js";
|
|
13
|
+
/** File and directory existence and metadata operations. */
|
|
14
|
+
export interface IStorageMetadataAccess<TStat extends UXStat = UXStat> {
|
|
15
|
+
exists(path: string): Promise<boolean>;
|
|
16
|
+
trystat(path: string): Promise<TStat | null>;
|
|
17
|
+
stat(path: string): Promise<TStat | null>;
|
|
18
|
+
}
|
|
19
|
+
/** Text-file read operation. */
|
|
20
|
+
export interface IStorageTextReadAccess {
|
|
21
|
+
read(path: string): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
/** Binary-file read operation. */
|
|
24
|
+
export interface IStorageBinaryReadAccess {
|
|
25
|
+
readBinary(path: string): Promise<ArrayBuffer>;
|
|
26
|
+
}
|
|
27
|
+
/** Text-file write operation. */
|
|
28
|
+
export interface IStorageTextWriteAccess {
|
|
29
|
+
write(path: string, data: string, options?: UXDataWriteOptions): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** Binary-file write operation. */
|
|
32
|
+
export interface IStorageBinaryWriteAccess {
|
|
33
|
+
writeBinary(path: string, data: ArrayBuffer, options?: UXDataWriteOptions): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/** Text-file append operation. */
|
|
36
|
+
export interface IStorageTextAppendAccess {
|
|
37
|
+
append(path: string, data: string, options?: UXDataWriteOptions): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/** Directory creation and direct-child listing operations. */
|
|
40
|
+
export interface IStorageDirectoryAccess {
|
|
41
|
+
mkdir(path: string): Promise<void>;
|
|
42
|
+
list(basePath: string): Promise<{
|
|
43
|
+
files: string[];
|
|
44
|
+
folders: string[];
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/** File or directory removal operation. */
|
|
48
|
+
export interface IStorageRemoveAccess {
|
|
49
|
+
remove(path: string): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Storage adapter interface
|
|
53
|
+
* Backwards-compatible aggregate of the focused storage capability views.
|
|
54
|
+
*/
|
|
55
|
+
export interface IStorageAdapter<TStat extends UXStat = UXStat> extends IStorageMetadataAccess<TStat>, IStorageTextReadAccess, IStorageBinaryReadAccess, IStorageTextWriteAccess, IStorageBinaryWriteAccess, IStorageTextAppendAccess, IStorageDirectoryAccess, IStorageRemoveAccess {
|
|
56
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard adapter interface
|
|
3
|
+
* Provides runtime type checking for native file system objects
|
|
4
|
+
*/
|
|
5
|
+
export interface ITypeGuardAdapter<TNativeFile = unknown, TNativeFolder = unknown> {
|
|
6
|
+
/**
|
|
7
|
+
* Check if the given object is a file
|
|
8
|
+
*/
|
|
9
|
+
isFile(file: unknown): file is TNativeFile;
|
|
10
|
+
/**
|
|
11
|
+
* Check if the given object is a folder
|
|
12
|
+
*/
|
|
13
|
+
isFolder(item: unknown): item is TNativeFolder;
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { UXDataWriteOptions } from "../../common/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Vault adapter interface
|
|
4
|
+
* High-level file operations that interact with the vault layer
|
|
5
|
+
*/
|
|
6
|
+
export interface IVaultAdapter<TNativeFile = unknown, TNativeFolder = unknown> {
|
|
7
|
+
/**
|
|
8
|
+
* Read a file as text
|
|
9
|
+
*/
|
|
10
|
+
read(file: TNativeFile): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Read a file using cached content if available
|
|
13
|
+
*/
|
|
14
|
+
cachedRead(file: TNativeFile): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Read a file as binary
|
|
17
|
+
*/
|
|
18
|
+
readBinary(file: TNativeFile): Promise<ArrayBuffer>;
|
|
19
|
+
/**
|
|
20
|
+
* Modify an existing file with text content
|
|
21
|
+
*/
|
|
22
|
+
modify(file: TNativeFile, data: string, options?: UXDataWriteOptions): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Modify an existing file with binary content
|
|
25
|
+
*/
|
|
26
|
+
modifyBinary(file: TNativeFile, data: ArrayBuffer, options?: UXDataWriteOptions): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new file with text content
|
|
29
|
+
*/
|
|
30
|
+
create(path: string, data: string, options?: UXDataWriteOptions): Promise<TNativeFile>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new file with binary content
|
|
33
|
+
*/
|
|
34
|
+
createBinary(path: string, data: ArrayBuffer, options?: UXDataWriteOptions): Promise<TNativeFile>;
|
|
35
|
+
/**
|
|
36
|
+
* Rename or move an existing file
|
|
37
|
+
*/
|
|
38
|
+
rename(file: TNativeFile, newPath: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a file or folder
|
|
41
|
+
*/
|
|
42
|
+
delete(file: TNativeFile | TNativeFolder, force?: boolean): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Move a file or folder to trash
|
|
45
|
+
*/
|
|
46
|
+
trash(file: TNativeFile | TNativeFolder, force?: boolean): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Trigger an event in the vault
|
|
49
|
+
*/
|
|
50
|
+
trigger(name: string, ...data: unknown[]): void;
|
|
51
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { IPathAdapter } from "./IPathAdapter.js";
|
|
2
|
+
export type { ITypeGuardAdapter } from "./ITypeGuardAdapter.js";
|
|
3
|
+
export type { IConversionAdapter } from "./IConversionAdapter.js";
|
|
4
|
+
export type { IStorageAdapter, IStorageBinaryReadAccess, IStorageBinaryWriteAccess, IStorageDirectoryAccess, IStorageMetadataAccess, IStorageRemoveAccess, IStorageTextAppendAccess, IStorageTextReadAccess, IStorageTextWriteAccess, } from "./IStorageAdapter.js";
|
|
5
|
+
export type { IVaultAdapter } from "./IVaultAdapter.js";
|
|
6
|
+
export type { IFileSystemAdapter } from "./IFileSystemAdapter.js";
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InjectableVaultServiceCompat } from "./implements/injectable/InjectableVaultService.js";
|
|
2
|
+
import { ServiceContext } from "./base/ServiceBase.js";
|
|
3
|
+
import { InjectableServiceHub } from "./implements/injectable/InjectableServiceHub.js";
|
|
4
|
+
import { ControlService } from "./base/ControlService.js";
|
|
5
|
+
import type { AppLifecycleService } from "./base/AppLifecycleService.js";
|
|
6
|
+
import type { ConfigService } from "./base/ConfigService.js";
|
|
7
|
+
import type { ReplicatorService } from "./base/ReplicatorService.js";
|
|
8
|
+
import type { UIService } from "./implements/base/UIService.js";
|
|
9
|
+
import type { InjectableAPIService } from "./implements/injectable/InjectableAPIService.js";
|
|
10
|
+
import type { KeyValueDatabaseFactory } from "../interfaces/KeyValueDatabase.js";
|
|
11
|
+
export type BrowserServiceHostDependencies<T extends ServiceContext> = {
|
|
12
|
+
API: InjectableAPIService<T>;
|
|
13
|
+
appLifecycle: AppLifecycleService<T>;
|
|
14
|
+
config: ConfigService<T>;
|
|
15
|
+
control: ControlService<T>;
|
|
16
|
+
replicator: ReplicatorService<T>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Host-owned presentation services used by the browser composition.
|
|
20
|
+
*
|
|
21
|
+
* Commonlib owns the data and replication composition, while the application
|
|
22
|
+
* chooses its confirmation, dialogue, and other presentation behaviour.
|
|
23
|
+
*/
|
|
24
|
+
export interface BrowserServiceHost<T extends ServiceContext> {
|
|
25
|
+
createAPI(context: T): InjectableAPIService<T>;
|
|
26
|
+
createUI(context: T, dependencies: BrowserServiceHostDependencies<T>): UIService<T>;
|
|
27
|
+
}
|
|
28
|
+
export type BrowserServiceHubOptions<T extends ServiceContext> = {
|
|
29
|
+
context?: T;
|
|
30
|
+
host: BrowserServiceHost<T>;
|
|
31
|
+
openKeyValueDatabase?: KeyValueDatabaseFactory;
|
|
32
|
+
};
|
|
33
|
+
export declare class BrowserServiceHub<T extends ServiceContext> extends InjectableServiceHub<T> {
|
|
34
|
+
get vault(): InjectableVaultServiceCompat<T>;
|
|
35
|
+
constructor(options: BrowserServiceHubOptions<T>);
|
|
36
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { InjectableAppLifecycleService } from "./implements/injectable/InjectableAppLifecycleService.js";
|
|
2
|
+
import { InjectableConflictService } from "./implements/injectable/InjectableConflictService.js";
|
|
3
|
+
import { InjectableDatabaseEventService } from "./implements/injectable/InjectableDatabaseEventService.js";
|
|
4
|
+
import { InjectableFileProcessingService } from "./implements/injectable/InjectableFileProcessingService.js";
|
|
5
|
+
import { PathServiceCompat } from "./implements/injectable/InjectablePathService.js";
|
|
6
|
+
import { InjectableRemoteService } from "./implements/injectable/InjectableRemoteService.js";
|
|
7
|
+
import { InjectableReplicationService } from "./implements/injectable/InjectableReplicationService.js";
|
|
8
|
+
import { InjectableReplicatorService } from "./implements/injectable/InjectableReplicatorService.js";
|
|
9
|
+
import { InjectableSettingService } from "./implements/injectable/InjectableSettingService.js";
|
|
10
|
+
import { InjectableTestService } from "./implements/injectable/InjectableTestService.js";
|
|
11
|
+
import { InjectableTweakValueService } from "./implements/injectable/InjectableTweakValueService.js";
|
|
12
|
+
import { InjectableVaultServiceCompat } from "./implements/injectable/InjectableVaultService.js";
|
|
13
|
+
import { ServiceContext } from "./base/ServiceBase.js";
|
|
14
|
+
import { ConfigServiceBrowserCompat } from "./implements/browser/ConfigServiceBrowserCompat.js";
|
|
15
|
+
import { InjectableServiceHub } from "./implements/injectable/InjectableServiceHub.js";
|
|
16
|
+
import { BrowserDatabaseService, BrowserKeyValueDBService } from "./implements/browser/BrowserDatabaseService.js";
|
|
17
|
+
import { ControlService } from "./base/ControlService.js";
|
|
18
|
+
import { createIndexedDBKeyValueDatabaseFactory } from "../databases/IndexedDBKeyValueDatabase.js";
|
|
19
|
+
import { PouchDB } from "../pouchdb/pouchdb-browser.js";
|
|
20
|
+
class BrowserAppLifecycleService extends InjectableAppLifecycleService {
|
|
21
|
+
constructor(context, dependencies) {
|
|
22
|
+
super(context, dependencies);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class BrowserServiceHub extends InjectableServiceHub {
|
|
26
|
+
// get vault():InjectableVaultServiceCompat<T>;
|
|
27
|
+
get vault() {
|
|
28
|
+
return this._vault;
|
|
29
|
+
}
|
|
30
|
+
constructor(options) {
|
|
31
|
+
const context = options.context ?? new ServiceContext();
|
|
32
|
+
const API = options.host.createAPI(context);
|
|
33
|
+
const conflict = new InjectableConflictService(context);
|
|
34
|
+
const fileProcessing = new InjectableFileProcessingService(context);
|
|
35
|
+
const setting = new InjectableSettingService(context, { APIService: API });
|
|
36
|
+
const appLifecycle = new BrowserAppLifecycleService(context, { settingService: setting });
|
|
37
|
+
const remote = new InjectableRemoteService(context, {
|
|
38
|
+
pouchDB: PouchDB,
|
|
39
|
+
APIService: API,
|
|
40
|
+
appLifecycle,
|
|
41
|
+
setting
|
|
42
|
+
});
|
|
43
|
+
const tweakValue = new InjectableTweakValueService(context);
|
|
44
|
+
const vault = new InjectableVaultServiceCompat(context, {
|
|
45
|
+
settingService: setting,
|
|
46
|
+
APIService: API
|
|
47
|
+
});
|
|
48
|
+
const test = new InjectableTestService(context);
|
|
49
|
+
const databaseEvents = new InjectableDatabaseEventService(context);
|
|
50
|
+
const path = new PathServiceCompat(context, {
|
|
51
|
+
settingService: setting
|
|
52
|
+
});
|
|
53
|
+
const database = new BrowserDatabaseService(context, {
|
|
54
|
+
pouchDB: PouchDB,
|
|
55
|
+
path,
|
|
56
|
+
vault,
|
|
57
|
+
setting,
|
|
58
|
+
API
|
|
59
|
+
});
|
|
60
|
+
const config = new ConfigServiceBrowserCompat(context, {
|
|
61
|
+
settingService: setting,
|
|
62
|
+
APIService: API
|
|
63
|
+
});
|
|
64
|
+
const replicator = new InjectableReplicatorService(context, {
|
|
65
|
+
settingService: setting,
|
|
66
|
+
appLifecycleService: appLifecycle,
|
|
67
|
+
databaseEventService: databaseEvents
|
|
68
|
+
});
|
|
69
|
+
const replication = new InjectableReplicationService(context, {
|
|
70
|
+
APIService: API,
|
|
71
|
+
appLifecycleService: appLifecycle,
|
|
72
|
+
replicatorService: replicator,
|
|
73
|
+
settingService: setting,
|
|
74
|
+
fileProcessingService: fileProcessing,
|
|
75
|
+
databaseService: database
|
|
76
|
+
});
|
|
77
|
+
const keyValueDB = new BrowserKeyValueDBService(context, {
|
|
78
|
+
openKeyValueDatabase: options.openKeyValueDatabase ?? createIndexedDBKeyValueDatabaseFactory(),
|
|
79
|
+
appLifecycle,
|
|
80
|
+
databaseEvents,
|
|
81
|
+
vault
|
|
82
|
+
});
|
|
83
|
+
const control = new ControlService(context, {
|
|
84
|
+
appLifecycleService: appLifecycle,
|
|
85
|
+
databaseService: database,
|
|
86
|
+
fileProcessingService: fileProcessing,
|
|
87
|
+
settingService: setting,
|
|
88
|
+
APIService: API,
|
|
89
|
+
replicatorService: replicator
|
|
90
|
+
});
|
|
91
|
+
const ui = options.host.createUI(context, {
|
|
92
|
+
API,
|
|
93
|
+
appLifecycle,
|
|
94
|
+
config,
|
|
95
|
+
control,
|
|
96
|
+
replicator
|
|
97
|
+
});
|
|
98
|
+
const serviceInstancesToInit = {
|
|
99
|
+
appLifecycle,
|
|
100
|
+
conflict,
|
|
101
|
+
database,
|
|
102
|
+
databaseEvents,
|
|
103
|
+
fileProcessing,
|
|
104
|
+
replication,
|
|
105
|
+
replicator,
|
|
106
|
+
remote,
|
|
107
|
+
setting,
|
|
108
|
+
tweakValue,
|
|
109
|
+
vault,
|
|
110
|
+
test,
|
|
111
|
+
ui,
|
|
112
|
+
path,
|
|
113
|
+
API,
|
|
114
|
+
config,
|
|
115
|
+
keyValueDB,
|
|
116
|
+
control
|
|
117
|
+
};
|
|
118
|
+
super(context, serviceInstancesToInit);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
BrowserServiceHub
|
|
123
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ServiceContext } from "./base/ServiceBase.js";
|
|
2
|
+
import { InjectableServiceHub } from "./implements/injectable/InjectableServiceHub.js";
|
|
3
|
+
import type { DatabaseService } from "./base/DatabaseService.js";
|
|
4
|
+
import type { Constructor } from "../common/utils.type.js";
|
|
5
|
+
import type { KeyValueDatabaseFactory } from "../interfaces/KeyValueDatabase.js";
|
|
6
|
+
import type { PouchDBConstructor } from "../pouchdb/PouchDBConstructor.js";
|
|
7
|
+
export declare class HeadlessServiceHub<T extends ServiceContext> extends InjectableServiceHub<T> {
|
|
8
|
+
constructor(_context: T | undefined, overrideServiceConstructor: {
|
|
9
|
+
/** PouchDB with the adapters required by this headless runtime. */
|
|
10
|
+
pouchDB: PouchDBConstructor;
|
|
11
|
+
database?: Constructor<DatabaseService<T>>;
|
|
12
|
+
openKeyValueDatabase?: KeyValueDatabaseFactory;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {} from "./base/AppLifecycleService.js";
|
|
2
|
+
import { InjectableAppLifecycleService } from "./implements/injectable/InjectableAppLifecycleService.js";
|
|
3
|
+
import { InjectableConflictService } from "./implements/injectable/InjectableConflictService.js";
|
|
4
|
+
import { InjectableDatabaseEventService } from "./implements/injectable/InjectableDatabaseEventService.js";
|
|
5
|
+
import { InjectableFileProcessingService } from "./implements/injectable/InjectableFileProcessingService.js";
|
|
6
|
+
import { PathServiceCompat } from "./implements/injectable/InjectablePathService.js";
|
|
7
|
+
import { InjectableRemoteService } from "./implements/injectable/InjectableRemoteService.js";
|
|
8
|
+
import { InjectableReplicationService } from "./implements/injectable/InjectableReplicationService.js";
|
|
9
|
+
import { InjectableReplicatorService } from "./implements/injectable/InjectableReplicatorService.js";
|
|
10
|
+
import { InjectableTestService } from "./implements/injectable/InjectableTestService.js";
|
|
11
|
+
import { InjectableTweakValueService } from "./implements/injectable/InjectableTweakValueService.js";
|
|
12
|
+
import { InjectableVaultServiceCompat } from "./implements/injectable/InjectableVaultService.js";
|
|
13
|
+
import { ServiceContext } from "./base/ServiceBase.js";
|
|
14
|
+
import { ConfigServiceBrowserCompat } from "./implements/browser/ConfigServiceBrowserCompat.js";
|
|
15
|
+
import { InjectableServiceHub } from "./implements/injectable/InjectableServiceHub.js";
|
|
16
|
+
import { UIService } from "./implements/base/UIService.js";
|
|
17
|
+
import { HeadlessAPIService } from "./implements/headless/HeadlessAPIService.js";
|
|
18
|
+
import { HeadlessDatabaseService, HeadlessKeyValueDBService } from "./implements/headless/HeadlessDatabaseService.js";
|
|
19
|
+
import { ControlService } from "./base/ControlService.js";
|
|
20
|
+
import { InjectableSettingService } from "./implements/injectable/InjectableSettingService.js";
|
|
21
|
+
import { createIndexedDBKeyValueDatabaseFactory } from "../databases/IndexedDBKeyValueDatabase.js";
|
|
22
|
+
class HeadlessAppLifecycleService extends InjectableAppLifecycleService {
|
|
23
|
+
constructor(context, dependencies) {
|
|
24
|
+
super(context, dependencies);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class HeadlessSvelteDialogManager {
|
|
28
|
+
openSvelteDialog(component, initialData) {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
}
|
|
31
|
+
open(component, initialData) {
|
|
32
|
+
return this.openSvelteDialog(component, initialData);
|
|
33
|
+
}
|
|
34
|
+
openWithExplicitCancel(component, initialData) {
|
|
35
|
+
throw new Error("Method not implemented.");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class HeadlessUIService extends UIService {
|
|
39
|
+
get dialogToCopy() {
|
|
40
|
+
throw new Error("Method not implemented.");
|
|
41
|
+
}
|
|
42
|
+
constructor(context, dependents) {
|
|
43
|
+
const headlessSvelteDialogManager = new HeadlessSvelteDialogManager();
|
|
44
|
+
super(context, {
|
|
45
|
+
dialogManager: headlessSvelteDialogManager,
|
|
46
|
+
APIService: dependents.APIService
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class HeadlessServiceHub extends InjectableServiceHub {
|
|
51
|
+
constructor(_context, overrideServiceConstructor) {
|
|
52
|
+
const context = _context ?? new ServiceContext();
|
|
53
|
+
const API = new HeadlessAPIService(context);
|
|
54
|
+
const conflict = new InjectableConflictService(context);
|
|
55
|
+
const fileProcessing = new InjectableFileProcessingService(context);
|
|
56
|
+
const setting = new InjectableSettingService(context, {
|
|
57
|
+
APIService: API
|
|
58
|
+
});
|
|
59
|
+
const appLifecycle = new HeadlessAppLifecycleService(context, {
|
|
60
|
+
settingService: setting
|
|
61
|
+
});
|
|
62
|
+
const remote = new InjectableRemoteService(context, {
|
|
63
|
+
pouchDB: overrideServiceConstructor.pouchDB,
|
|
64
|
+
APIService: API,
|
|
65
|
+
appLifecycle,
|
|
66
|
+
setting
|
|
67
|
+
});
|
|
68
|
+
const tweakValue = new InjectableTweakValueService(context);
|
|
69
|
+
const vault = new InjectableVaultServiceCompat(context, {
|
|
70
|
+
settingService: setting,
|
|
71
|
+
APIService: API
|
|
72
|
+
});
|
|
73
|
+
const test = new InjectableTestService(context);
|
|
74
|
+
const databaseEvents = new InjectableDatabaseEventService(context);
|
|
75
|
+
const path = new PathServiceCompat(context, {
|
|
76
|
+
settingService: setting
|
|
77
|
+
});
|
|
78
|
+
const database = new (overrideServiceConstructor.database ?? HeadlessDatabaseService)(context, {
|
|
79
|
+
pouchDB: overrideServiceConstructor.pouchDB,
|
|
80
|
+
API,
|
|
81
|
+
path,
|
|
82
|
+
vault,
|
|
83
|
+
setting
|
|
84
|
+
});
|
|
85
|
+
const config = new ConfigServiceBrowserCompat(context, {
|
|
86
|
+
settingService: setting,
|
|
87
|
+
APIService: API
|
|
88
|
+
});
|
|
89
|
+
const replicator = new InjectableReplicatorService(context, {
|
|
90
|
+
settingService: setting,
|
|
91
|
+
appLifecycleService: appLifecycle,
|
|
92
|
+
databaseEventService: databaseEvents
|
|
93
|
+
});
|
|
94
|
+
const replication = new InjectableReplicationService(context, {
|
|
95
|
+
APIService: API,
|
|
96
|
+
appLifecycleService: appLifecycle,
|
|
97
|
+
replicatorService: replicator,
|
|
98
|
+
settingService: setting,
|
|
99
|
+
fileProcessingService: fileProcessing,
|
|
100
|
+
databaseService: database
|
|
101
|
+
});
|
|
102
|
+
const keyValueDB = new HeadlessKeyValueDBService(context, {
|
|
103
|
+
openKeyValueDatabase: overrideServiceConstructor.openKeyValueDatabase ?? createIndexedDBKeyValueDatabaseFactory(),
|
|
104
|
+
appLifecycle,
|
|
105
|
+
databaseEvents,
|
|
106
|
+
vault
|
|
107
|
+
});
|
|
108
|
+
const control = new ControlService(context, {
|
|
109
|
+
appLifecycleService: appLifecycle,
|
|
110
|
+
settingService: setting,
|
|
111
|
+
databaseService: database,
|
|
112
|
+
fileProcessingService: fileProcessing,
|
|
113
|
+
APIService: API,
|
|
114
|
+
replicatorService: replicator
|
|
115
|
+
});
|
|
116
|
+
const ui = new HeadlessUIService(context, {
|
|
117
|
+
APIService: API
|
|
118
|
+
});
|
|
119
|
+
const serviceInstancesToInit = {
|
|
120
|
+
appLifecycle,
|
|
121
|
+
conflict,
|
|
122
|
+
database,
|
|
123
|
+
databaseEvents,
|
|
124
|
+
fileProcessing,
|
|
125
|
+
replication,
|
|
126
|
+
replicator,
|
|
127
|
+
remote,
|
|
128
|
+
setting,
|
|
129
|
+
tweakValue,
|
|
130
|
+
vault,
|
|
131
|
+
test,
|
|
132
|
+
ui,
|
|
133
|
+
path,
|
|
134
|
+
API,
|
|
135
|
+
config,
|
|
136
|
+
keyValueDB,
|
|
137
|
+
control
|
|
138
|
+
};
|
|
139
|
+
super(context, serviceInstancesToInit);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
HeadlessServiceHub
|
|
144
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InjectableServiceHub } from "./implements/injectable/InjectableServiceHub.js";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { UIService } from "./implements/base/UIService.js";
|
|
2
|
+
import type { ConfigService } from "./base/ConfigService.js";
|
|
3
|
+
import type { TestService } from "./base/TestService.js";
|
|
4
|
+
import type { VaultService } from "./base/VaultService.js";
|
|
5
|
+
import type { TweakValueService } from "./base/TweakValueService.js";
|
|
6
|
+
import type { SettingService } from "./base/SettingService.js";
|
|
7
|
+
import type { AppLifecycleService } from "./base/AppLifecycleService.js";
|
|
8
|
+
import type { ConflictService } from "./base/ConflictService.js";
|
|
9
|
+
import type { RemoteService } from "./base/RemoteService.js";
|
|
10
|
+
import type { ReplicationService } from "./base/ReplicationService.js";
|
|
11
|
+
import type { ReplicatorService } from "./base/ReplicatorService.js";
|
|
12
|
+
import type { FileProcessingService } from "./base/FileProcessingService.js";
|
|
13
|
+
import type { DatabaseEventService } from "./base/DatabaseEventService.js";
|
|
14
|
+
import type { DatabaseService } from "./base/DatabaseService.js";
|
|
15
|
+
import type { PathService } from "./base/PathService.js";
|
|
16
|
+
import type { APIService } from "./base/APIService.js";
|
|
17
|
+
import type { ServiceContext } from "./base/ServiceBase.js";
|
|
18
|
+
import type { IServiceHub } from "./base/IService.js";
|
|
19
|
+
import type { KeyValueDBService } from "./base/KeyValueDBService.js";
|
|
20
|
+
import type { ControlService } from "./base/ControlService.js";
|
|
21
|
+
export type ServiceInstances<T extends ServiceContext = ServiceContext> = {
|
|
22
|
+
API?: APIService<T>;
|
|
23
|
+
path?: PathService<T>;
|
|
24
|
+
database?: DatabaseService<T>;
|
|
25
|
+
databaseEvents?: DatabaseEventService<T>;
|
|
26
|
+
replicator?: ReplicatorService<T>;
|
|
27
|
+
fileProcessing?: FileProcessingService<T>;
|
|
28
|
+
replication?: ReplicationService<T>;
|
|
29
|
+
remote?: RemoteService<T>;
|
|
30
|
+
conflict?: ConflictService<T>;
|
|
31
|
+
appLifecycle?: AppLifecycleService<T>;
|
|
32
|
+
setting?: SettingService<T>;
|
|
33
|
+
tweakValue?: TweakValueService<T>;
|
|
34
|
+
vault?: VaultService<T>;
|
|
35
|
+
test?: TestService<T>;
|
|
36
|
+
ui?: UIService<T>;
|
|
37
|
+
config?: ConfigService<T>;
|
|
38
|
+
keyValueDB?: KeyValueDBService<T>;
|
|
39
|
+
control?: ControlService<T>;
|
|
40
|
+
};
|
|
41
|
+
export declare abstract class ServiceHub<T extends ServiceContext = ServiceContext> implements IServiceHub {
|
|
42
|
+
/** Context shared by every service exposed by this hub. */
|
|
43
|
+
readonly context: T;
|
|
44
|
+
protected abstract _api: APIService<T>;
|
|
45
|
+
protected abstract _path: PathService<T>;
|
|
46
|
+
protected abstract _database: DatabaseService<T>;
|
|
47
|
+
protected abstract _databaseEvents: DatabaseEventService<T>;
|
|
48
|
+
protected abstract _replicator: ReplicatorService<T>;
|
|
49
|
+
protected abstract _fileProcessing: FileProcessingService<T>;
|
|
50
|
+
protected abstract _replication: ReplicationService<T>;
|
|
51
|
+
protected abstract _remote: RemoteService<T>;
|
|
52
|
+
protected abstract _conflict: ConflictService<T>;
|
|
53
|
+
protected abstract _appLifecycle: AppLifecycleService<T>;
|
|
54
|
+
protected abstract _setting: SettingService<T>;
|
|
55
|
+
protected abstract _tweakValue: TweakValueService<T>;
|
|
56
|
+
protected abstract _vault: VaultService<T>;
|
|
57
|
+
protected abstract _test: TestService<T>;
|
|
58
|
+
protected abstract _ui: UIService<T>;
|
|
59
|
+
protected abstract _config: ConfigService<T>;
|
|
60
|
+
protected abstract _keyValueDB: KeyValueDBService<T>;
|
|
61
|
+
protected abstract _control: ControlService<T>;
|
|
62
|
+
protected _injected: ServiceInstances<T>;
|
|
63
|
+
constructor(context: T, services?: ServiceInstances<T>);
|
|
64
|
+
get API(): APIService<T>;
|
|
65
|
+
get path(): PathService<T>;
|
|
66
|
+
get database(): DatabaseService<T>;
|
|
67
|
+
get databaseEvents(): DatabaseEventService<T>;
|
|
68
|
+
get replicator(): ReplicatorService<T>;
|
|
69
|
+
get fileProcessing(): FileProcessingService<T>;
|
|
70
|
+
get replication(): ReplicationService<T>;
|
|
71
|
+
get remote(): RemoteService<T>;
|
|
72
|
+
get conflict(): ConflictService<T>;
|
|
73
|
+
get appLifecycle(): AppLifecycleService<T>;
|
|
74
|
+
get setting(): SettingService<T>;
|
|
75
|
+
get tweakValue(): TweakValueService<T>;
|
|
76
|
+
get vault(): VaultService<T>;
|
|
77
|
+
get test(): TestService<T>;
|
|
78
|
+
get UI(): UIService<T>;
|
|
79
|
+
get config(): ConfigService<T>;
|
|
80
|
+
get keyValueDB(): KeyValueDBService<T>;
|
|
81
|
+
get control(): ControlService<T>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
class ServiceHub {
|
|
2
|
+
/** Context shared by every service exposed by this hub. */
|
|
3
|
+
context;
|
|
4
|
+
_injected = {};
|
|
5
|
+
constructor(context, services = {}) {
|
|
6
|
+
this.context = context;
|
|
7
|
+
this._injected = services;
|
|
8
|
+
}
|
|
9
|
+
get API() {
|
|
10
|
+
return this._injected.API || this._api;
|
|
11
|
+
}
|
|
12
|
+
get path() {
|
|
13
|
+
return this._injected.path || this._path;
|
|
14
|
+
}
|
|
15
|
+
get database() {
|
|
16
|
+
return this._injected.database || this._database;
|
|
17
|
+
}
|
|
18
|
+
get databaseEvents() {
|
|
19
|
+
return this._injected.databaseEvents || this._databaseEvents;
|
|
20
|
+
}
|
|
21
|
+
get replicator() {
|
|
22
|
+
return this._injected.replicator || this._replicator;
|
|
23
|
+
}
|
|
24
|
+
get fileProcessing() {
|
|
25
|
+
return this._injected.fileProcessing || this._fileProcessing;
|
|
26
|
+
}
|
|
27
|
+
get replication() {
|
|
28
|
+
return this._injected.replication || this._replication;
|
|
29
|
+
}
|
|
30
|
+
get remote() {
|
|
31
|
+
return this._injected.remote || this._remote;
|
|
32
|
+
}
|
|
33
|
+
get conflict() {
|
|
34
|
+
return this._injected.conflict || this._conflict;
|
|
35
|
+
}
|
|
36
|
+
get appLifecycle() {
|
|
37
|
+
return this._injected.appLifecycle || this._appLifecycle;
|
|
38
|
+
}
|
|
39
|
+
get setting() {
|
|
40
|
+
return this._injected.setting || this._setting;
|
|
41
|
+
}
|
|
42
|
+
get tweakValue() {
|
|
43
|
+
return this._injected.tweakValue || this._tweakValue;
|
|
44
|
+
}
|
|
45
|
+
get vault() {
|
|
46
|
+
return this._injected.vault || this._vault;
|
|
47
|
+
}
|
|
48
|
+
get test() {
|
|
49
|
+
return this._injected.test || this._test;
|
|
50
|
+
}
|
|
51
|
+
get UI() {
|
|
52
|
+
return this._injected.ui || this._ui;
|
|
53
|
+
}
|
|
54
|
+
get config() {
|
|
55
|
+
return this._injected.config || this._config;
|
|
56
|
+
}
|
|
57
|
+
get keyValueDB() {
|
|
58
|
+
return this._injected.keyValueDB || this._keyValueDB;
|
|
59
|
+
}
|
|
60
|
+
get control() {
|
|
61
|
+
return this._injected.control || this._control;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
ServiceHub
|
|
66
|
+
};
|