zapo-js 0.1.2 → 0.2.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/README.md +12 -4
- package/dist/appstate/WaAppStateCrypto.js +1 -1
- package/dist/appstate/WaAppStateSyncClient.js +138 -93
- package/dist/appstate/{store/sqlite.js → encoding.js} +13 -8
- package/dist/appstate/index.js +8 -6
- package/dist/appstate/utils.js +0 -5
- package/dist/auth/WaAuthClient.js +36 -47
- package/dist/auth/flow/WaAuthCredentialsFlow.js +7 -7
- package/dist/auth/index.js +1 -6
- package/dist/auth/pairing/WaPairingCodeCrypto.js +6 -4
- package/dist/auth/pairing/WaPairingFlow.js +13 -3
- package/dist/client/WaClient.js +225 -101
- package/dist/client/WaClientFactory.js +294 -44
- package/dist/client/connection/WaConnectionManager.js +19 -10
- package/dist/client/coordinators/WaBusinessCoordinator.js +241 -0
- package/dist/client/coordinators/WaGroupCoordinator.js +11 -7
- package/dist/client/coordinators/WaIncomingNodeCoordinator.js +1 -0
- package/dist/client/coordinators/WaMessageDispatchCoordinator.js +292 -99
- package/dist/client/coordinators/WaPassiveTasksCoordinator.js +74 -31
- package/dist/client/coordinators/WaPrivacyCoordinator.js +134 -0
- package/dist/client/coordinators/WaProfileCoordinator.js +212 -0
- package/dist/client/coordinators/WaRetryCoordinator.js +179 -27
- package/dist/client/coordinators/WaStreamControlCoordinator.js +18 -11
- package/dist/client/coordinators/WaTrustedContactTokenCoordinator.js +166 -0
- package/dist/client/dirty.js +40 -20
- package/dist/client/events/devices.js +72 -0
- package/dist/client/events/group.js +3 -11
- package/dist/client/events/identity.js +22 -0
- package/dist/client/events/privacy-token.js +39 -0
- package/dist/client/history-sync.js +50 -9
- package/dist/client/incoming.js +37 -7
- package/dist/client/mailbox.js +24 -23
- package/dist/client/messages.js +107 -31
- package/dist/client/messaging/fanout.js +21 -11
- package/dist/client/messaging/participants.js +6 -4
- package/dist/client/persistence/WriteBehindPersistence.js +129 -0
- package/dist/client/tokens/cs-token.js +50 -0
- package/dist/client/tokens/tc-token.js +25 -0
- package/dist/crypto/core/index.js +2 -2
- package/dist/crypto/core/keys.js +4 -4
- package/dist/crypto/core/nonce.js +2 -0
- package/dist/crypto/core/primitives.js +0 -8
- package/dist/crypto/core/random.js +22 -0
- package/dist/crypto/curves/X25519.js +25 -6
- package/dist/crypto/index.js +3 -0
- package/dist/crypto/math/constants.js +13 -36
- package/dist/crypto/math/edwards.js +171 -44
- package/dist/crypto/math/fe.js +706 -0
- package/dist/crypto/math/mod.js +10 -3
- package/dist/esm/appstate/WaAppStateCrypto.js +1 -1
- package/dist/esm/appstate/WaAppStateSyncClient.js +138 -93
- package/dist/esm/appstate/{store/sqlite.js → encoding.js} +13 -8
- package/dist/esm/appstate/index.js +2 -2
- package/dist/esm/appstate/utils.js +2 -5
- package/dist/esm/auth/WaAuthClient.js +36 -47
- package/dist/esm/auth/flow/WaAuthCredentialsFlow.js +7 -7
- package/dist/esm/auth/index.js +0 -2
- package/dist/esm/auth/pairing/WaPairingCodeCrypto.js +6 -4
- package/dist/esm/auth/pairing/WaPairingFlow.js +14 -4
- package/dist/esm/client/WaClient.js +225 -101
- package/dist/esm/client/WaClientFactory.js +295 -45
- package/dist/esm/client/connection/WaConnectionManager.js +19 -10
- package/dist/esm/client/coordinators/WaBusinessCoordinator.js +238 -0
- package/dist/esm/client/coordinators/WaGroupCoordinator.js +11 -7
- package/dist/esm/client/coordinators/WaIncomingNodeCoordinator.js +1 -0
- package/dist/esm/client/coordinators/WaMessageDispatchCoordinator.js +295 -102
- package/dist/esm/client/coordinators/WaPassiveTasksCoordinator.js +74 -31
- package/dist/esm/client/coordinators/WaPrivacyCoordinator.js +131 -0
- package/dist/esm/client/coordinators/WaProfileCoordinator.js +209 -0
- package/dist/esm/client/coordinators/WaRetryCoordinator.js +181 -29
- package/dist/esm/client/coordinators/WaStreamControlCoordinator.js +19 -12
- package/dist/esm/client/coordinators/WaTrustedContactTokenCoordinator.js +162 -0
- package/dist/esm/client/dirty.js +40 -20
- package/dist/esm/client/events/devices.js +68 -0
- package/dist/esm/client/events/group.js +3 -11
- package/dist/esm/client/events/identity.js +19 -0
- package/dist/esm/client/events/privacy-token.js +36 -0
- package/dist/esm/client/history-sync.js +50 -9
- package/dist/esm/client/incoming.js +38 -8
- package/dist/esm/client/mailbox.js +24 -23
- package/dist/esm/client/messages.js +108 -32
- package/dist/esm/client/messaging/fanout.js +22 -12
- package/dist/esm/client/messaging/participants.js +6 -4
- package/dist/esm/client/persistence/WriteBehindPersistence.js +125 -0
- package/dist/esm/client/tokens/cs-token.js +46 -0
- package/dist/esm/client/tokens/tc-token.js +18 -0
- package/dist/esm/crypto/core/index.js +2 -2
- package/dist/esm/crypto/core/keys.js +1 -1
- package/dist/esm/crypto/core/nonce.js +2 -0
- package/dist/esm/crypto/core/primitives.js +0 -7
- package/dist/esm/crypto/core/random.js +22 -1
- package/dist/esm/crypto/curves/X25519.js +25 -6
- package/dist/esm/crypto/index.js +1 -0
- package/dist/esm/crypto/math/constants.js +12 -35
- package/dist/esm/crypto/math/edwards.js +174 -47
- package/dist/esm/crypto/math/fe.js +691 -0
- package/dist/esm/crypto/math/mod.js +10 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/infra/perf/BackgroundQueue.js +478 -0
- package/dist/esm/infra/perf/BoundedTaskQueue.js +3 -1
- package/dist/esm/infra/perf/PromiseDedup.js +20 -0
- package/dist/esm/infra/perf/SharedExclusiveGate.js +109 -0
- package/dist/esm/infra/perf/StoreLock.js +77 -0
- package/dist/esm/media/WaMediaCrypto.js +95 -13
- package/dist/esm/media/WaMediaTransferClient.js +39 -47
- package/dist/esm/media/constants.js +2 -1
- package/dist/esm/message/WaMessageClient.js +26 -19
- package/dist/esm/message/content.js +195 -9
- package/dist/esm/message/icdc.js +76 -0
- package/dist/esm/message/incoming.js +24 -12
- package/dist/esm/message/phash.js +3 -1
- package/dist/esm/message/reporting-token.js +14 -27
- package/dist/esm/protocol/appstate.js +9 -40
- package/dist/esm/protocol/browser.js +10 -18
- package/dist/esm/protocol/constants.js +5 -3
- package/dist/esm/protocol/defaults.js +6 -0
- package/dist/esm/protocol/index.js +1 -2
- package/dist/esm/protocol/jid.js +105 -36
- package/dist/esm/protocol/message.js +61 -1
- package/dist/esm/protocol/nodes.js +2 -0
- package/dist/esm/protocol/notification.js +3 -1
- package/dist/esm/protocol/privacy-token.js +17 -0
- package/dist/esm/protocol/privacy.js +55 -0
- package/dist/esm/protocol/stream.js +26 -1
- package/dist/esm/retry/codec.js +216 -0
- package/dist/esm/retry/constants.js +1 -1
- package/dist/esm/retry/index.js +2 -2
- package/dist/esm/retry/parse.js +50 -30
- package/dist/esm/retry/replay.js +11 -7
- package/dist/esm/retry/tracker.js +50 -12
- package/dist/esm/signal/api/SignalDeviceSyncApi.js +49 -32
- package/dist/esm/signal/api/SignalDigestSyncApi.js +13 -9
- package/dist/esm/signal/api/SignalIdentitySyncApi.js +26 -11
- package/dist/esm/signal/api/SignalMissingPreKeysSyncApi.js +18 -7
- package/dist/esm/signal/api/SignalRotateKeyApi.js +4 -2
- package/dist/esm/signal/api/SignalSessionSyncApi.js +16 -7
- package/dist/esm/signal/api/result-map.js +10 -0
- package/dist/esm/signal/constants.js +0 -4
- package/dist/esm/signal/crypto/WaAdvSignature.js +12 -6
- package/dist/esm/signal/{store/sqlite.js → encoding.js} +78 -24
- package/dist/esm/signal/group/SenderKeyCodec.js +3 -2
- package/dist/esm/signal/group/SenderKeyManager.js +125 -106
- package/dist/esm/signal/index.js +1 -0
- package/dist/esm/signal/registration/keygen.js +6 -2
- package/dist/esm/signal/registration/utils.js +1 -0
- package/dist/esm/signal/session/SignalProtocol.js +150 -74
- package/dist/esm/signal/session/resolver.js +137 -102
- package/dist/esm/store/contracts/privacy-token.store.js +1 -0
- package/dist/esm/store/createStore.js +101 -187
- package/dist/esm/store/index.js +1 -10
- package/dist/esm/store/locks/appstate.lock.js +26 -0
- package/dist/esm/store/locks/auth.lock.js +15 -0
- package/dist/esm/store/locks/contact.lock.js +20 -0
- package/dist/esm/store/locks/device-list.lock.js +20 -0
- package/dist/esm/store/locks/message.lock.js +21 -0
- package/dist/esm/store/locks/participants.lock.js +20 -0
- package/dist/esm/store/locks/privacy-token.lock.js +18 -0
- package/dist/esm/store/locks/retry.lock.js +29 -0
- package/dist/esm/store/locks/sender-key.lock.js +52 -0
- package/dist/esm/store/locks/signal.lock.js +63 -0
- package/dist/esm/store/locks/thread.lock.js +21 -0
- package/dist/esm/store/noop.store.js +1 -1
- package/dist/esm/store/providers/memory/appstate.store.js +22 -24
- package/dist/esm/store/providers/memory/device-list.store.js +10 -5
- package/dist/esm/store/providers/memory/privacy-token.store.js +43 -0
- package/dist/esm/store/providers/memory/retry.store.js +77 -2
- package/dist/esm/store/providers/memory/sender-key.store.js +6 -1
- package/dist/esm/store/providers/memory/signal.store.js +36 -19
- package/dist/esm/transport/WaComms.js +3 -1
- package/dist/esm/transport/WaWebSocket.js +0 -6
- package/dist/esm/transport/binary/constants.js +0 -30
- package/dist/esm/transport/binary/decoder.js +4 -4
- package/dist/esm/transport/binary/encoder.js +8 -15
- package/dist/esm/transport/binary/index.js +0 -1
- package/dist/esm/transport/node/WaNodeOrchestrator.js +25 -19
- package/dist/esm/transport/node/builders/business.js +129 -0
- package/dist/esm/transport/node/builders/global.js +370 -0
- package/dist/esm/transport/node/builders/index.js +5 -2
- package/dist/esm/transport/node/builders/message.js +63 -239
- package/dist/esm/transport/node/builders/pairing.js +0 -24
- package/dist/esm/transport/node/builders/privacy-token.js +41 -0
- package/dist/esm/transport/node/builders/privacy.js +48 -0
- package/dist/esm/transport/node/builders/profile.js +70 -0
- package/dist/esm/transport/node/builders/retry.js +10 -22
- package/dist/esm/transport/node/builders/usync.js +6 -2
- package/dist/esm/transport/node/helpers.js +19 -1
- package/dist/esm/transport/node/usync.js +3 -33
- package/dist/esm/transport/node/xml.js +35 -14
- package/dist/esm/transport/noise/WaClientPayload.js +10 -10
- package/dist/esm/transport/noise/WaNoiseCert.js +3 -3
- package/dist/esm/transport/noise/WaNoiseSession.js +64 -23
- package/dist/esm/transport/noise/WaNoiseSocket.js +8 -4
- package/dist/esm/transport/stream/parse.js +8 -4
- package/dist/esm/util/bytes.js +22 -18
- package/dist/esm/util/index.js +5 -0
- package/dist/esm/util/primitives.js +3 -2
- package/dist/index.js +7 -1
- package/dist/infra/perf/BackgroundQueue.js +482 -0
- package/dist/infra/perf/BoundedTaskQueue.js +3 -1
- package/dist/infra/perf/PromiseDedup.js +24 -0
- package/dist/infra/perf/SharedExclusiveGate.js +113 -0
- package/dist/infra/perf/StoreLock.js +81 -0
- package/dist/media/WaMediaCrypto.js +94 -12
- package/dist/media/WaMediaTransferClient.js +39 -47
- package/dist/media/constants.js +2 -1
- package/dist/message/WaMessageClient.js +26 -19
- package/dist/message/content.js +198 -9
- package/dist/message/icdc.js +81 -0
- package/dist/message/incoming.js +24 -12
- package/dist/message/phash.js +3 -1
- package/dist/message/reporting-token.js +14 -28
- package/dist/protocol/appstate.js +10 -41
- package/dist/protocol/browser.js +10 -18
- package/dist/protocol/constants.js +21 -2
- package/dist/protocol/defaults.js +6 -0
- package/dist/protocol/index.js +8 -5
- package/dist/protocol/jid.js +111 -36
- package/dist/protocol/message.js +62 -2
- package/dist/protocol/nodes.js +2 -0
- package/dist/protocol/notification.js +3 -1
- package/dist/protocol/privacy-token.js +20 -0
- package/dist/protocol/privacy.js +58 -0
- package/dist/protocol/stream.js +27 -2
- package/dist/retry/codec.js +220 -0
- package/dist/retry/constants.js +1 -1
- package/dist/retry/index.js +5 -5
- package/dist/retry/parse.js +51 -30
- package/dist/retry/replay.js +10 -6
- package/dist/retry/tracker.js +50 -12
- package/dist/signal/api/SignalDeviceSyncApi.js +48 -31
- package/dist/signal/api/SignalDigestSyncApi.js +13 -9
- package/dist/signal/api/SignalIdentitySyncApi.js +25 -10
- package/dist/signal/api/SignalMissingPreKeysSyncApi.js +17 -6
- package/dist/signal/api/SignalRotateKeyApi.js +4 -2
- package/dist/signal/api/SignalSessionSyncApi.js +16 -7
- package/dist/signal/api/result-map.js +13 -0
- package/dist/signal/constants.js +1 -5
- package/dist/signal/crypto/WaAdvSignature.js +11 -5
- package/dist/signal/{store/sqlite.js → encoding.js} +79 -25
- package/dist/signal/group/SenderKeyCodec.js +4 -3
- package/dist/signal/group/SenderKeyManager.js +125 -106
- package/dist/signal/index.js +13 -1
- package/dist/signal/registration/keygen.js +6 -2
- package/dist/signal/registration/utils.js +1 -0
- package/dist/signal/session/SignalProtocol.js +150 -74
- package/dist/signal/session/resolver.js +135 -100
- package/dist/store/contracts/privacy-token.store.js +2 -0
- package/dist/store/createStore.js +101 -187
- package/dist/store/index.js +15 -33
- package/dist/store/locks/appstate.lock.js +29 -0
- package/dist/store/locks/auth.lock.js +18 -0
- package/dist/store/locks/contact.lock.js +23 -0
- package/dist/store/locks/device-list.lock.js +23 -0
- package/dist/store/locks/message.lock.js +24 -0
- package/dist/store/locks/participants.lock.js +23 -0
- package/dist/store/locks/privacy-token.lock.js +21 -0
- package/dist/store/locks/retry.lock.js +32 -0
- package/dist/store/locks/sender-key.lock.js +55 -0
- package/dist/store/locks/signal.lock.js +66 -0
- package/dist/store/locks/thread.lock.js +24 -0
- package/dist/store/noop.store.js +1 -1
- package/dist/store/providers/memory/appstate.store.js +22 -24
- package/dist/store/providers/memory/device-list.store.js +10 -5
- package/dist/store/providers/memory/privacy-token.store.js +47 -0
- package/dist/store/providers/memory/retry.store.js +77 -2
- package/dist/store/providers/memory/sender-key.store.js +6 -1
- package/dist/store/providers/memory/signal.store.js +36 -19
- package/dist/transport/WaComms.js +3 -1
- package/dist/transport/WaWebSocket.js +0 -6
- package/dist/transport/binary/constants.js +1 -31
- package/dist/transport/binary/decoder.js +4 -4
- package/dist/transport/binary/encoder.js +8 -15
- package/dist/transport/binary/index.js +0 -4
- package/dist/transport/node/WaNodeOrchestrator.js +24 -18
- package/dist/transport/node/builders/business.js +137 -0
- package/dist/transport/node/builders/global.js +375 -0
- package/dist/transport/node/builders/index.js +18 -9
- package/dist/transport/node/builders/message.js +64 -245
- package/dist/transport/node/builders/pairing.js +0 -26
- package/dist/transport/node/builders/privacy-token.js +46 -0
- package/dist/transport/node/builders/privacy.js +55 -0
- package/dist/transport/node/builders/profile.js +78 -0
- package/dist/transport/node/builders/retry.js +9 -21
- package/dist/transport/node/builders/usync.js +6 -2
- package/dist/transport/node/helpers.js +20 -1
- package/dist/transport/node/usync.js +2 -32
- package/dist/transport/node/xml.js +35 -14
- package/dist/transport/noise/WaClientPayload.js +13 -13
- package/dist/transport/noise/WaNoiseCert.js +2 -2
- package/dist/transport/noise/WaNoiseSession.js +64 -23
- package/dist/transport/noise/WaNoiseSocket.js +8 -4
- package/dist/transport/stream/parse.js +7 -3
- package/dist/types/appstate/encoding.d.ts +7 -0
- package/dist/types/appstate/index.d.ts +3 -3
- package/dist/types/appstate/utils.d.ts +0 -2
- package/dist/types/auth/flow/WaAuthCredentialsFlow.d.ts +1 -1
- package/dist/types/auth/index.d.ts +0 -2
- package/dist/types/auth/types.d.ts +1 -0
- package/dist/types/client/WaClient.d.ts +27 -12
- package/dist/types/client/WaClientFactory.d.ts +12 -4
- package/dist/types/client/connection/WaConnectionManager.d.ts +2 -0
- package/dist/types/client/coordinators/WaBusinessCoordinator.d.ts +57 -0
- package/dist/types/client/coordinators/WaIncomingNodeCoordinator.d.ts +3 -1
- package/dist/types/client/coordinators/WaMessageDispatchCoordinator.d.ts +14 -0
- package/dist/types/client/coordinators/WaPassiveTasksCoordinator.d.ts +4 -0
- package/dist/types/client/coordinators/WaPrivacyCoordinator.d.ts +26 -0
- package/dist/types/client/coordinators/WaProfileCoordinator.d.ts +36 -0
- package/dist/types/client/coordinators/WaRetryCoordinator.d.ts +6 -0
- package/dist/types/client/coordinators/WaStreamControlCoordinator.d.ts +3 -2
- package/dist/types/client/coordinators/WaTrustedContactTokenCoordinator.d.ts +45 -0
- package/dist/types/client/events/devices.d.ts +20 -0
- package/dist/types/client/events/identity.d.ts +9 -0
- package/dist/types/client/events/privacy-token.d.ts +7 -0
- package/dist/types/client/history-sync.d.ts +9 -6
- package/dist/types/client/incoming.d.ts +3 -1
- package/dist/types/client/index.d.ts +1 -1
- package/dist/types/client/mailbox.d.ts +3 -5
- package/dist/types/client/messages.d.ts +1 -2
- package/dist/types/client/persistence/WriteBehindPersistence.d.ts +34 -0
- package/dist/types/client/tokens/cs-token.d.ts +10 -0
- package/dist/types/client/tokens/tc-token.d.ts +5 -0
- package/dist/types/client/types.d.ts +51 -3
- package/dist/types/crypto/core/index.d.ts +2 -2
- package/dist/types/crypto/core/nonce.d.ts +2 -0
- package/dist/types/crypto/core/primitives.d.ts +0 -1
- package/dist/types/crypto/core/random.d.ts +1 -0
- package/dist/types/crypto/index.d.ts +1 -0
- package/dist/types/crypto/math/constants.d.ts +4 -2
- package/dist/types/crypto/math/fe.d.ts +30 -0
- package/dist/types/crypto/math/mod.d.ts +0 -2
- package/dist/types/crypto/math/types.d.ts +11 -4
- package/dist/types/index.d.ts +5 -3
- package/dist/types/infra/perf/BackgroundQueue.d.ts +58 -0
- package/dist/types/infra/perf/PromiseDedup.d.ts +4 -0
- package/dist/types/infra/perf/SharedExclusiveGate.d.ts +17 -0
- package/dist/types/infra/perf/StoreLock.d.ts +10 -0
- package/dist/types/media/WaMediaCrypto.d.ts +3 -2
- package/dist/types/media/WaMediaTransferClient.d.ts +3 -12
- package/dist/types/media/constants.d.ts +1 -1
- package/dist/types/media/index.d.ts +1 -1
- package/dist/types/media/types.d.ts +10 -2
- package/dist/types/message/content.d.ts +8 -0
- package/dist/types/message/icdc.d.ts +13 -0
- package/dist/types/message/reporting-token.d.ts +0 -1
- package/dist/types/message/types.d.ts +45 -6
- package/dist/types/protocol/appstate.d.ts +0 -11
- package/dist/types/protocol/constants.d.ts +7 -3
- package/dist/types/protocol/defaults.d.ts +6 -0
- package/dist/types/protocol/index.d.ts +1 -2
- package/dist/types/protocol/jid.d.ts +19 -2
- package/dist/types/protocol/message.d.ts +60 -0
- package/dist/types/protocol/nodes.d.ts +2 -0
- package/dist/types/protocol/notification.d.ts +2 -0
- package/dist/types/protocol/privacy-token.d.ts +17 -0
- package/dist/types/protocol/privacy.d.ts +75 -0
- package/dist/types/protocol/stream.d.ts +30 -0
- package/dist/types/retry/codec.d.ts +3 -0
- package/dist/types/retry/index.d.ts +3 -3
- package/dist/types/retry/parse.d.ts +5 -2
- package/dist/types/retry/tracker.d.ts +1 -0
- package/dist/types/retry/types.d.ts +6 -1
- package/dist/types/signal/api/SignalDeviceSyncApi.d.ts +2 -1
- package/dist/types/signal/api/SignalDigestSyncApi.d.ts +6 -0
- package/dist/types/signal/api/SignalIdentitySyncApi.d.ts +2 -0
- package/dist/types/signal/api/SignalRotateKeyApi.d.ts +4 -5
- package/dist/types/signal/api/SignalSessionSyncApi.d.ts +8 -6
- package/dist/types/signal/api/result-map.d.ts +1 -0
- package/dist/types/signal/constants.d.ts +0 -3
- package/dist/types/signal/{store/sqlite.d.ts → encoding.d.ts} +3 -3
- package/dist/types/signal/group/SenderKeyManager.d.ts +10 -5
- package/dist/types/signal/index.d.ts +2 -0
- package/dist/types/signal/session/SignalProtocol.d.ts +10 -4
- package/dist/types/signal/session/resolver.d.ts +7 -2
- package/dist/types/store/contracts/appstate.store.d.ts +1 -1
- package/dist/types/store/contracts/privacy-token.store.d.ts +16 -0
- package/dist/types/store/contracts/retry.store.d.ts +7 -0
- package/dist/types/store/contracts/signal.store.d.ts +7 -0
- package/dist/types/store/createStore.d.ts +1 -1
- package/dist/types/store/index.d.ts +5 -13
- package/dist/types/store/locks/appstate.lock.d.ts +3 -0
- package/dist/types/store/locks/auth.lock.d.ts +3 -0
- package/dist/types/store/locks/contact.lock.d.ts +3 -0
- package/dist/types/store/locks/device-list.lock.d.ts +2 -0
- package/dist/types/store/locks/message.lock.d.ts +3 -0
- package/dist/types/store/locks/participants.lock.d.ts +2 -0
- package/dist/types/store/locks/privacy-token.lock.d.ts +2 -0
- package/dist/types/store/locks/retry.lock.d.ts +2 -0
- package/dist/types/store/locks/sender-key.lock.d.ts +3 -0
- package/dist/types/store/locks/signal.lock.d.ts +3 -0
- package/dist/types/store/locks/thread.lock.d.ts +3 -0
- package/dist/types/store/providers/memory/appstate.store.d.ts +1 -1
- package/dist/types/store/providers/memory/privacy-token.store.d.ts +13 -0
- package/dist/types/store/providers/memory/retry.store.d.ts +8 -0
- package/dist/types/store/providers/memory/signal.store.d.ts +2 -1
- package/dist/types/store/types.d.ts +49 -61
- package/dist/types/transport/WaWebSocket.d.ts +0 -1
- package/dist/types/transport/binary/constants.d.ts +0 -30
- package/dist/types/transport/binary/index.d.ts +0 -1
- package/dist/types/transport/node/WaNodeOrchestrator.d.ts +3 -4
- package/dist/types/transport/node/builders/business.d.ts +29 -0
- package/dist/types/transport/node/builders/global.d.ts +102 -0
- package/dist/types/transport/node/builders/index.d.ts +5 -2
- package/dist/types/transport/node/builders/message.d.ts +8 -7
- package/dist/types/transport/node/builders/pairing.d.ts +0 -2
- package/dist/types/transport/node/builders/privacy-token.d.ts +9 -0
- package/dist/types/transport/node/builders/privacy.d.ts +7 -0
- package/dist/types/transport/node/builders/profile.d.ts +8 -0
- package/dist/types/transport/node/builders/retry.d.ts +0 -1
- package/dist/types/transport/node/helpers.d.ts +5 -0
- package/dist/types/transport/noise/WaNoiseSession.d.ts +3 -2
- package/dist/types/transport/noise/WaNoiseSocket.d.ts +4 -2
- package/dist/types/util/bytes.d.ts +1 -1
- package/dist/types/util/index.d.ts +5 -0
- package/dist/types/util/primitives.d.ts +0 -1
- package/dist/util/bytes.js +22 -18
- package/dist/util/index.js +23 -0
- package/dist/util/primitives.js +2 -2
- package/package.json +29 -7
- package/proto/index.js +1 -1
- package/dist/crypto/core/constants.js +0 -4
- package/dist/esm/crypto/core/constants.js +0 -1
- package/dist/esm/retry/outbound.js +0 -82
- package/dist/esm/store/providers/sqlite/BaseSqliteStore.js +0 -37
- package/dist/esm/store/providers/sqlite/appstate.store.js +0 -250
- package/dist/esm/store/providers/sqlite/auth.store.js +0 -176
- package/dist/esm/store/providers/sqlite/connection.js +0 -245
- package/dist/esm/store/providers/sqlite/contact.store.js +0 -74
- package/dist/esm/store/providers/sqlite/device-list.store.js +0 -127
- package/dist/esm/store/providers/sqlite/message.store.js +0 -132
- package/dist/esm/store/providers/sqlite/migrations.js +0 -347
- package/dist/esm/store/providers/sqlite/participants.store.js +0 -77
- package/dist/esm/store/providers/sqlite/retry.store.js +0 -141
- package/dist/esm/store/providers/sqlite/sender-key.store.js +0 -198
- package/dist/esm/store/providers/sqlite/signal.store.js +0 -435
- package/dist/esm/store/providers/sqlite/table-names.js +0 -107
- package/dist/esm/store/providers/sqlite/thread.store.js +0 -85
- package/dist/retry/outbound.js +0 -87
- package/dist/store/providers/sqlite/BaseSqliteStore.js +0 -41
- package/dist/store/providers/sqlite/appstate.store.js +0 -254
- package/dist/store/providers/sqlite/auth.store.js +0 -180
- package/dist/store/providers/sqlite/connection.js +0 -281
- package/dist/store/providers/sqlite/contact.store.js +0 -78
- package/dist/store/providers/sqlite/device-list.store.js +0 -131
- package/dist/store/providers/sqlite/message.store.js +0 -136
- package/dist/store/providers/sqlite/migrations.js +0 -350
- package/dist/store/providers/sqlite/participants.store.js +0 -81
- package/dist/store/providers/sqlite/retry.store.js +0 -145
- package/dist/store/providers/sqlite/sender-key.store.js +0 -202
- package/dist/store/providers/sqlite/signal.store.js +0 -439
- package/dist/store/providers/sqlite/table-names.js +0 -113
- package/dist/store/providers/sqlite/thread.store.js +0 -89
- package/dist/types/appstate/store/sqlite.d.ts +0 -7
- package/dist/types/crypto/core/constants.d.ts +0 -1
- package/dist/types/retry/outbound.d.ts +0 -4
- package/dist/types/store/providers/sqlite/BaseSqliteStore.d.ts +0 -12
- package/dist/types/store/providers/sqlite/appstate.store.d.ts +0 -17
- package/dist/types/store/providers/sqlite/auth.store.d.ts +0 -10
- package/dist/types/store/providers/sqlite/connection.d.ts +0 -10
- package/dist/types/store/providers/sqlite/contact.store.d.ts +0 -12
- package/dist/types/store/providers/sqlite/device-list.store.d.ts +0 -15
- package/dist/types/store/providers/sqlite/message.store.d.ts +0 -13
- package/dist/types/store/providers/sqlite/migrations.d.ts +0 -3
- package/dist/types/store/providers/sqlite/participants.store.d.ts +0 -12
- package/dist/types/store/providers/sqlite/retry.store.d.ts +0 -15
- package/dist/types/store/providers/sqlite/sender-key.store.d.ts +0 -24
- package/dist/types/store/providers/sqlite/signal.store.d.ts +0 -53
- package/dist/types/store/providers/sqlite/table-names.d.ts +0 -5
- package/dist/types/store/providers/sqlite/thread.store.d.ts +0 -13
|
@@ -1,59 +1,31 @@
|
|
|
1
|
+
import { withAppStateLock } from './locks/appstate.lock.js';
|
|
2
|
+
import { withAuthLock } from './locks/auth.lock.js';
|
|
3
|
+
import { withContactLock } from './locks/contact.lock.js';
|
|
4
|
+
import { withDeviceListLock } from './locks/device-list.lock.js';
|
|
5
|
+
import { withMessageLock } from './locks/message.lock.js';
|
|
6
|
+
import { withParticipantsLock } from './locks/participants.lock.js';
|
|
7
|
+
import { withPrivacyTokenLock } from './locks/privacy-token.lock.js';
|
|
8
|
+
import { withRetryLock } from './locks/retry.lock.js';
|
|
9
|
+
import { withSenderKeyLock } from './locks/sender-key.lock.js';
|
|
10
|
+
import { withSignalLock } from './locks/signal.lock.js';
|
|
11
|
+
import { withThreadLock } from './locks/thread.lock.js';
|
|
1
12
|
import { NOOP_CONTACT_STORE, NOOP_DEVICE_LIST_STORE, NOOP_MESSAGE_STORE, NOOP_PARTICIPANTS_STORE, NOOP_THREAD_STORE } from './noop.store.js';
|
|
2
13
|
import { WaAppStateMemoryStore } from './providers/memory/appstate.store.js';
|
|
3
14
|
import { WaContactMemoryStore } from './providers/memory/contact.store.js';
|
|
4
15
|
import { WaDeviceListMemoryStore } from './providers/memory/device-list.store.js';
|
|
5
16
|
import { WaMessageMemoryStore } from './providers/memory/message.store.js';
|
|
6
17
|
import { WaParticipantsMemoryStore } from './providers/memory/participants.store.js';
|
|
18
|
+
import { WaPrivacyTokenMemoryStore } from './providers/memory/privacy-token.store.js';
|
|
7
19
|
import { WaRetryMemoryStore } from './providers/memory/retry.store.js';
|
|
8
20
|
import { SenderKeyMemoryStore } from './providers/memory/sender-key.store.js';
|
|
9
21
|
import { WaSignalMemoryStore } from './providers/memory/signal.store.js';
|
|
10
22
|
import { WaThreadMemoryStore } from './providers/memory/thread.store.js';
|
|
11
|
-
import { WaAppStateSqliteStore } from './providers/sqlite/appstate.store.js';
|
|
12
|
-
import { WaAuthSqliteStore } from './providers/sqlite/auth.store.js';
|
|
13
|
-
import { WaContactSqliteStore } from './providers/sqlite/contact.store.js';
|
|
14
|
-
import { WaDeviceListSqliteStore } from './providers/sqlite/device-list.store.js';
|
|
15
|
-
import { WaMessageSqliteStore } from './providers/sqlite/message.store.js';
|
|
16
|
-
import { WaParticipantsSqliteStore } from './providers/sqlite/participants.store.js';
|
|
17
|
-
import { WaRetrySqliteStore } from './providers/sqlite/retry.store.js';
|
|
18
|
-
import { SenderKeySqliteStore } from './providers/sqlite/sender-key.store.js';
|
|
19
|
-
import { WaSignalSqliteStore } from './providers/sqlite/signal.store.js';
|
|
20
|
-
import { WaThreadSqliteStore } from './providers/sqlite/thread.store.js';
|
|
21
23
|
import { resolvePositive } from '../util/coercion.js';
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
signal: 'sqlite',
|
|
25
|
-
senderKey: 'sqlite',
|
|
26
|
-
appState: 'sqlite',
|
|
27
|
-
messages: 'none',
|
|
28
|
-
threads: 'none',
|
|
29
|
-
contacts: 'none'
|
|
30
|
-
};
|
|
31
|
-
const DEFAULT_CACHE_PROVIDERS = {
|
|
32
|
-
retry: 'memory',
|
|
33
|
-
participants: 'memory',
|
|
34
|
-
deviceList: 'memory'
|
|
35
|
-
};
|
|
36
|
-
const DEFAULT_CACHE_TTLS_MS = {
|
|
37
|
-
retryMs: 7 * 24 * 60 * 60 * 1000,
|
|
24
|
+
const DEFAULT_CACHE_TTLS_MS = Object.freeze({
|
|
25
|
+
retryMs: 60 * 1000,
|
|
38
26
|
participantsMs: 5 * 60 * 1000,
|
|
39
27
|
deviceListMs: 5 * 60 * 1000
|
|
40
|
-
};
|
|
41
|
-
const DEFAULT_SQLITE_BATCH_SIZES = {
|
|
42
|
-
deviceList: 500,
|
|
43
|
-
senderKeyDistribution: 250,
|
|
44
|
-
signalPreKey: 500,
|
|
45
|
-
signalHasSession: 250
|
|
46
|
-
};
|
|
47
|
-
function resolveStoreValue(sessionId, value, domainPath) {
|
|
48
|
-
if (!value) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const resolved = typeof value === 'function' ? value(sessionId) : value;
|
|
52
|
-
if (!resolved) {
|
|
53
|
-
throw new Error(`${domainPath} must resolve to a store instance`);
|
|
54
|
-
}
|
|
55
|
-
return resolved;
|
|
56
|
-
}
|
|
28
|
+
});
|
|
57
29
|
function hasDestroy(value) {
|
|
58
30
|
return (!!value &&
|
|
59
31
|
typeof value === 'object' &&
|
|
@@ -61,30 +33,32 @@ function hasDestroy(value) {
|
|
|
61
33
|
typeof value.destroy === 'function');
|
|
62
34
|
}
|
|
63
35
|
async function destroyIfSupported(value) {
|
|
64
|
-
if (!hasDestroy(value))
|
|
36
|
+
if (!hasDestroy(value))
|
|
65
37
|
return;
|
|
66
|
-
}
|
|
67
38
|
await value.destroy();
|
|
68
39
|
}
|
|
40
|
+
function resolveStore(sessionId, backends, provider, domain, kind, fallback) {
|
|
41
|
+
if (!provider || provider === 'memory' || provider === 'none') {
|
|
42
|
+
return fallback();
|
|
43
|
+
}
|
|
44
|
+
const backend = backends[provider];
|
|
45
|
+
if (!backend) {
|
|
46
|
+
throw new Error(`unknown backend '${provider}' for ${domain}`);
|
|
47
|
+
}
|
|
48
|
+
const factory = backend[kind][domain];
|
|
49
|
+
if (!factory) {
|
|
50
|
+
throw new Error(`backend '${provider}' does not provide ${kind}.${domain}`);
|
|
51
|
+
}
|
|
52
|
+
return factory(sessionId);
|
|
53
|
+
}
|
|
69
54
|
export function createStore(options) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
const cacheProviders = {
|
|
75
|
-
...DEFAULT_CACHE_PROVIDERS,
|
|
76
|
-
...(options.cacheProviders ?? {})
|
|
77
|
-
};
|
|
55
|
+
const backends = (options.backends ?? {});
|
|
56
|
+
const providers = options.providers ?? {};
|
|
57
|
+
const cacheProviders = options.cacheProviders ?? {};
|
|
78
58
|
const cacheTtlsMs = Object.freeze({
|
|
79
|
-
retry: resolvePositive(options.cacheTtlMs?.retryMs, DEFAULT_CACHE_TTLS_MS.retryMs, 'cacheTtlMs.retryMs'),
|
|
80
|
-
participants: resolvePositive(options.cacheTtlMs?.participantsMs, DEFAULT_CACHE_TTLS_MS.participantsMs, 'cacheTtlMs.participantsMs'),
|
|
81
|
-
deviceList: resolvePositive(options.cacheTtlMs?.deviceListMs, DEFAULT_CACHE_TTLS_MS.deviceListMs, 'cacheTtlMs.deviceListMs')
|
|
82
|
-
});
|
|
83
|
-
const sqliteBatchSizes = Object.freeze({
|
|
84
|
-
deviceList: resolvePositive(options.sqlite?.batchSizes?.deviceList, DEFAULT_SQLITE_BATCH_SIZES.deviceList, 'sqlite.batchSizes.deviceList'),
|
|
85
|
-
senderKeyDistribution: resolvePositive(options.sqlite?.batchSizes?.senderKeyDistribution, DEFAULT_SQLITE_BATCH_SIZES.senderKeyDistribution, 'sqlite.batchSizes.senderKeyDistribution'),
|
|
86
|
-
signalPreKey: resolvePositive(options.sqlite?.batchSizes?.signalPreKey, DEFAULT_SQLITE_BATCH_SIZES.signalPreKey, 'sqlite.batchSizes.signalPreKey'),
|
|
87
|
-
signalHasSession: resolvePositive(options.sqlite?.batchSizes?.signalHasSession, DEFAULT_SQLITE_BATCH_SIZES.signalHasSession, 'sqlite.batchSizes.signalHasSession')
|
|
59
|
+
retry: resolvePositive(options.memory?.cacheTtlMs?.retryMs, DEFAULT_CACHE_TTLS_MS.retryMs, 'memory.cacheTtlMs.retryMs'),
|
|
60
|
+
participants: resolvePositive(options.memory?.cacheTtlMs?.participantsMs, DEFAULT_CACHE_TTLS_MS.participantsMs, 'memory.cacheTtlMs.participantsMs'),
|
|
61
|
+
deviceList: resolvePositive(options.memory?.cacheTtlMs?.deviceListMs, DEFAULT_CACHE_TTLS_MS.deviceListMs, 'memory.cacheTtlMs.deviceListMs')
|
|
88
62
|
});
|
|
89
63
|
const sessions = new Map();
|
|
90
64
|
let storeDestroyed = false;
|
|
@@ -93,125 +67,67 @@ export function createStore(options) {
|
|
|
93
67
|
if (storeDestroyed) {
|
|
94
68
|
throw new Error('store has been destroyed');
|
|
95
69
|
}
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
70
|
+
const id = sessionId.trim();
|
|
71
|
+
if (id.length === 0) {
|
|
98
72
|
throw new Error('sessionId must be a non-empty string');
|
|
99
73
|
}
|
|
100
|
-
const cached = sessions.get(
|
|
101
|
-
if (cached)
|
|
74
|
+
const cached = sessions.get(id);
|
|
75
|
+
if (cached)
|
|
102
76
|
return cached;
|
|
103
|
-
}
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
(providers.senderKey === 'memory'
|
|
153
|
-
? new SenderKeyMemoryStore({
|
|
154
|
-
maxSenderKeys: memoryLimits.senderKeys,
|
|
155
|
-
maxSenderDistributions: memoryLimits.senderDistributions
|
|
156
|
-
})
|
|
157
|
-
: new SenderKeySqliteStore(sqliteOptions, sqliteBatchSizes.senderKeyDistribution));
|
|
158
|
-
const appStateStore = customAppState ??
|
|
159
|
-
(providers.appState === 'memory'
|
|
160
|
-
? new WaAppStateMemoryStore(undefined, {
|
|
161
|
-
maxSyncKeys: memoryLimits.appStateSyncKeys,
|
|
162
|
-
maxCollectionEntries: memoryLimits.appStateCollectionEntries
|
|
163
|
-
})
|
|
164
|
-
: new WaAppStateSqliteStore(sqliteOptions));
|
|
165
|
-
const retryStore = customRetry ??
|
|
166
|
-
(cacheProviders.retry === 'memory'
|
|
167
|
-
? new WaRetryMemoryStore(cacheTtlsMs.retry)
|
|
168
|
-
: new WaRetrySqliteStore(sqliteOptions, cacheTtlsMs.retry));
|
|
169
|
-
const participantsStore = customParticipants ??
|
|
170
|
-
(cacheProviders.participants === 'sqlite'
|
|
171
|
-
? new WaParticipantsSqliteStore(sqliteOptions, cacheTtlsMs.participants)
|
|
172
|
-
: cacheProviders.participants === 'memory'
|
|
173
|
-
? new WaParticipantsMemoryStore(cacheTtlsMs.participants, {
|
|
174
|
-
maxGroups: memoryLimits.participantsGroups
|
|
175
|
-
})
|
|
176
|
-
: NOOP_PARTICIPANTS_STORE);
|
|
177
|
-
const deviceListStore = customDeviceList ??
|
|
178
|
-
(cacheProviders.deviceList === 'sqlite'
|
|
179
|
-
? new WaDeviceListSqliteStore(sqliteOptions, cacheTtlsMs.deviceList, sqliteBatchSizes.deviceList)
|
|
180
|
-
: cacheProviders.deviceList === 'memory'
|
|
181
|
-
? new WaDeviceListMemoryStore(cacheTtlsMs.deviceList, {
|
|
182
|
-
maxUsers: memoryLimits.deviceListUsers
|
|
183
|
-
})
|
|
184
|
-
: NOOP_DEVICE_LIST_STORE);
|
|
185
|
-
const messageStore = customMessages ??
|
|
186
|
-
(providers.messages === 'sqlite'
|
|
187
|
-
? new WaMessageSqliteStore(sqliteOptions)
|
|
188
|
-
: providers.messages === 'memory'
|
|
189
|
-
? new WaMessageMemoryStore({
|
|
190
|
-
maxMessages: memoryLimits.messages
|
|
191
|
-
})
|
|
192
|
-
: NOOP_MESSAGE_STORE);
|
|
193
|
-
const threadStore = customThreads ??
|
|
194
|
-
(providers.threads === 'sqlite'
|
|
195
|
-
? new WaThreadSqliteStore(sqliteOptions)
|
|
196
|
-
: providers.threads === 'memory'
|
|
197
|
-
? new WaThreadMemoryStore({
|
|
198
|
-
maxThreads: memoryLimits.threads
|
|
199
|
-
})
|
|
200
|
-
: NOOP_THREAD_STORE);
|
|
201
|
-
const contactStore = customContacts ??
|
|
202
|
-
(providers.contacts === 'sqlite'
|
|
203
|
-
? new WaContactSqliteStore(sqliteOptions)
|
|
204
|
-
: providers.contacts === 'memory'
|
|
205
|
-
? new WaContactMemoryStore({
|
|
206
|
-
maxContacts: memoryLimits.contacts
|
|
207
|
-
})
|
|
208
|
-
: NOOP_CONTACT_STORE);
|
|
77
|
+
const ml = options.memory?.limits ?? {};
|
|
78
|
+
const rawAuth = resolveStore(id, backends, providers.auth, 'auth', 'stores', () => {
|
|
79
|
+
throw new Error('providers.auth is required — register a backend or set providers.auth');
|
|
80
|
+
});
|
|
81
|
+
const rawSignal = resolveStore(id, backends, providers.signal ?? 'memory', 'signal', 'stores', () => new WaSignalMemoryStore({
|
|
82
|
+
maxPreKeys: ml.signalPreKeys,
|
|
83
|
+
maxSessions: ml.signalSessions,
|
|
84
|
+
maxRemoteIdentities: ml.signalRemoteIdentities
|
|
85
|
+
}));
|
|
86
|
+
const rawSenderKey = resolveStore(id, backends, providers.senderKey ?? 'memory', 'senderKey', 'stores', () => new SenderKeyMemoryStore({
|
|
87
|
+
maxSenderKeys: ml.senderKeys,
|
|
88
|
+
maxSenderDistributions: ml.senderDistributions
|
|
89
|
+
}));
|
|
90
|
+
const rawAppState = resolveStore(id, backends, providers.appState ?? 'memory', 'appState', 'stores', () => new WaAppStateMemoryStore(undefined, {
|
|
91
|
+
maxSyncKeys: ml.appStateSyncKeys,
|
|
92
|
+
maxCollectionEntries: ml.appStateCollectionEntries
|
|
93
|
+
}));
|
|
94
|
+
const rawMessages = resolveStore(id, backends, providers.messages ?? 'none', 'messages', 'stores', () => providers.messages === 'memory'
|
|
95
|
+
? new WaMessageMemoryStore({ maxMessages: ml.messages })
|
|
96
|
+
: NOOP_MESSAGE_STORE);
|
|
97
|
+
const rawThreads = resolveStore(id, backends, providers.threads ?? 'none', 'threads', 'stores', () => providers.threads === 'memory'
|
|
98
|
+
? new WaThreadMemoryStore({ maxThreads: ml.threads })
|
|
99
|
+
: NOOP_THREAD_STORE);
|
|
100
|
+
const rawContacts = resolveStore(id, backends, providers.contacts ?? 'none', 'contacts', 'stores', () => providers.contacts === 'memory'
|
|
101
|
+
? new WaContactMemoryStore({ maxContacts: ml.contacts })
|
|
102
|
+
: NOOP_CONTACT_STORE);
|
|
103
|
+
const rawPrivacyToken = resolveStore(id, backends, providers.privacyToken ?? 'memory', 'privacyToken', 'stores', () => new WaPrivacyTokenMemoryStore(ml.privacyTokens));
|
|
104
|
+
const rawRetry = resolveStore(id, backends, cacheProviders.retry ?? 'memory', 'retry', 'caches', () => new WaRetryMemoryStore(cacheTtlsMs.retry));
|
|
105
|
+
const rawParticipants = resolveStore(id, backends, cacheProviders.participants ?? 'memory', 'participants', 'caches', () => cacheProviders.participants === 'memory'
|
|
106
|
+
? new WaParticipantsMemoryStore(cacheTtlsMs.participants, {
|
|
107
|
+
maxGroups: ml.participantsGroups
|
|
108
|
+
})
|
|
109
|
+
: NOOP_PARTICIPANTS_STORE);
|
|
110
|
+
const rawDeviceList = resolveStore(id, backends, cacheProviders.deviceList ?? 'memory', 'deviceList', 'caches', () => cacheProviders.deviceList === 'memory'
|
|
111
|
+
? new WaDeviceListMemoryStore(cacheTtlsMs.deviceList, {
|
|
112
|
+
maxUsers: ml.deviceListUsers
|
|
113
|
+
})
|
|
114
|
+
: NOOP_DEVICE_LIST_STORE);
|
|
115
|
+
const authStore = withAuthLock(rawAuth);
|
|
116
|
+
const signalStore = withSignalLock(rawSignal);
|
|
117
|
+
const senderKeyStore = withSenderKeyLock(rawSenderKey);
|
|
118
|
+
const appStateStore = withAppStateLock(rawAppState);
|
|
119
|
+
const retryStore = withRetryLock(rawRetry);
|
|
120
|
+
const participantsStore = withParticipantsLock(rawParticipants);
|
|
121
|
+
const deviceListStore = withDeviceListLock(rawDeviceList);
|
|
122
|
+
const messageStore = withMessageLock(rawMessages);
|
|
123
|
+
const threadStore = withThreadLock(rawThreads);
|
|
124
|
+
const contactStore = withContactLock(rawContacts);
|
|
125
|
+
const privacyTokenStore = withPrivacyTokenLock(rawPrivacyToken);
|
|
209
126
|
let cachesDestroyed = false;
|
|
210
127
|
let sessionDestroyed = false;
|
|
211
128
|
const destroyCaches = async () => {
|
|
212
|
-
if (cachesDestroyed)
|
|
129
|
+
if (cachesDestroyed)
|
|
213
130
|
return;
|
|
214
|
-
}
|
|
215
131
|
cachesDestroyed = true;
|
|
216
132
|
await Promise.all([
|
|
217
133
|
retryStore.clear(),
|
|
@@ -225,9 +141,8 @@ export function createStore(options) {
|
|
|
225
141
|
]);
|
|
226
142
|
};
|
|
227
143
|
const destroy = async () => {
|
|
228
|
-
if (sessionDestroyed)
|
|
144
|
+
if (sessionDestroyed)
|
|
229
145
|
return;
|
|
230
|
-
}
|
|
231
146
|
sessionDestroyed = true;
|
|
232
147
|
await destroyCaches();
|
|
233
148
|
await Promise.all([
|
|
@@ -237,7 +152,8 @@ export function createStore(options) {
|
|
|
237
152
|
destroyIfSupported(appStateStore),
|
|
238
153
|
destroyIfSupported(messageStore),
|
|
239
154
|
destroyIfSupported(threadStore),
|
|
240
|
-
destroyIfSupported(contactStore)
|
|
155
|
+
destroyIfSupported(contactStore),
|
|
156
|
+
destroyIfSupported(privacyTokenStore)
|
|
241
157
|
]);
|
|
242
158
|
};
|
|
243
159
|
const session = {
|
|
@@ -251,26 +167,24 @@ export function createStore(options) {
|
|
|
251
167
|
messages: messageStore,
|
|
252
168
|
threads: threadStore,
|
|
253
169
|
contacts: contactStore,
|
|
170
|
+
privacyToken: privacyTokenStore,
|
|
254
171
|
destroyCaches,
|
|
255
172
|
destroy
|
|
256
173
|
};
|
|
257
|
-
sessions.set(
|
|
174
|
+
sessions.set(id, session);
|
|
258
175
|
return session;
|
|
259
176
|
},
|
|
260
177
|
async destroyCaches() {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
178
|
+
const list = Array.from(sessions.values());
|
|
179
|
+
await Promise.all(list.map((s) => s.destroyCaches()));
|
|
264
180
|
},
|
|
265
181
|
async destroy() {
|
|
266
|
-
if (storeDestroyed)
|
|
182
|
+
if (storeDestroyed)
|
|
267
183
|
return;
|
|
268
|
-
}
|
|
269
184
|
storeDestroyed = true;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
185
|
+
const list = Array.from(sessions.values());
|
|
186
|
+
sessions.clear();
|
|
187
|
+
await Promise.all(list.map((s) => s.destroy()));
|
|
274
188
|
}
|
|
275
189
|
};
|
|
276
190
|
}
|
package/dist/esm/store/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
export { WaAuthSqliteStore } from './providers/sqlite/auth.store.js';
|
|
2
|
-
export { WaAppStateSqliteStore } from './providers/sqlite/appstate.store.js';
|
|
3
1
|
export { createStore } from './createStore.js';
|
|
4
|
-
export { WaSignalSqliteStore } from './providers/sqlite/signal.store.js';
|
|
5
|
-
export { SenderKeySqliteStore } from './providers/sqlite/sender-key.store.js';
|
|
6
|
-
export { WaRetrySqliteStore } from './providers/sqlite/retry.store.js';
|
|
7
|
-
export { WaParticipantsSqliteStore } from './providers/sqlite/participants.store.js';
|
|
8
|
-
export { WaDeviceListSqliteStore } from './providers/sqlite/device-list.store.js';
|
|
9
2
|
export { WaAppStateMemoryStore } from './providers/memory/appstate.store.js';
|
|
10
3
|
export { WaSignalMemoryStore } from './providers/memory/signal.store.js';
|
|
11
4
|
export { SenderKeyMemoryStore } from './providers/memory/sender-key.store.js';
|
|
@@ -15,6 +8,4 @@ export { WaDeviceListMemoryStore } from './providers/memory/device-list.store.js
|
|
|
15
8
|
export { WaContactMemoryStore } from './providers/memory/contact.store.js';
|
|
16
9
|
export { WaMessageMemoryStore } from './providers/memory/message.store.js';
|
|
17
10
|
export { WaThreadMemoryStore } from './providers/memory/thread.store.js';
|
|
18
|
-
export {
|
|
19
|
-
export { WaMessageSqliteStore } from './providers/sqlite/message.store.js';
|
|
20
|
-
export { WaThreadSqliteStore } from './providers/sqlite/thread.store.js';
|
|
11
|
+
export { WaPrivacyTokenMemoryStore } from './providers/memory/privacy-token.store.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
import { bytesToHex } from '../../util/bytes.js';
|
|
4
|
+
const WA_APPSTATE_CLEAR_KEY = 'appstate:clear';
|
|
5
|
+
export function withAppStateLock(store) {
|
|
6
|
+
const lock = new StoreLock();
|
|
7
|
+
const gate = new SharedExclusiveGate();
|
|
8
|
+
const destroyStore = store;
|
|
9
|
+
return {
|
|
10
|
+
exportData: () => gate.runShared(() => store.exportData()),
|
|
11
|
+
upsertSyncKeys: (keys) => gate.runShared(() => lock.runMany(keys.map((key) => `appstate:syncKey:${bytesToHex(key.keyId)}`), () => store.upsertSyncKeys(keys))),
|
|
12
|
+
getSyncKeysBatch: (keyIds) => gate.runShared(() => store.getSyncKeysBatch(keyIds)),
|
|
13
|
+
getSyncKeyData: (keyId) => gate.runShared(() => store.getSyncKeyData(keyId)),
|
|
14
|
+
getSyncKeyDataBatch: (keyIds) => gate.runShared(() => store.getSyncKeyDataBatch(keyIds)),
|
|
15
|
+
getActiveSyncKey: () => gate.runShared(() => store.getActiveSyncKey()),
|
|
16
|
+
getCollectionState: (collection) => gate.runShared(() => store.getCollectionState(collection)),
|
|
17
|
+
getCollectionStates: (collections) => gate.runShared(() => store.getCollectionStates(collections)),
|
|
18
|
+
setCollectionStates: (updates) => gate.runShared(() => lock.runMany(updates.map((update) => `appstate:collection:${update.collection}`), () => store.setCollectionStates(updates))),
|
|
19
|
+
clear: () => gate.runExclusive(() => lock.run(WA_APPSTATE_CLEAR_KEY, () => store.clear())),
|
|
20
|
+
destroy: async () => {
|
|
21
|
+
await gate.close();
|
|
22
|
+
await lock.shutdown();
|
|
23
|
+
await destroyStore.destroy?.();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
2
|
+
const WA_AUTH_KEY = 'credentials';
|
|
3
|
+
export function withAuthLock(store) {
|
|
4
|
+
const lock = new StoreLock();
|
|
5
|
+
const destroyStore = store;
|
|
6
|
+
return {
|
|
7
|
+
load: () => lock.run(WA_AUTH_KEY, () => store.load()),
|
|
8
|
+
save: (credentials) => lock.run(WA_AUTH_KEY, () => store.save(credentials)),
|
|
9
|
+
clear: () => lock.run(WA_AUTH_KEY, () => store.clear()),
|
|
10
|
+
destroy: async () => {
|
|
11
|
+
await lock.shutdown();
|
|
12
|
+
await destroyStore.destroy?.();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
const WA_CONTACT_CLEAR_KEY = 'contact:clear';
|
|
4
|
+
export function withContactLock(store) {
|
|
5
|
+
const lock = new StoreLock();
|
|
6
|
+
const gate = new SharedExclusiveGate();
|
|
7
|
+
const destroyStore = store;
|
|
8
|
+
return {
|
|
9
|
+
upsert: (record) => gate.runShared(() => lock.run(`contact:${record.jid}`, () => store.upsert(record))),
|
|
10
|
+
upsertBatch: (records) => gate.runShared(() => lock.runMany(records.map((record) => `contact:${record.jid}`), () => store.upsertBatch(records))),
|
|
11
|
+
getByJid: (jid) => gate.runShared(() => store.getByJid(jid)),
|
|
12
|
+
deleteByJid: (jid) => gate.runShared(() => lock.run(`contact:${jid}`, () => store.deleteByJid(jid))),
|
|
13
|
+
clear: () => gate.runExclusive(() => lock.run(WA_CONTACT_CLEAR_KEY, () => store.clear())),
|
|
14
|
+
destroy: async () => {
|
|
15
|
+
await gate.close();
|
|
16
|
+
await lock.shutdown();
|
|
17
|
+
await destroyStore.destroy?.();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
const WA_DEVICE_LIST_CLEAR_KEY = 'deviceList:clear';
|
|
4
|
+
const WA_DEVICE_LIST_CLEANUP_KEY = 'deviceList:cleanup';
|
|
5
|
+
export function withDeviceListLock(store) {
|
|
6
|
+
const lock = new StoreLock();
|
|
7
|
+
const gate = new SharedExclusiveGate();
|
|
8
|
+
return {
|
|
9
|
+
destroy: async () => {
|
|
10
|
+
await gate.close();
|
|
11
|
+
await lock.shutdown();
|
|
12
|
+
await store.destroy?.();
|
|
13
|
+
},
|
|
14
|
+
upsertUserDevicesBatch: (snapshots) => gate.runShared(() => lock.runMany(snapshots.map((snapshot) => `deviceList:user:${snapshot.userJid}`), () => store.upsertUserDevicesBatch(snapshots))),
|
|
15
|
+
getUserDevicesBatch: (userJids, nowMs) => gate.runShared(() => store.getUserDevicesBatch(userJids, nowMs)),
|
|
16
|
+
deleteUserDevices: (userJid) => gate.runShared(() => lock.run(`deviceList:user:${userJid}`, () => store.deleteUserDevices(userJid))),
|
|
17
|
+
cleanupExpired: (nowMs) => gate.runExclusive(() => lock.run(WA_DEVICE_LIST_CLEANUP_KEY, () => store.cleanupExpired(nowMs))),
|
|
18
|
+
clear: () => gate.runExclusive(() => lock.run(WA_DEVICE_LIST_CLEAR_KEY, () => store.clear()))
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
const WA_MESSAGE_CLEAR_KEY = 'message:clear';
|
|
4
|
+
export function withMessageLock(store) {
|
|
5
|
+
const lock = new StoreLock();
|
|
6
|
+
const gate = new SharedExclusiveGate();
|
|
7
|
+
const destroyStore = store;
|
|
8
|
+
return {
|
|
9
|
+
upsert: (record) => gate.runShared(() => lock.run(`message:${record.id}`, () => store.upsert(record))),
|
|
10
|
+
upsertBatch: (records) => gate.runShared(() => lock.runMany(records.map((record) => `message:${record.id}`), () => store.upsertBatch(records))),
|
|
11
|
+
getById: (id) => gate.runShared(() => store.getById(id)),
|
|
12
|
+
listByThread: (threadJid, limit, beforeTimestampMs) => gate.runShared(() => store.listByThread(threadJid, limit, beforeTimestampMs)),
|
|
13
|
+
deleteById: (id) => gate.runShared(() => lock.run(`message:${id}`, () => store.deleteById(id))),
|
|
14
|
+
clear: () => gate.runExclusive(() => lock.run(WA_MESSAGE_CLEAR_KEY, () => store.clear())),
|
|
15
|
+
destroy: async () => {
|
|
16
|
+
await gate.close();
|
|
17
|
+
await lock.shutdown();
|
|
18
|
+
await destroyStore.destroy?.();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
const WA_PARTICIPANTS_CLEAR_KEY = 'participants:clear';
|
|
4
|
+
const WA_PARTICIPANTS_CLEANUP_KEY = 'participants:cleanup';
|
|
5
|
+
export function withParticipantsLock(store) {
|
|
6
|
+
const lock = new StoreLock();
|
|
7
|
+
const gate = new SharedExclusiveGate();
|
|
8
|
+
return {
|
|
9
|
+
destroy: async () => {
|
|
10
|
+
await gate.close();
|
|
11
|
+
await lock.shutdown();
|
|
12
|
+
await store.destroy?.();
|
|
13
|
+
},
|
|
14
|
+
upsertGroupParticipants: (snapshot) => gate.runShared(() => lock.run(`participants:group:${snapshot.groupJid}`, () => store.upsertGroupParticipants(snapshot))),
|
|
15
|
+
getGroupParticipants: (groupJid, nowMs) => gate.runShared(() => store.getGroupParticipants(groupJid, nowMs)),
|
|
16
|
+
deleteGroupParticipants: (groupJid) => gate.runShared(() => lock.run(`participants:group:${groupJid}`, () => store.deleteGroupParticipants(groupJid))),
|
|
17
|
+
cleanupExpired: (nowMs) => gate.runExclusive(() => lock.run(WA_PARTICIPANTS_CLEANUP_KEY, () => store.cleanupExpired(nowMs))),
|
|
18
|
+
clear: () => gate.runExclusive(() => lock.run(WA_PARTICIPANTS_CLEAR_KEY, () => store.clear()))
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
export function withPrivacyTokenLock(store) {
|
|
4
|
+
const lock = new StoreLock();
|
|
5
|
+
const gate = new SharedExclusiveGate();
|
|
6
|
+
return {
|
|
7
|
+
destroy: async () => {
|
|
8
|
+
await gate.close();
|
|
9
|
+
await lock.shutdown();
|
|
10
|
+
await store.destroy?.();
|
|
11
|
+
},
|
|
12
|
+
upsert: (record) => gate.runShared(() => lock.run(`pt:${record.jid}`, () => store.upsert(record))),
|
|
13
|
+
upsertBatch: (records) => gate.runExclusive(() => store.upsertBatch(records)),
|
|
14
|
+
getByJid: (jid) => gate.runShared(() => store.getByJid(jid)),
|
|
15
|
+
deleteByJid: (jid) => gate.runShared(() => lock.run(`pt:${jid}`, () => store.deleteByJid(jid))),
|
|
16
|
+
clear: () => gate.runExclusive(() => store.clear())
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
const WA_RETRY_CLEANUP_KEY = 'retry:cleanup';
|
|
4
|
+
const WA_RETRY_CLEAR_KEY = 'retry:clear';
|
|
5
|
+
export function withRetryLock(store) {
|
|
6
|
+
const lock = new StoreLock();
|
|
7
|
+
const gate = new SharedExclusiveGate();
|
|
8
|
+
return {
|
|
9
|
+
getTtlMs: store.getTtlMs?.bind(store),
|
|
10
|
+
supportsRawReplayPayload: store.supportsRawReplayPayload?.bind(store),
|
|
11
|
+
destroy: async () => {
|
|
12
|
+
await gate.close();
|
|
13
|
+
await lock.shutdown();
|
|
14
|
+
await store.destroy?.();
|
|
15
|
+
},
|
|
16
|
+
getOutboundRequesterStatus: (messageId, requesterDeviceJid) => gate.runShared(() => store.getOutboundRequesterStatus(messageId, requesterDeviceJid)),
|
|
17
|
+
upsertOutboundMessage: (record) => gate.runShared(() => lock.run(`retry:outbound:${record.messageId}`, () => store.upsertOutboundMessage(record))),
|
|
18
|
+
deleteOutboundMessage: (messageId) => gate.runShared(() => lock.run(`retry:outbound:${messageId}`, () => store.deleteOutboundMessage(messageId))),
|
|
19
|
+
getOutboundMessage: (messageId) => gate.runShared(() => store.getOutboundMessage(messageId)),
|
|
20
|
+
updateOutboundMessageState: (messageId, state, updatedAtMs, expiresAtMs) => gate.runShared(() => lock.run(`retry:outbound:${messageId}`, () => store.updateOutboundMessageState(messageId, state, updatedAtMs, expiresAtMs))),
|
|
21
|
+
markOutboundRequesterDelivered: (messageId, requesterDeviceJid, updatedAtMs, expiresAtMs) => gate.runShared(() => lock.runMany([
|
|
22
|
+
`retry:outbound:${messageId}`,
|
|
23
|
+
`retry:outbound:${messageId}:${requesterDeviceJid}`
|
|
24
|
+
], () => store.markOutboundRequesterDelivered(messageId, requesterDeviceJid, updatedAtMs, expiresAtMs))),
|
|
25
|
+
incrementInboundCounter: (messageId, requesterJid, updatedAtMs, expiresAtMs) => gate.runShared(() => lock.run(`retry:inbound:${messageId}:${requesterJid}`, () => store.incrementInboundCounter(messageId, requesterJid, updatedAtMs, expiresAtMs))),
|
|
26
|
+
cleanupExpired: (nowMs) => gate.runExclusive(() => lock.run(WA_RETRY_CLEANUP_KEY, () => store.cleanupExpired(nowMs))),
|
|
27
|
+
clear: () => gate.runExclusive(() => lock.run(WA_RETRY_CLEAR_KEY, () => store.clear()))
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SharedExclusiveGate } from '../../infra/perf/SharedExclusiveGate.js';
|
|
2
|
+
import { StoreLock } from '../../infra/perf/StoreLock.js';
|
|
3
|
+
import { signalAddressKey } from '../../protocol/jid.js';
|
|
4
|
+
const WA_SENDER_KEY_CLEAR_KEY = 'senderKey:clear';
|
|
5
|
+
function senderKeyLockKey(groupId, sender) {
|
|
6
|
+
return `senderKey:${groupId}:${signalAddressKey(sender)}`;
|
|
7
|
+
}
|
|
8
|
+
function senderDistributionLockKey(groupId, sender) {
|
|
9
|
+
return `senderKeyDistribution:${groupId}:${signalAddressKey(sender)}`;
|
|
10
|
+
}
|
|
11
|
+
function senderAnyLockKey(sender) {
|
|
12
|
+
return `senderKey:any:${signalAddressKey(sender)}`;
|
|
13
|
+
}
|
|
14
|
+
export function withSenderKeyLock(store) {
|
|
15
|
+
const lock = new StoreLock();
|
|
16
|
+
const gate = new SharedExclusiveGate();
|
|
17
|
+
const destroyStore = store;
|
|
18
|
+
return {
|
|
19
|
+
upsertSenderKey: (record) => gate.runShared(() => lock.runMany([
|
|
20
|
+
senderAnyLockKey(record.sender),
|
|
21
|
+
senderKeyLockKey(record.groupId, record.sender)
|
|
22
|
+
], () => store.upsertSenderKey(record))),
|
|
23
|
+
upsertSenderKeyDistribution: (record) => gate.runShared(() => lock.runMany([
|
|
24
|
+
senderAnyLockKey(record.sender),
|
|
25
|
+
senderDistributionLockKey(record.groupId, record.sender)
|
|
26
|
+
], () => store.upsertSenderKeyDistribution(record))),
|
|
27
|
+
upsertSenderKeyDistributions: (records) => gate.runShared(() => lock.runMany(records.flatMap((record) => [
|
|
28
|
+
senderAnyLockKey(record.sender),
|
|
29
|
+
senderDistributionLockKey(record.groupId, record.sender)
|
|
30
|
+
]), () => store.upsertSenderKeyDistributions(records))),
|
|
31
|
+
getGroupSenderKeyList: (groupId) => gate.runShared(() => store.getGroupSenderKeyList(groupId)),
|
|
32
|
+
getDeviceSenderKey: (groupId, sender) => gate.runShared(() => store.getDeviceSenderKey(groupId, sender)),
|
|
33
|
+
getDeviceSenderKeyDistributions: (groupId, senders) => gate.runShared(() => store.getDeviceSenderKeyDistributions(groupId, senders)),
|
|
34
|
+
deleteDeviceSenderKey: (target, groupId) => gate.runShared(() => lock.runMany(groupId
|
|
35
|
+
? [
|
|
36
|
+
senderAnyLockKey(target),
|
|
37
|
+
senderKeyLockKey(groupId, target),
|
|
38
|
+
senderDistributionLockKey(groupId, target)
|
|
39
|
+
]
|
|
40
|
+
: [senderAnyLockKey(target)], () => store.deleteDeviceSenderKey(target, groupId))),
|
|
41
|
+
markForgetSenderKey: (groupId, participants) => gate.runShared(() => lock.runMany(participants.flatMap((participant) => [
|
|
42
|
+
senderAnyLockKey(participant),
|
|
43
|
+
senderKeyLockKey(groupId, participant)
|
|
44
|
+
]), () => store.markForgetSenderKey(groupId, participants))),
|
|
45
|
+
clear: () => gate.runExclusive(() => lock.run(WA_SENDER_KEY_CLEAR_KEY, () => store.clear())),
|
|
46
|
+
destroy: async () => {
|
|
47
|
+
await gate.close();
|
|
48
|
+
await lock.shutdown();
|
|
49
|
+
await destroyStore.destroy?.();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|