@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,27 @@
|
|
|
1
|
+
import { type ResultPayloadWithSeq, type SplitProcessItem } from "./universalTypes.js";
|
|
2
|
+
/**
|
|
3
|
+
* Splits data into pieces using a worker.
|
|
4
|
+
* @param dataSrc The source data to be split.
|
|
5
|
+
* @param pieceSize The size of each piece.
|
|
6
|
+
* @param plainSplit Whether to use plain splitting.
|
|
7
|
+
* @param minimumChunkSize The minimum size of each chunk.
|
|
8
|
+
* @param filename The name of the file being processed.
|
|
9
|
+
* @param splitVersion The version of the splitting algorithm to use.
|
|
10
|
+
* @param useSegmenter Whether to use a segmenter (only works on splitVersion:2)
|
|
11
|
+
* @returns A generator that yields the split pieces.
|
|
12
|
+
*/
|
|
13
|
+
export declare function _splitPieces2Worker(dataSrc: Blob, pieceSize: number, plainSplit: boolean, minimumChunkSize: number, filename: string | undefined, splitVersion: 1 | 2 | 3, useSegmenter: boolean): () => AsyncGenerator<string, void, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Aborts all in-flight split tasks identified by the given keys.
|
|
16
|
+
* Called when the background worker that owned these tasks has crashed, so the streams
|
|
17
|
+
* will never receive any more data and must be torn down to unblock callers.
|
|
18
|
+
* @param keys The task keys to abort.
|
|
19
|
+
* @param error The error to report to each stream.
|
|
20
|
+
*/
|
|
21
|
+
export declare function abortSplitTasks(keys: number[], error: Error): void;
|
|
22
|
+
/**
|
|
23
|
+
* Handles the splitting callback from the worker.
|
|
24
|
+
* @param process the splitting process item
|
|
25
|
+
* @param data the data received from the worker
|
|
26
|
+
*/
|
|
27
|
+
export declare function handleTaskSplit(process: SplitProcessItem, data: ResultPayloadWithSeq): void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { LOG_LEVEL_VERBOSE, Logger } from "../common/logger.js";
|
|
2
|
+
import { startWorker, removeTask } from "./bgWorker.js";
|
|
3
|
+
import {} from "./universalTypes.js";
|
|
4
|
+
const SYMBOL_USED = /* @__PURE__ */ Symbol("used");
|
|
5
|
+
const SYMBOL_END_OF_DATA = /* @__PURE__ */ Symbol("endOfData");
|
|
6
|
+
const workerStreams = /* @__PURE__ */ new Map();
|
|
7
|
+
const writers = /* @__PURE__ */ new Map();
|
|
8
|
+
const responseBuf = /* @__PURE__ */ new Map();
|
|
9
|
+
let writerPromise = Promise.resolve();
|
|
10
|
+
function _splitPieces2Worker(dataSrc, pieceSize, plainSplit, minimumChunkSize, filename, splitVersion, useSegmenter) {
|
|
11
|
+
const process = startWorker({
|
|
12
|
+
type: "split",
|
|
13
|
+
dataSrc,
|
|
14
|
+
pieceSize,
|
|
15
|
+
plainSplit,
|
|
16
|
+
minimumChunkSize,
|
|
17
|
+
filename,
|
|
18
|
+
useSegmenter,
|
|
19
|
+
splitVersion
|
|
20
|
+
});
|
|
21
|
+
const _key = process.key;
|
|
22
|
+
const stream = new TransformStream({
|
|
23
|
+
transform: (chunk, controller) => {
|
|
24
|
+
if (chunk === null) {
|
|
25
|
+
controller.terminate();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
controller.enqueue(chunk);
|
|
29
|
+
},
|
|
30
|
+
flush: () => {
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
workerStreams.set(_key, stream);
|
|
34
|
+
const readable = stream.readable;
|
|
35
|
+
const reader = readable.getReader();
|
|
36
|
+
const writer = stream.writable.getWriter();
|
|
37
|
+
writers.set(_key, writer);
|
|
38
|
+
return async function* () {
|
|
39
|
+
try {
|
|
40
|
+
let done = false;
|
|
41
|
+
do {
|
|
42
|
+
const results = await reader.read();
|
|
43
|
+
done = results.done;
|
|
44
|
+
if (done) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
yield results.value;
|
|
48
|
+
} while (!done);
|
|
49
|
+
} catch (ex) {
|
|
50
|
+
Logger(`Error in worker stream for key ${_key}`);
|
|
51
|
+
Logger(ex, LOG_LEVEL_VERBOSE);
|
|
52
|
+
throw ex;
|
|
53
|
+
} finally {
|
|
54
|
+
process.finalize();
|
|
55
|
+
workerStreams.delete(_key);
|
|
56
|
+
writers.delete(_key);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function abortSplitTasks(keys, error) {
|
|
61
|
+
for (const key of keys) {
|
|
62
|
+
responseBuf.delete(key);
|
|
63
|
+
writerPromise = writerPromise.then(async () => {
|
|
64
|
+
const writer = writers.get(key);
|
|
65
|
+
if (writer) {
|
|
66
|
+
await writer.abort(error);
|
|
67
|
+
writers.delete(key);
|
|
68
|
+
}
|
|
69
|
+
workerStreams.delete(key);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function handleTaskSplit(process, data) {
|
|
74
|
+
const key = data.key;
|
|
75
|
+
if (!("result" in data)) {
|
|
76
|
+
responseBuf.delete(key);
|
|
77
|
+
const reportError = data.error || new Error("Unknown error in background splitting");
|
|
78
|
+
writerPromise = writerPromise.then(async () => {
|
|
79
|
+
const writer = writers.get(key);
|
|
80
|
+
if (writer) {
|
|
81
|
+
await writer.abort(reportError);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let thisBuf = responseBuf.get(key);
|
|
87
|
+
if (!thisBuf) {
|
|
88
|
+
thisBuf = /* @__PURE__ */ new Map();
|
|
89
|
+
responseBuf.set(key, thisBuf);
|
|
90
|
+
}
|
|
91
|
+
const seq = data.seq;
|
|
92
|
+
thisBuf.set(seq, data.result === null ? SYMBOL_END_OF_DATA : data.result);
|
|
93
|
+
responseBuf.set(key, thisBuf);
|
|
94
|
+
const keys = Array.from(thisBuf.keys()).sort((a, b) => a - b);
|
|
95
|
+
const max = keys[keys.length - 1];
|
|
96
|
+
for (let i = 0; i <= max; i++) {
|
|
97
|
+
const result = thisBuf.get(i);
|
|
98
|
+
if (result === void 0) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (result === SYMBOL_USED) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
thisBuf.set(i, SYMBOL_USED);
|
|
105
|
+
responseBuf.set(key, thisBuf);
|
|
106
|
+
writerPromise = writerPromise.then(async () => {
|
|
107
|
+
const writer = writers.get(key);
|
|
108
|
+
if (!writer) {
|
|
109
|
+
throw new Error(`Invalid writer for key ${key} in background splitting`);
|
|
110
|
+
}
|
|
111
|
+
await writer.write(result === SYMBOL_END_OF_DATA ? null : result);
|
|
112
|
+
if (result === SYMBOL_END_OF_DATA) {
|
|
113
|
+
removeTask(key);
|
|
114
|
+
responseBuf.delete(key);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
_splitPieces2Worker,
|
|
121
|
+
abortSplitTasks,
|
|
122
|
+
handleTaskSplit
|
|
123
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PromiseWithResolvers } from "octagonal-wheels/promises";
|
|
2
|
+
export type EncryptArguments = {
|
|
3
|
+
key: number;
|
|
4
|
+
type: "encrypt" | "decrypt";
|
|
5
|
+
input: string;
|
|
6
|
+
passphrase: string;
|
|
7
|
+
autoCalculateIterations: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type EncryptHKDFArguments = {
|
|
10
|
+
key: number;
|
|
11
|
+
type: "encryptHKDF" | "decryptHKDF";
|
|
12
|
+
input: string;
|
|
13
|
+
passphrase: string;
|
|
14
|
+
pbkdf2Salt: Uint8Array<ArrayBuffer>;
|
|
15
|
+
};
|
|
16
|
+
export type SplitArguments = {
|
|
17
|
+
key: number;
|
|
18
|
+
type: "split";
|
|
19
|
+
dataSrc: Blob;
|
|
20
|
+
pieceSize: number;
|
|
21
|
+
plainSplit: boolean;
|
|
22
|
+
minimumChunkSize: number;
|
|
23
|
+
filename?: string;
|
|
24
|
+
useSegmenter: boolean;
|
|
25
|
+
splitVersion: 1 | 2 | 3;
|
|
26
|
+
};
|
|
27
|
+
export type SplitProcessItem = {
|
|
28
|
+
key: number;
|
|
29
|
+
type: SplitArguments["type"];
|
|
30
|
+
finalize: () => void;
|
|
31
|
+
};
|
|
32
|
+
export type EncryptProcessItem = {
|
|
33
|
+
key: number;
|
|
34
|
+
task: PromiseWithResolvers<string>;
|
|
35
|
+
type: EncryptArguments["type"];
|
|
36
|
+
finalize: () => void;
|
|
37
|
+
};
|
|
38
|
+
export type EncryptHKDFProcessItem = {
|
|
39
|
+
key: number;
|
|
40
|
+
task: PromiseWithResolvers<string>;
|
|
41
|
+
type: EncryptHKDFArguments["type"];
|
|
42
|
+
finalize: () => void;
|
|
43
|
+
};
|
|
44
|
+
export type ProcessItem = SplitProcessItem | EncryptProcessItem | EncryptHKDFProcessItem;
|
|
45
|
+
export declare const END_OF_DATA: null;
|
|
46
|
+
export type END_OF_DATA = typeof END_OF_DATA;
|
|
47
|
+
export type ResultPayloadBase = {
|
|
48
|
+
key: number;
|
|
49
|
+
};
|
|
50
|
+
export type ResultPayloadWithResult = ResultPayloadBase & {
|
|
51
|
+
result: string;
|
|
52
|
+
};
|
|
53
|
+
export type ResultPayloadWithError = ResultPayloadBase & {
|
|
54
|
+
error: unknown;
|
|
55
|
+
};
|
|
56
|
+
export type ResultPayload = ResultPayloadWithResult | ResultPayloadWithError;
|
|
57
|
+
export type ResultPayloadWithSeqBase = ResultPayload & {
|
|
58
|
+
seq: number;
|
|
59
|
+
};
|
|
60
|
+
export type ResultPayloadPiece = ResultPayloadWithSeqBase & {
|
|
61
|
+
result: string | END_OF_DATA;
|
|
62
|
+
};
|
|
63
|
+
export type ResultPayloadWithSeq = ResultPayloadPiece | ResultPayloadWithError;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Commonlib development
|
|
2
|
+
|
|
3
|
+
This document is for Commonlib developers. Package consumers should begin with the root README and the focused platform guide.
|
|
4
|
+
|
|
5
|
+
## Local validation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm ci
|
|
9
|
+
npm run check:types
|
|
10
|
+
npm test
|
|
11
|
+
npm run test:contracts
|
|
12
|
+
npm run test:boundary
|
|
13
|
+
npm run test:package
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`test:package` builds the compiled package, packs it, installs the tarball into a clean consumer fixture, exercises Node imports, type-checks public entry points, and creates representative browser bundles. It also verifies that browser and context entry points do not pull in Node-only code, Svelte, or the complete language catalogue unintentionally.
|
|
17
|
+
|
|
18
|
+
`test:contracts` runs the host-neutral result contracts which are intended to be reusable while implementations move:
|
|
19
|
+
|
|
20
|
+
- `test:contract:context` verifies event delivery, default instance isolation, translation results, and host extension of `ServiceContextContract`; and
|
|
21
|
+
- `test:contract:platform-storage` runs one result table against Node storage and browser File System Access storage, including missing paths, text and binary round trips, append, listing, removal, root handling, and traversal rejection.
|
|
22
|
+
|
|
23
|
+
These scripts are deliberately available independently of CI. Add a focused result contract before moving another platform API; do not infer compatibility from matching TypeScript shapes alone. Platform-specific behaviour, such as timestamp fidelity, must remain documented outside the shared result set.
|
|
24
|
+
|
|
25
|
+
Self-hosted LiveSync remains the principal downstream consumer. A Commonlib change is not ready for publication until the exact packed artefact has also passed the applicable LiveSync type checks, unit and integration tests, application builds, CLI E2E, and focused real-Obsidian E2E.
|
|
26
|
+
|
|
27
|
+
## Translation catalogue
|
|
28
|
+
|
|
29
|
+
Human-edited translations live under `src/common/messagesYAML`. Regenerate derived JSON and TypeScript resources with:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm run i18n:bake
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The generated catalogue remains an optional dependency surface. Core and context imports must not load it.
|
|
36
|
+
|
|
37
|
+
## Public API documentation
|
|
38
|
+
|
|
39
|
+
New reviewed public entry points require TSDoc describing ownership, lifecycle, platform constraints, errors, and disposal. Hand-written guides explain cross-entry composition and operational constraints.
|
|
40
|
+
|
|
41
|
+
Generated API reference is deferred until the compatibility export surface has been narrowed. Generating documentation for every current `compat/*` path would make migration-only implementation paths look like stable public API.
|
|
42
|
+
|
|
43
|
+
TODO: introduce generated API reference for a reviewed allow-list of public entry points once the high-level client façade and its lifecycle contract have been accepted.
|
|
44
|
+
|
|
45
|
+
## Compatibility exports
|
|
46
|
+
|
|
47
|
+
The package build records each compatibility path explicitly. Do not add a wildcard export. A new compatibility path requires a real downstream import, a packed-consumer or downstream test, and a migration plan towards a focused public entry or the owning package.
|
|
48
|
+
|
|
49
|
+
TODO: classify and document compatibility paths whose purpose is still unclear before stabilising the first public release. Remove obsolete paths rather than documenting accidental layout as API.
|
|
50
|
+
|
|
51
|
+
Release preparation and staged-publication checks are documented in [the maintainer runbook](releasing.md).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Platform storage
|
|
2
|
+
|
|
3
|
+
Commonlib supplies paired rooted-storage implementations for Node and the browser File System Access API. Both implement the same LiveSync storage contract, but the platform entry points remain deliberately separate.
|
|
4
|
+
|
|
5
|
+
## Ownership boundary
|
|
6
|
+
|
|
7
|
+
The host owns root acquisition and lifecycle:
|
|
8
|
+
|
|
9
|
+
- a Node or CLI host decides which directory becomes `rootPath`;
|
|
10
|
+
- a browser host presents any directory picker, obtains permission, and supplies an authorised `FileSystemDirectoryHandle` as `rootHandle`;
|
|
11
|
+
- the host decides whether and how a browser handle is persisted and re-authorised; and
|
|
12
|
+
- the host disposes any surrounding application resources.
|
|
13
|
+
|
|
14
|
+
The storage factories only bind operations to the supplied root. They do not inspect the current process, call `showDirectoryPicker()`, request permission, or store credentials or handles.
|
|
15
|
+
|
|
16
|
+
## Browser File System Access API
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createFileSystemAccessStorage } from '@vrtmrz/livesync-commonlib/browser';
|
|
20
|
+
|
|
21
|
+
const rootHandle = await window.showDirectoryPicker();
|
|
22
|
+
const storage = createFileSystemAccessStorage({ rootHandle });
|
|
23
|
+
|
|
24
|
+
await storage.mkdir('notes');
|
|
25
|
+
await storage.write('notes/example.md', '# Example');
|
|
26
|
+
const content = await storage.read('notes/example.md');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Calling `showDirectoryPicker()` is only an example of host composition. Availability, secure-context requirements, user activation, permission prompts, handle persistence, and re-authorisation are browser concerns and are outside the adapter contract.
|
|
30
|
+
|
|
31
|
+
## Node
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createNodeStorage } from '@vrtmrz/livesync-commonlib/node';
|
|
35
|
+
|
|
36
|
+
const storage = createNodeStorage({ rootPath: '/srv/livesync' });
|
|
37
|
+
await storage.write('notes/example.md', '# Example');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`rootPath` may be absolute or process-relative. The host should normally resolve and validate configuration before constructing the adapter.
|
|
41
|
+
|
|
42
|
+
## Shared path contract
|
|
43
|
+
|
|
44
|
+
Adapter paths are relative to the injected root and use forward slashes. The empty path refers to the root for root-safe operations such as `exists`, `stat`, `list`, and `mkdir`.
|
|
45
|
+
|
|
46
|
+
The adapters reject:
|
|
47
|
+
|
|
48
|
+
- absolute paths;
|
|
49
|
+
- Windows drive-qualified paths;
|
|
50
|
+
- backslash-separated paths;
|
|
51
|
+
- `.` and `..` traversal segments; and
|
|
52
|
+
- the empty path for entry operations such as `read`, `write`, `append`, and `remove`.
|
|
53
|
+
|
|
54
|
+
Writes create missing parent directories. Listing returns direct child paths relative to the configured root. Text, binary, append, metadata, listing, removal, and containment behaviour are exercised by the same contract suite against both implementations.
|
|
55
|
+
|
|
56
|
+
The File System Access API does not expose portable creation times or permit setting file times. Consumers must not rely on identical timestamp fidelity across the two adapters.
|
|
57
|
+
|
|
58
|
+
## Bundling boundary
|
|
59
|
+
|
|
60
|
+
Browser consumers import only `@vrtmrz/livesync-commonlib/browser`. Packed-package tests build that entry with browser conditions and verify that the Node implementation is absent. Node consumers import `@vrtmrz/livesync-commonlib/node`; the root and context entries do not load Node built-ins.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Releasing Commonlib
|
|
2
|
+
|
|
3
|
+
This document is the developer and maintainer runbook for preparing and publishing `@vrtmrz/livesync-commonlib`. Package-consumer guidance belongs in the root README.
|
|
4
|
+
|
|
5
|
+
## Release gate
|
|
6
|
+
|
|
7
|
+
Run the complete owner gate from a clean checkout:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm ci
|
|
11
|
+
npm run verify:package
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The gate type-checks Commonlib, runs its complete unit suite, verifies the source boundary, builds the distributable package, installs its exact tarball into a clean consumer, and bundles representative browser and Node entry points. The source `package.json` remains private to prevent publishing the repository root. Only the generated `.package` directory is publishable, and its manifest defaults to public publication on the `next` dist-tag.
|
|
15
|
+
|
|
16
|
+
Before publication, run the downstream workflow against an exact Self-hosted LiveSync ref which already consumes the package. The workflow installs the tarball produced from the selected Commonlib commit, then runs LiveSync type checks, unit tests, plug-in and application builds, and CLI E2E. Real Obsidian E2E remains local-only and is required when the changed boundary affects actual plug-in composition, storage, UI, or platform behaviour.
|
|
17
|
+
|
|
18
|
+
## Preparing a release
|
|
19
|
+
|
|
20
|
+
Choose the version explicitly. Use a prerelease such as `0.1.0-rc.0` when registry installation must be validated before the first stable version. Package-proof versions are local artefacts and cannot be staged.
|
|
21
|
+
|
|
22
|
+
From a release branch based on `main`:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm ci
|
|
26
|
+
npm version <version> --no-git-tag-version
|
|
27
|
+
npm run verify:package
|
|
28
|
+
npm publish --dry-run .package --tag next --access public
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Review `package.json`, `package-lock.json`, the generated manifest, the tarball contents, the test results, and the downstream evidence. Commit only the source manifest and lockfile for the version change; `.package`, `.package-consumer`, and `artifacts` are generated and ignored. Push and open a release pull request only after the usual user checkpoint.
|
|
32
|
+
|
|
33
|
+
## Initial npm bootstrap
|
|
34
|
+
|
|
35
|
+
The npm package must exist before Trusted Publishing can be configured. Bootstrap the first reviewed release candidate once from the exact reviewed commit in the draft release pull request, using an interactive npm session with 2FA:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm ci
|
|
39
|
+
npm run verify:package
|
|
40
|
+
npm publish .package --tag next --access public
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Confirm the authenticated npm account, `@vrtmrz` scope ownership, package name, version, tarball checksum, packed contents, source commit, and target tag immediately before publication. Treat bootstrap publication as a separate user-authorised operation. npm may assign `latest` to the first published version even when `next` is requested; leave the immutable version in place and replace `latest` only after a stable release has passed consumer validation.
|
|
44
|
+
|
|
45
|
+
Keep the release pull request in draft while the published artefact is validated in Self-hosted LiveSync. If validation succeeds, merge the exact reviewed commit. If validation fails, leave the published version immutable and prepare a new pre-release version.
|
|
46
|
+
|
|
47
|
+
## Trusted staged publishing
|
|
48
|
+
|
|
49
|
+
After bootstrap, configure the npm Trusted Publisher for:
|
|
50
|
+
|
|
51
|
+
- GitHub owner and repository: `vrtmrz/livesync-commonlib`;
|
|
52
|
+
- workflow file: `publish-npm.yml`;
|
|
53
|
+
- environment: `npm`; and
|
|
54
|
+
- allowed action: staged publishing only.
|
|
55
|
+
|
|
56
|
+
Protect the GitHub `npm` environment with a required reviewer and permit only the `main` branch. The workflow accepts only the exact commit currently on `main`, runs `verify:package`, validates the requested version and confirmation text, packs that reviewed output, records its checksum, and passes the same tarball to the protected staging job.
|
|
57
|
+
|
|
58
|
+
Dispatch it with the exact stable or prerelease version and full commit SHA:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
sha=$(git rev-parse origin/main)
|
|
62
|
+
gh workflow run publish-npm.yml \
|
|
63
|
+
--ref main \
|
|
64
|
+
-f version=<version> \
|
|
65
|
+
-f expected_sha="$sha" \
|
|
66
|
+
-f confirmation="stage @vrtmrz/livesync-commonlib@<version> from $sha"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The workflow always stages to `next`. Inspect the staged package name, version, access, dist-tag, provenance, checksum, files, and source commit before approving it through npm. Approval and later promotion to `latest` are separate user-authorised operations. Validate the exact registry version in Self-hosted LiveSync before promoting a stable release.
|