@dittolive/ditto 4.5.0 → 4.5.1-experimental.aarch64-linux.1.aarch64

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.
Files changed (289) hide show
  1. package/README.md +2 -2
  2. package/node/ditto.cjs.js +2 -9620
  3. package/node/{ditto.linux-x64.node → ditto.linux-arm64.node} +0 -0
  4. package/package.json +38 -34
  5. package/types/ditto.d.ts +0 -2
  6. package/web/ditto.es6.js +1 -1
  7. package/web/ditto.umd.js +1 -1
  8. package/web/ditto.wasm +0 -0
  9. package/DittoReactNative.podspec +0 -27
  10. package/node/ditto.darwin-arm64.node +0 -0
  11. package/node/ditto.darwin-x64.node +0 -0
  12. package/node/ditto.linux-arm.node +0 -0
  13. package/node/ditto.win32-x64.node +0 -0
  14. package/node/transports.darwin-arm64.node +0 -0
  15. package/node/transports.darwin-x64.node +0 -0
  16. package/react-native/android/CMakeLists.txt +0 -37
  17. package/react-native/android/build.gradle +0 -203
  18. package/react-native/android/cpp-adapter.cpp +0 -254
  19. package/react-native/android/gradle.properties +0 -5
  20. package/react-native/android/src/main/AndroidManifest.xml +0 -4
  21. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +0 -85
  22. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.java +0 -28
  23. package/react-native/boost/boost/assert.hpp +0 -85
  24. package/react-native/boost/boost/config/abi/borland_prefix.hpp +0 -27
  25. package/react-native/boost/boost/config/abi/borland_suffix.hpp +0 -12
  26. package/react-native/boost/boost/config/abi/msvc_prefix.hpp +0 -22
  27. package/react-native/boost/boost/config/abi/msvc_suffix.hpp +0 -8
  28. package/react-native/boost/boost/config/abi_prefix.hpp +0 -25
  29. package/react-native/boost/boost/config/abi_suffix.hpp +0 -25
  30. package/react-native/boost/boost/config/assert_cxx03.hpp +0 -211
  31. package/react-native/boost/boost/config/assert_cxx11.hpp +0 -209
  32. package/react-native/boost/boost/config/assert_cxx14.hpp +0 -47
  33. package/react-native/boost/boost/config/assert_cxx17.hpp +0 -62
  34. package/react-native/boost/boost/config/assert_cxx20.hpp +0 -59
  35. package/react-native/boost/boost/config/assert_cxx98.hpp +0 -23
  36. package/react-native/boost/boost/config/auto_link.hpp +0 -525
  37. package/react-native/boost/boost/config/compiler/borland.hpp +0 -339
  38. package/react-native/boost/boost/config/compiler/clang.hpp +0 -366
  39. package/react-native/boost/boost/config/compiler/clang_version.hpp +0 -83
  40. package/react-native/boost/boost/config/compiler/codegear.hpp +0 -385
  41. package/react-native/boost/boost/config/compiler/comeau.hpp +0 -59
  42. package/react-native/boost/boost/config/compiler/common_edg.hpp +0 -183
  43. package/react-native/boost/boost/config/compiler/compaq_cxx.hpp +0 -19
  44. package/react-native/boost/boost/config/compiler/cray.hpp +0 -446
  45. package/react-native/boost/boost/config/compiler/diab.hpp +0 -26
  46. package/react-native/boost/boost/config/compiler/digitalmars.hpp +0 -143
  47. package/react-native/boost/boost/config/compiler/gcc.hpp +0 -383
  48. package/react-native/boost/boost/config/compiler/gcc_xml.hpp +0 -114
  49. package/react-native/boost/boost/config/compiler/greenhills.hpp +0 -28
  50. package/react-native/boost/boost/config/compiler/hp_acc.hpp +0 -149
  51. package/react-native/boost/boost/config/compiler/intel.hpp +0 -577
  52. package/react-native/boost/boost/config/compiler/kai.hpp +0 -33
  53. package/react-native/boost/boost/config/compiler/metrowerks.hpp +0 -198
  54. package/react-native/boost/boost/config/compiler/mpw.hpp +0 -140
  55. package/react-native/boost/boost/config/compiler/nvcc.hpp +0 -61
  56. package/react-native/boost/boost/config/compiler/pathscale.hpp +0 -138
  57. package/react-native/boost/boost/config/compiler/pgi.hpp +0 -23
  58. package/react-native/boost/boost/config/compiler/sgi_mipspro.hpp +0 -29
  59. package/react-native/boost/boost/config/compiler/sunpro_cc.hpp +0 -222
  60. package/react-native/boost/boost/config/compiler/vacpp.hpp +0 -186
  61. package/react-native/boost/boost/config/compiler/visualc.hpp +0 -391
  62. package/react-native/boost/boost/config/compiler/xlcpp.hpp +0 -299
  63. package/react-native/boost/boost/config/compiler/xlcpp_zos.hpp +0 -173
  64. package/react-native/boost/boost/config/detail/cxx_composite.hpp +0 -203
  65. package/react-native/boost/boost/config/detail/posix_features.hpp +0 -95
  66. package/react-native/boost/boost/config/detail/select_compiler_config.hpp +0 -157
  67. package/react-native/boost/boost/config/detail/select_platform_config.hpp +0 -147
  68. package/react-native/boost/boost/config/detail/select_stdlib_config.hpp +0 -121
  69. package/react-native/boost/boost/config/detail/suffix.hpp +0 -1294
  70. package/react-native/boost/boost/config/header_deprecated.hpp +0 -26
  71. package/react-native/boost/boost/config/helper_macros.hpp +0 -37
  72. package/react-native/boost/boost/config/no_tr1/cmath.hpp +0 -28
  73. package/react-native/boost/boost/config/no_tr1/complex.hpp +0 -28
  74. package/react-native/boost/boost/config/no_tr1/functional.hpp +0 -28
  75. package/react-native/boost/boost/config/no_tr1/memory.hpp +0 -28
  76. package/react-native/boost/boost/config/no_tr1/utility.hpp +0 -28
  77. package/react-native/boost/boost/config/platform/aix.hpp +0 -33
  78. package/react-native/boost/boost/config/platform/amigaos.hpp +0 -15
  79. package/react-native/boost/boost/config/platform/beos.hpp +0 -26
  80. package/react-native/boost/boost/config/platform/bsd.hpp +0 -83
  81. package/react-native/boost/boost/config/platform/cloudabi.hpp +0 -18
  82. package/react-native/boost/boost/config/platform/cray.hpp +0 -18
  83. package/react-native/boost/boost/config/platform/cygwin.hpp +0 -71
  84. package/react-native/boost/boost/config/platform/haiku.hpp +0 -31
  85. package/react-native/boost/boost/config/platform/hpux.hpp +0 -87
  86. package/react-native/boost/boost/config/platform/irix.hpp +0 -31
  87. package/react-native/boost/boost/config/platform/linux.hpp +0 -106
  88. package/react-native/boost/boost/config/platform/macos.hpp +0 -87
  89. package/react-native/boost/boost/config/platform/qnxnto.hpp +0 -31
  90. package/react-native/boost/boost/config/platform/solaris.hpp +0 -31
  91. package/react-native/boost/boost/config/platform/symbian.hpp +0 -97
  92. package/react-native/boost/boost/config/platform/vms.hpp +0 -25
  93. package/react-native/boost/boost/config/platform/vxworks.hpp +0 -422
  94. package/react-native/boost/boost/config/platform/wasm.hpp +0 -23
  95. package/react-native/boost/boost/config/platform/win32.hpp +0 -90
  96. package/react-native/boost/boost/config/platform/zos.hpp +0 -32
  97. package/react-native/boost/boost/config/pragma_message.hpp +0 -31
  98. package/react-native/boost/boost/config/requires_threads.hpp +0 -92
  99. package/react-native/boost/boost/config/stdlib/dinkumware.hpp +0 -324
  100. package/react-native/boost/boost/config/stdlib/libcomo.hpp +0 -93
  101. package/react-native/boost/boost/config/stdlib/libcpp.hpp +0 -180
  102. package/react-native/boost/boost/config/stdlib/libstdcpp3.hpp +0 -482
  103. package/react-native/boost/boost/config/stdlib/modena.hpp +0 -79
  104. package/react-native/boost/boost/config/stdlib/msl.hpp +0 -98
  105. package/react-native/boost/boost/config/stdlib/roguewave.hpp +0 -208
  106. package/react-native/boost/boost/config/stdlib/sgi.hpp +0 -168
  107. package/react-native/boost/boost/config/stdlib/stlport.hpp +0 -258
  108. package/react-native/boost/boost/config/stdlib/vacpp.hpp +0 -74
  109. package/react-native/boost/boost/config/stdlib/xlcpp_zos.hpp +0 -61
  110. package/react-native/boost/boost/config/user.hpp +0 -133
  111. package/react-native/boost/boost/config/warning_disable.hpp +0 -47
  112. package/react-native/boost/boost/config/workaround.hpp +0 -305
  113. package/react-native/boost/boost/config.hpp +0 -67
  114. package/react-native/boost/boost/cstdint.hpp +0 -556
  115. package/react-native/boost/boost/intrusive_ptr.hpp +0 -18
  116. package/react-native/boost/boost/smart_ptr/detail/atomic_count.hpp +0 -103
  117. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp +0 -79
  118. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp +0 -63
  119. package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +0 -88
  120. package/react-native/boost/boost/smart_ptr/detail/atomic_count_nt.hpp +0 -66
  121. package/react-native/boost/boost/smart_ptr/detail/atomic_count_pt.hpp +0 -104
  122. package/react-native/boost/boost/smart_ptr/detail/atomic_count_spin.hpp +0 -69
  123. package/react-native/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +0 -67
  124. package/react-native/boost/boost/smart_ptr/detail/atomic_count_sync.hpp +0 -72
  125. package/react-native/boost/boost/smart_ptr/detail/atomic_count_win32.hpp +0 -70
  126. package/react-native/boost/boost/smart_ptr/detail/local_counted_base.hpp +0 -148
  127. package/react-native/boost/boost/smart_ptr/detail/local_sp_deleter.hpp +0 -91
  128. package/react-native/boost/boost/smart_ptr/detail/operator_bool.hpp +0 -64
  129. package/react-native/boost/boost/smart_ptr/detail/requires_cxx11.hpp +0 -23
  130. package/react-native/boost/boost/smart_ptr/detail/shared_count.hpp +0 -707
  131. package/react-native/boost/boost/smart_ptr/detail/sp_convertible.hpp +0 -92
  132. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base.hpp +0 -92
  133. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +0 -163
  134. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp +0 -152
  135. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +0 -185
  136. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp +0 -148
  137. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +0 -170
  138. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +0 -200
  139. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +0 -194
  140. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +0 -179
  141. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +0 -186
  142. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp +0 -119
  143. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp +0 -147
  144. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +0 -174
  145. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp +0 -141
  146. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +0 -147
  147. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp +0 -165
  148. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +0 -163
  149. package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp +0 -140
  150. package/react-native/boost/boost/smart_ptr/detail/sp_counted_impl.hpp +0 -309
  151. package/react-native/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp +0 -40
  152. package/react-native/boost/boost/smart_ptr/detail/sp_forward.hpp +0 -52
  153. package/react-native/boost/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +0 -27
  154. package/react-native/boost/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp +0 -69
  155. package/react-native/boost/boost/smart_ptr/detail/sp_interlocked.hpp +0 -173
  156. package/react-native/boost/boost/smart_ptr/detail/sp_noexcept.hpp +0 -48
  157. package/react-native/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp +0 -45
  158. package/react-native/boost/boost/smart_ptr/detail/sp_obsolete.hpp +0 -32
  159. package/react-native/boost/boost/smart_ptr/detail/sp_thread_pause.hpp +0 -51
  160. package/react-native/boost/boost/smart_ptr/detail/sp_thread_sleep.hpp +0 -104
  161. package/react-native/boost/boost/smart_ptr/detail/sp_thread_yield.hpp +0 -100
  162. package/react-native/boost/boost/smart_ptr/detail/sp_typeinfo_.hpp +0 -58
  163. package/react-native/boost/boost/smart_ptr/detail/sp_win32_sleep.hpp +0 -49
  164. package/react-native/boost/boost/smart_ptr/intrusive_ptr.hpp +0 -409
  165. package/react-native/boost/boost/smart_ptr/intrusive_ref_counter.hpp +0 -188
  166. package/react-native/cpp/include/Attachment.h +0 -16
  167. package/react-native/cpp/include/Authentication.h +0 -23
  168. package/react-native/cpp/include/Collection.h +0 -13
  169. package/react-native/cpp/include/DQL.h +0 -21
  170. package/react-native/cpp/include/Document.h +0 -17
  171. package/react-native/cpp/include/Identity.h +0 -17
  172. package/react-native/cpp/include/Lifecycle.h +0 -16
  173. package/react-native/cpp/include/LiveQuery.h +0 -17
  174. package/react-native/cpp/include/Logger.h +0 -22
  175. package/react-native/cpp/include/Misc.h +0 -26
  176. package/react-native/cpp/include/Presence.h +0 -14
  177. package/react-native/cpp/include/RetainableState.h +0 -24
  178. package/react-native/cpp/include/SmallPeerInfo.h +0 -17
  179. package/react-native/cpp/include/Transports.h +0 -25
  180. package/react-native/cpp/include/TypedArray.hpp +0 -167
  181. package/react-native/cpp/include/Utils.h +0 -61
  182. package/react-native/cpp/include/main.h +0 -10
  183. package/react-native/cpp/src/Attachment.cpp +0 -86
  184. package/react-native/cpp/src/Authentication.cpp +0 -224
  185. package/react-native/cpp/src/Collection.cpp +0 -54
  186. package/react-native/cpp/src/DQL.cpp +0 -254
  187. package/react-native/cpp/src/Document.cpp +0 -146
  188. package/react-native/cpp/src/Identity.cpp +0 -123
  189. package/react-native/cpp/src/Lifecycle.cpp +0 -75
  190. package/react-native/cpp/src/LiveQuery.cpp +0 -64
  191. package/react-native/cpp/src/Logger.cpp +0 -200
  192. package/react-native/cpp/src/Misc.cpp +0 -271
  193. package/react-native/cpp/src/Presence.cpp +0 -77
  194. package/react-native/cpp/src/RetainableState.cpp +0 -15
  195. package/react-native/cpp/src/SmallPeerInfo.cpp +0 -108
  196. package/react-native/cpp/src/Transports.cpp +0 -270
  197. package/react-native/cpp/src/TypedArray.cpp +0 -303
  198. package/react-native/cpp/src/Utils.cpp +0 -138
  199. package/react-native/cpp/src/main.cpp +0 -149
  200. package/react-native/dittoffi/dittoffi.h +0 -4698
  201. package/react-native/dittoffi/ifaddrs.cpp +0 -385
  202. package/react-native/dittoffi/ifaddrs.h +0 -206
  203. package/react-native/ios/DittoRNSDK.h +0 -7
  204. package/react-native/ios/DittoRNSDK.mm +0 -107
  205. package/react-native/ios/YeetJSIUtils.h +0 -60
  206. package/react-native/ios/YeetJSIUtils.mm +0 -196
  207. package/react-native/lib/commonjs/ditto.rn.js +0 -93
  208. package/react-native/lib/commonjs/ditto.rn.js.map +0 -1
  209. package/react-native/lib/commonjs/index.js +0 -14
  210. package/react-native/lib/commonjs/index.js.map +0 -1
  211. package/react-native/lib/module/ditto.rn.js +0 -83
  212. package/react-native/lib/module/ditto.rn.js.map +0 -1
  213. package/react-native/lib/module/index.js +0 -13
  214. package/react-native/lib/module/index.js.map +0 -1
  215. package/react-native/lib/typescript/ditto.rn.d.ts +0 -15
  216. package/react-native/lib/typescript/ditto.rn.d.ts.map +0 -1
  217. package/react-native/lib/typescript/index.d.ts +0 -1
  218. package/react-native/lib/typescript/index.d.ts.map +0 -1
  219. package/react-native/scripts/ruby/include_local_boost.rb +0 -78
  220. package/react-native/src/ditto.rn.ts +0 -91
  221. package/react-native/src/environment/environment.fallback.ts +0 -4
  222. package/react-native/src/index.ts +0 -26
  223. package/react-native/src/sources/@cbor-redux.ts +0 -2
  224. package/react-native/src/sources/@ditto.core.ts +0 -1
  225. package/react-native/src/sources/@environment.ts +0 -2
  226. package/react-native/src/sources/attachment-fetch-event.ts +0 -54
  227. package/react-native/src/sources/attachment-fetcher-manager.ts +0 -129
  228. package/react-native/src/sources/attachment-fetcher.ts +0 -124
  229. package/react-native/src/sources/attachment-token.ts +0 -48
  230. package/react-native/src/sources/attachment.ts +0 -59
  231. package/react-native/src/sources/augment.ts +0 -89
  232. package/react-native/src/sources/authenticator.ts +0 -314
  233. package/react-native/src/sources/base-pending-cursor-operation.ts +0 -237
  234. package/react-native/src/sources/base-pending-id-specific-operation.ts +0 -109
  235. package/react-native/src/sources/bridge.ts +0 -549
  236. package/react-native/src/sources/build-time-constants.ts +0 -4
  237. package/react-native/src/sources/cbor.ts +0 -35
  238. package/react-native/src/sources/collection-interface.ts +0 -67
  239. package/react-native/src/sources/collection.ts +0 -212
  240. package/react-native/src/sources/collections-event.ts +0 -99
  241. package/react-native/src/sources/counter.ts +0 -77
  242. package/react-native/src/sources/ditto.ts +0 -945
  243. package/react-native/src/sources/document-id.ts +0 -159
  244. package/react-native/src/sources/document-path.ts +0 -303
  245. package/react-native/src/sources/document.ts +0 -192
  246. package/react-native/src/sources/epilogue.ts +0 -24
  247. package/react-native/src/sources/error-codes.ts +0 -52
  248. package/react-native/src/sources/error.ts +0 -203
  249. package/react-native/src/sources/essentials.ts +0 -53
  250. package/react-native/src/sources/ffi-error.ts +0 -117
  251. package/react-native/src/sources/ffi.ts +0 -1972
  252. package/react-native/src/sources/identity.ts +0 -163
  253. package/react-native/src/sources/init.ts +0 -70
  254. package/react-native/src/sources/internal.ts +0 -113
  255. package/react-native/src/sources/keep-alive.ts +0 -69
  256. package/react-native/src/sources/key-path.ts +0 -195
  257. package/react-native/src/sources/live-query-event.ts +0 -208
  258. package/react-native/src/sources/live-query-manager.ts +0 -101
  259. package/react-native/src/sources/live-query.ts +0 -164
  260. package/react-native/src/sources/logger.ts +0 -196
  261. package/react-native/src/sources/observer-manager.ts +0 -175
  262. package/react-native/src/sources/observer.ts +0 -77
  263. package/react-native/src/sources/pending-collections-operation.ts +0 -232
  264. package/react-native/src/sources/pending-cursor-operation.ts +0 -218
  265. package/react-native/src/sources/pending-id-specific-operation.ts +0 -216
  266. package/react-native/src/sources/presence-manager.ts +0 -160
  267. package/react-native/src/sources/presence.ts +0 -238
  268. package/react-native/src/sources/query-result-item.ts +0 -116
  269. package/react-native/src/sources/query-result.ts +0 -55
  270. package/react-native/src/sources/register.ts +0 -92
  271. package/react-native/src/sources/small-peer-info.ts +0 -176
  272. package/react-native/src/sources/static-tcp-client.ts +0 -6
  273. package/react-native/src/sources/store-observer.ts +0 -176
  274. package/react-native/src/sources/store.ts +0 -365
  275. package/react-native/src/sources/subscription-manager.ts +0 -98
  276. package/react-native/src/sources/subscription.ts +0 -88
  277. package/react-native/src/sources/sync-subscription.ts +0 -90
  278. package/react-native/src/sources/sync.ts +0 -495
  279. package/react-native/src/sources/test-helpers.ts +0 -24
  280. package/react-native/src/sources/transport-conditions-manager.ts +0 -104
  281. package/react-native/src/sources/transport-config.ts +0 -428
  282. package/react-native/src/sources/update-result.ts +0 -66
  283. package/react-native/src/sources/update-results-map.ts +0 -57
  284. package/react-native/src/sources/websocket-client.ts +0 -6
  285. package/react-native/src/sources/write-transaction-collection.ts +0 -122
  286. package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +0 -101
  287. package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +0 -72
  288. package/react-native/src/sources/write-transaction.ts +0 -119
  289. package/react-native.config.js +0 -9
@@ -1,208 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as FFI from './ffi'
6
- import { Bridge } from './bridge'
7
- import { Logger } from './logger'
8
-
9
- import type { Document } from './document'
10
-
11
- // -----------------------------------------------------------------------------
12
-
13
- /**
14
- * An object that describes how a document's position in a live query's list of
15
- * matching documents has changed since the previous live query event.
16
- */
17
- export interface LiveQueryMove {
18
- /**
19
- * The index of the document in the list of matching documents from the
20
- * previous live query event.
21
- */
22
- readonly from: number
23
-
24
- /**
25
- * The index of the document in the list of matching documents from the new
26
- * live query event.
27
- */
28
- readonly to: number
29
- }
30
-
31
- // -----------------------------------------------------------------------------
32
-
33
- /** @internal */
34
- export interface LiveQueryEventUpdateParams {
35
- oldDocuments: Document[]
36
- insertions: number[]
37
- deletions: number[]
38
- updates: number[]
39
- moves: LiveQueryMove[]
40
- }
41
-
42
- // -----------------------------------------------------------------------------
43
-
44
- /**
45
- * First event fired immediately after registering a live query without any
46
- * mutations. All subsequent events are of type {@link LiveQueryEventUpdate}.
47
- */
48
- export class LiveQueryEventInitial {
49
- /**
50
- * Whether or not this is the initial event being delivered. Always `true`
51
- * for `LiveQueryEventInitial`.
52
- */
53
- readonly isInitial = true
54
-
55
- /**
56
- * Returns a hash that represents the set of matching documents.
57
- *
58
- * @deprecated use {@link Document.hash | Document.hash()} instead.
59
- */
60
- hash(documents: Document[]): BigInt {
61
- Logger.warning('LiveQueryEventInitial.hash() is deprecated, use Document.hash() instead')
62
- const documentHandles = Bridge.document.handlesFor(documents)
63
- return FFI.documentsHash(documentHandles.deref())
64
- }
65
-
66
- /**
67
- * Returns a pattern of words that together create a mnemonic, which
68
- * represents the set of matching documents.
69
- *
70
- * @deprecated use {@link Document.hashMnemonic | Document.hashMnemonic()} instead.
71
- */
72
- hashMnemonic(documents: Document[]): string {
73
- Logger.warning('LiveQueryEventInitial.hashMnemonic() is deprecated, use Document.hashMnemonic() instead')
74
- const documentHandles = Bridge.document.handlesFor(documents)
75
- return FFI.documentsHashMnemonic(documentHandles.deref())
76
- }
77
- }
78
-
79
- // -----------------------------------------------------------------------------
80
-
81
- /**
82
- * Represents an update event describing all changes that occured for documents
83
- * covered by a (live) query.
84
- */
85
- export class LiveQueryEventUpdate {
86
- /**
87
- * Whether or not this is the initial event being delivered. Always `false`
88
- * for `LiveQueryEventUpdate`.
89
- */
90
- readonly isInitial = false
91
-
92
- /**
93
- * The documents that previously matched the query, before the latest event.
94
- */
95
- readonly oldDocuments: Document[]
96
-
97
- /**
98
- * The indexes in the array of matching documents that accompany this event,
99
- * which relate to a document that was not in the previous most recent list of
100
- * matching documents.
101
- */
102
- readonly insertions: number[]
103
-
104
- /**
105
- * The indexes into the array {@link oldDocuments}, which relate to a document
106
- * that was in the previous most recent list of matching documents but is no
107
- * longer a matching document.
108
- */
109
- readonly deletions: number[]
110
-
111
- /**
112
- * The indexes in the array of matching documents that accompany this event,
113
- * which relate to a document that has been updated since the previous live
114
- * query event.
115
- */
116
- readonly updates: number[]
117
-
118
- /**
119
- * Objects that describe how documents' positions in the list of matching
120
- * documents have changed since the previous live query event.
121
- */
122
- readonly moves: LiveQueryMove[]
123
-
124
- /**
125
- * Returns a hash that represents the set of matching documents.
126
- *
127
- * @deprecated use {@link Document.hash | Document.hash()} instead.
128
- */
129
- hash(documents: Document[]): BigInt {
130
- Logger.warning('LiveQueryEventUpdate.hash() is deprecated, use Document.hash() instead')
131
- const documentHandles = Bridge.document.handlesFor(documents)
132
- return FFI.documentsHash(documentHandles.deref())
133
- }
134
-
135
- /**
136
- * Returns a pattern of words that together create a mnemonic, which
137
- * represents the set of matching documents.
138
- *
139
- * @deprecated use {@link Document.hashMnemonic | Document.hashMnemonic()} instead.
140
- */
141
- hashMnemonic(documents: Document[]): string {
142
- Logger.warning('LiveQueryEventUpdate.hashMnemonic() is deprecated, use Document.hashMnemonic() instead')
143
- const documentHandles = Bridge.document.handlesFor(documents)
144
- return FFI.documentsHashMnemonic(documentHandles.deref())
145
- }
146
-
147
- /** @internal */
148
- constructor(params: LiveQueryEventUpdateParams) {
149
- this.oldDocuments = params.oldDocuments
150
- this.insertions = params.insertions
151
- this.deletions = params.deletions
152
- this.updates = params.updates
153
- this.moves = params.moves
154
- }
155
- }
156
-
157
- // -----------------------------------------------------------------------------
158
-
159
- /**
160
- * Represents events delivered by a {@link LiveQuery}, which can be initial
161
- * (fired immediately upon registration) or an update (all subsequent events).
162
- */
163
- export type LiveQueryEvent = LiveQueryEventInitial | LiveQueryEventUpdate
164
-
165
- // -----------------------------------------------------------------------------
166
-
167
- /**
168
- * Provides information about a live query event relating to a single document
169
- * live query.
170
- */
171
- export class SingleDocumentLiveQueryEvent {
172
- /**
173
- * Whether or not this is the initial event being delivered.
174
- */
175
- readonly isInitial: boolean
176
-
177
- /** The old representation of the document with the relveant document ID. */
178
- readonly oldDocument?: Document
179
-
180
- /**
181
- * Returns a hash that represents the set of matching documents.
182
- *
183
- * @deprecated use {@link Document.hash | Document.hash()} instead.
184
- */
185
- hash(document: Document | null): BigInt {
186
- Logger.warning('SingleDocumentLiveQueryEvent.hash() is deprecated, use Document.hash() instead')
187
- const documentHandles = Bridge.document.handlesFor(document == null ? [] : [document])
188
- return FFI.documentsHash(documentHandles.deref())
189
- }
190
-
191
- /**
192
- * Returns a pattern of words that together create a mnemonic, which
193
- * represents the set of matching documents.
194
- *
195
- * @deprecated use {@link Document.hashMnemonic | Document.hashMnemonic()} instead.
196
- */
197
- hashMnemonic(document: Document | null): string {
198
- Logger.warning('SingleDocumentLiveQueryEvent.hashMnemonic() is deprecated, use Document.hashMnemonic() instead')
199
- const documentHandles = Bridge.document.handlesFor(document == null ? [] : [document])
200
- return FFI.documentsHashMnemonic(documentHandles.deref())
201
- }
202
-
203
- /** @internal */
204
- constructor(isInitial: boolean, oldDocument?: Document) {
205
- this.isInitial = isInitial
206
- this.oldDocument = oldDocument
207
- }
208
- }
@@ -1,101 +0,0 @@
1
- //
2
- // Copyright © 2023 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as FFI from './ffi'
6
- import { Bridge } from './bridge'
7
- import { KeepAlive } from './keep-alive'
8
- import { LiveQuery } from './live-query'
9
- import { step } from './internal'
10
-
11
- import type { Ditto } from './ditto'
12
-
13
- /** @internal */
14
- export class LiveQueryManager {
15
- readonly ditto: Ditto
16
- readonly keepAlive: KeepAlive
17
-
18
- /** @internal */
19
- constructor(ditto: Ditto, keepAlive: KeepAlive) {
20
- this.ditto = ditto
21
- this.keepAlive = keepAlive
22
- this.liveQueriesByID = {}
23
- }
24
-
25
- /** @internal */
26
- startLiveQuery(liveQuery: LiveQuery) {
27
- const ditto = this.ditto
28
- const dittoHandle = Bridge.ditto.handleFor(ditto)
29
-
30
-
31
-
32
- ditto.deferCloseAsync(async () => {
33
- const liveQueryID = liveQuery.liveQueryID
34
- if (!liveQueryID) {
35
- throw new Error("Internal inconsistency, tried to add a live query that doesn't have a live query ID (probably stopped).")
36
- }
37
-
38
- const existingLiveQuery = this.liveQueriesByID[liveQueryID]
39
- if (existingLiveQuery) {
40
- throw new Error('Internal inconsistency, tried to add a live query with an ID that has already been added.')
41
- }
42
-
43
- const weakLiveQuery = new WeakRef(liveQuery)
44
- this.liveQueriesByID[liveQueryID] = weakLiveQuery
45
- this.finalizationRegistry.register(liveQuery, liveQueryID, this.finalize)
46
- liveQuery.liveQueryManager = this
47
-
48
- ditto.keepAlive.retain(`LiveQuery.${liveQueryID}`)
49
-
50
- return new Promise((resolve, reject) => {
51
-
52
- step(async () => {
53
- await FFI.liveQueryStart(dittoHandle.deref(), liveQueryID)
54
- resolve()
55
- })
56
- })
57
- })
58
- }
59
-
60
- /** @internal */
61
- stopLiveQuery(liveQuery: LiveQuery) {
62
- this.finalizationRegistry.unregister(liveQuery)
63
- const liveQueryID = liveQuery.liveQueryID
64
- if (!liveQueryID) {
65
- throw new Error("Internal inconsistency, tried to remove a live query that doesn't have a live query ID (probably stopped).")
66
- }
67
-
68
- liveQuery.liveQueryManager = null
69
- this.stopLiveQueryWithID(liveQueryID)
70
- }
71
-
72
- /** @internal */
73
- close() {
74
- for (const liveQueryID in this.liveQueriesByID) {
75
- const weakLiveQuery = this.liveQueriesByID[liveQueryID]
76
- const liveQuery = weakLiveQuery.deref()
77
- if (liveQuery) {
78
- this.stopLiveQuery(liveQuery)
79
- }
80
- }
81
- }
82
-
83
- // ------------------------------------------------------------ Private ------
84
-
85
- private liveQueriesByID: { [key: number]: WeakRef<LiveQuery> }
86
- private finalizationRegistry = new FinalizationRegistry(this.finalize)
87
-
88
- private stopLiveQueryWithID(liveQueryID: number) {
89
- const ditto = this.ditto
90
- const dittoHandle = Bridge.ditto.handleFor(ditto)
91
- ditto.deferClose(() => {
92
- FFI.liveQueryStop(dittoHandle.deref(), liveQueryID)
93
- this.keepAlive.release(`LiveQuery.${liveQueryID}`)
94
- delete this.liveQueriesByID[liveQueryID]
95
- })
96
- }
97
-
98
- private finalize(liveQueryID: number) {
99
- this.stopLiveQueryWithID(liveQueryID)
100
- }
101
- }
@@ -1,164 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as FFI from './ffi'
6
-
7
- import { Bridge } from './bridge'
8
- import { Collection } from './collection'
9
-
10
- import { LiveQueryEventInitial } from './live-query-event'
11
- import { LiveQueryEventUpdate } from './live-query-event'
12
-
13
- import type { QueryArguments } from './essentials'
14
- import type { LiveQueryEvent } from './live-query-event'
15
- import type { LiveQueryManager } from './live-query-manager'
16
- import type { QueryObservationHandler } from './pending-cursor-operation'
17
-
18
- /**
19
- * The type that is returned when calling
20
- * {@link PendingCursorOperation.observeLocal | observeLocal()} on a
21
- * {@link PendingCursorOperation} object. It handles the logic for calling the
22
- * event handler that is provided to `observeLocal()` calls.
23
- *
24
- * Ditto will prevent the process from exiting as long as there are active live
25
- * queries (not relevant when running in the browser).
26
- *
27
- * `LiveQuery` objects must be kept in scope for as long as you wish to have
28
- * your event handler be called when there is an update to a document matching
29
- * the query you provide. When you no longer want to receive updates about
30
- * documents matching a query then you must call {@link stop | stop()}.
31
- */
32
- export class LiveQuery {
33
- /** The query that the live query is based on. */
34
- readonly query: string
35
-
36
- /** The arguments belonging to {@link query}. */
37
- readonly queryArgs: QueryArguments | null
38
-
39
- /** The name of the collection that the live query is based on. */
40
- get collectionName(): string {
41
- return this.collection.name
42
- }
43
-
44
- /** Returns true if the receiver has been stopped. */
45
- get isStopped(): boolean {
46
- return !this.liveQueryManager
47
- }
48
-
49
- /**
50
- * Stop the live query from delivering updates.
51
- */
52
- stop() {
53
- if (!this.isStopped) {
54
- ;(this.liveQueryManager as LiveQueryManager).stopLiveQuery(this)
55
- }
56
- }
57
-
58
- // ----------------------------------------------------------- Internal ------
59
-
60
- /** @internal */
61
- orderBys: FFI.OrderBy[]
62
-
63
- /** @internal */
64
- queryArgsCBOR: Uint8Array | null
65
-
66
- /** @internal */
67
- readonly limit: number
68
-
69
- /** @internal */
70
- readonly offset: number
71
-
72
- /** @internal */
73
- readonly collection: Collection
74
-
75
- /** @internal */
76
- readonly handler: QueryObservationHandler
77
-
78
- /**
79
- * This field is only populated while a live query is active and set to null
80
- * when the live query is stopped.
81
- *
82
- * @internal
83
- */
84
- liveQueryManager: LiveQueryManager | null
85
-
86
- get liveQueryID(): number {
87
- return this._liveQueryID
88
- }
89
-
90
- /** @internal */
91
- constructor(query: string, queryArgs: QueryArguments | null, queryArgsCBOR: Uint8Array | null, orderBys: FFI.OrderBy[], limit: number, offset: number, collection: Collection, handler: QueryObservationHandler) {
92
- this.query = query
93
- this.queryArgs = queryArgs ? Object.freeze({ ...queryArgs }) : null
94
- this.queryArgsCBOR = queryArgsCBOR
95
- this.orderBys = orderBys
96
- this.limit = limit
97
- this.offset = offset
98
- this.collection = collection
99
- this.handler = handler
100
- this.liveQueryManager = null
101
-
102
- const collectionName = collection.name
103
- const weakDitto = new WeakRef(collection.store.ditto)
104
-
105
- let liveQueryID: number | undefined = undefined
106
- const signalNext = async () => {
107
- const ditto = weakDitto.deref()
108
- if (!ditto) return
109
-
110
- const dittoHandle = Bridge.ditto.handleFor(ditto)
111
- const dittoPointer = dittoHandle.derefOrNull()
112
- if (!dittoPointer) return
113
-
114
- return ditto.deferCloseAsync(async () => {
115
- await FFI.liveQuerySignalAvailableNext(dittoPointer, liveQueryID as number)
116
- })
117
- }
118
-
119
- const ditto = collection.store.ditto
120
- const dittoHandle = Bridge.ditto.handleFor(ditto)
121
- ditto.deferClose(() => {
122
- liveQueryID = FFI.liveQueryRegister(dittoHandle.deref(), collectionName, query, queryArgsCBOR, this.orderBys, limit, offset, (cCBParams) => {
123
- const documents = cCBParams.documents.map((ptr) => Bridge.document.bridge(ptr))
124
-
125
- let event: LiveQueryEvent
126
- if (cCBParams.is_initial) {
127
- event = new LiveQueryEventInitial()
128
- } else {
129
- event = new LiveQueryEventUpdate({
130
- oldDocuments: cCBParams.old_documents.map((ptr) => Bridge.document.bridge(ptr)),
131
- insertions: cCBParams.insertions,
132
- deletions: cCBParams.deletions,
133
- updates: cCBParams.updates,
134
- moves: cCBParams.moves.map((move) => ({ from: move[0], to: move[1] })),
135
- })
136
- }
137
-
138
- handler(documents, event, signalNext)
139
- })
140
- })
141
-
142
- if (!liveQueryID) {
143
- throw new Error("Internal inconsistency, couldn't create a valid live query ID.")
144
- }
145
-
146
- this._liveQueryID = liveQueryID as number
147
- }
148
-
149
- /** @internal */
150
- async signalNext() {
151
- const ditto = this.collection.store.ditto
152
- const dittoHandle = Bridge.ditto.handleFor(ditto)
153
- const dittoPointer = dittoHandle.derefOrNull()
154
- if (!dittoPointer) return
155
-
156
- return ditto.deferCloseAsync(async () => {
157
- await FFI.liveQuerySignalAvailableNext(dittoHandle.deref(), this.liveQueryID)
158
- })
159
- }
160
-
161
- // ------------------------------------------------------------ Private ------
162
-
163
- private _liveQueryID: number
164
- }
@@ -1,196 +0,0 @@
1
- //
2
- // Copyright © 2021 DittoLive Incorporated. All rights reserved.
3
- //
4
-
5
- import * as Environment from './@environment'
6
- import * as FFI from './ffi'
7
-
8
- /** The log levels supported by Ditto. */
9
- export type LogLevel = 'Error' | 'Warning' | 'Info' | 'Debug' | 'Verbose'
10
-
11
- /**
12
- * Closure that {@link Logger.setCustomLogCallback} can be set as a custom
13
- * log callback on {@link Logger}.
14
- */
15
- export type CustomLogCallback = (logLevel: LogLevel, message: string) => void
16
-
17
- /**
18
- * Class with static methods to customize the logging behavior from Ditto and
19
- * log messages with the Ditto logging infrastructure.
20
- */
21
- export class Logger {
22
- /**
23
- * Registers a file path where logs will be written to, whenever Ditto wants
24
- * to issue a log (on _top_ of emitting the log to the console).
25
- */
26
- static get logFile(): string | undefined {
27
- return this._logFile
28
- }
29
-
30
- /**
31
- * On Node, registers a file path where logs will be written to, whenever
32
- * Ditto wants to issue a log (on _top_ of emitting the log to the console).
33
- * In the browser, this method has no effect.
34
- *
35
- * @param path can be `null`, in which case the current logging file, if any,
36
- * is unregistered, otherwise, the file path must be within an already
37
- * existing directory.
38
- */
39
- static setLogFile(path: string | null) {
40
- if (path) {
41
- FFI.loggerSetLogFile(path)
42
- this._logFile = path
43
- } else {
44
- FFI.loggerSetLogFile(undefined)
45
- delete this._logFile
46
- }
47
- }
48
-
49
- /**
50
- * Convenience method, takes the path part of the URL and calls
51
- * {@link setLogFile | setLogFile()} with it.
52
- */
53
- static setLogFileURL(url: URL | undefined) {
54
- this.setLogFile(url?.pathname ?? null)
55
- }
56
-
57
- /** Whether the logger is currently enabled. */
58
- static get enabled(): boolean {
59
- return FFI.loggerEnabledGet()
60
- }
61
-
62
- /** Enables or disables logging. */
63
- static set enabled(enabled: boolean) {
64
- FFI.loggerEnabled(enabled)
65
- }
66
-
67
- /**
68
- * Represents whether or not emojis should be used as the log level
69
- * indicator in the logs.
70
- */
71
- static get emojiLogLevelHeadingsEnabled(): boolean {
72
- return FFI.loggerEmojiHeadingsEnabledGet()
73
- }
74
-
75
- /**
76
- * Represents whether or not emojis should be used as the log level
77
- * indicator in the logs.
78
- */
79
- static set emojiLogLevelHeadingsEnabled(emojiLogLevelHeadingsEnabled: boolean) {
80
- FFI.loggerEmojiHeadingsEnabled(emojiLogLevelHeadingsEnabled)
81
- }
82
-
83
- /**
84
- * The minimum log level at which logs will be logged.
85
- *
86
- * For example if this is set to `Warning`, then only logs that are logged
87
- * with the `Warning` or `Error` log levels will be shown.
88
- */
89
- static get minimumLogLevel(): LogLevel {
90
- return FFI.loggerMinimumLogLevelGet()
91
- }
92
-
93
- /**
94
- * The minimum log level at which logs will be logged.
95
- *
96
- * For example if this is set to `Warning`, then only logs that are logged
97
- * with the `Warning` or `Error` log levels will be shown.
98
- */
99
- static set minimumLogLevel(minimumLogLevel: LogLevel) {
100
- FFI.loggerMinimumLogLevel(minimumLogLevel)
101
- }
102
-
103
- /**
104
- * Returns the current custom log callback, `undefined` by default. See
105
- * {@link setCustomLogCallback | setCustomLogCallback()} for a detailed
106
- * description.
107
- */
108
- static get customLogCallback(): CustomLogCallback | undefined {
109
- return this._customLogCallback
110
- }
111
-
112
- /**
113
- * Registers a custom callback that will be called to report each log entry.
114
- *
115
- * @param callback function called for each log entry. `undefined` will
116
- * unregister any previous callback and stop reporting log entries through
117
- * callbacks.
118
- *
119
- * @throws {Error} if called in a React Native environment.
120
- */
121
- static async setCustomLogCallback(callback: CustomLogCallback | undefined): Promise<void> {
122
- if (Environment.isReactNativeBuild) {
123
- throw new Error('Logger custom callback is currently not implemented for React Native.')
124
- }
125
-
126
- if (callback) {
127
- await FFI.loggerSetCustomLogCb(callback)
128
- this._customLogCallback = callback
129
- } else {
130
- await FFI.loggerSetCustomLogCb(null)
131
- delete this._customLogCallback
132
- }
133
- }
134
-
135
- /**
136
- * Logs the message for the given `level`.
137
- *
138
- * @see {@link error | error()}
139
- * @see {@link warning | warning()}
140
- * @see {@link info | info()}
141
- * @see {@link debug | debug()}
142
- * @see {@link verbose | verbose()}
143
- */
144
- static log(level: LogLevel, message: string) {
145
- FFI.log(level, message)
146
- }
147
-
148
- /**
149
- * Convenience method, same as calling {@link log | log()} with
150
- * {@link LogLevel} `Error`.
151
- */
152
- static error(message: string) {
153
- this.log('Error', message)
154
- }
155
-
156
- /**
157
- * Convenience method, same as calling {@link log | log()} with
158
- * {@link LogLevel} `Warning`.
159
- */
160
- static warning(message: string) {
161
- this.log('Warning', message)
162
- }
163
-
164
- /**
165
- * Convenience method, same as calling {@link log | log()} with
166
- * {@link LogLevel} `Info`.
167
- */
168
- static info(message: string) {
169
- this.log('Info', message)
170
- }
171
-
172
- /**
173
- * Convenience method, same as calling {@link log | log()} with
174
- * {@link LogLevel} `Debug`.
175
- */
176
- static debug(message: string) {
177
- this.log('Debug', message)
178
- }
179
-
180
- /**
181
- * Convenience method, same as calling {@link log | log()} with
182
- * {@link LogLevel} `Verbose`.
183
- */
184
- static verbose(message: string) {
185
- this.log('Verbose', message)
186
- }
187
-
188
- // ------------------------------------------------------------ Private ------
189
-
190
- private static _logFile?: string
191
- private static _customLogCallback?: CustomLogCallback
192
-
193
- private constructor() {
194
- throw new Error("Logger can't be instantiated, use its static properties & methods directly instead.")
195
- }
196
- }